Inside GDALAllRegister之一: 五大部分
基本信息
在GDAL的Tutorial中开篇即提到GDALAllRegister函数,它会注册所有已知的驱动,包括动态库自动加载的驱动。最关键是这句话:
If for some applications it is necessary to limit the set of drivers it may be helpful to review the code from gdalallregister.cpp.
我就是要精简GDAL的源代码,所以从分析GDALAllRegister函数开始是个好主意。
看之前已经有了几个问题:
第一,register具体指什么?
第二,已知的驱动,通过什么找到这些驱动?
这两个问题答案在 Inside GDALAllRegister之三: 注册指定驱动
第三,动态库自动加载的驱动又是什么?
答案在:Inside GDALAllRegister之二: 自动加载驱动
函数文档在这里:http://www.gdal.org/gdal_8h.html#a9d40bc998bd6ed07ccde96028e85ae26,没有太多信息。这个函数一般在程序中最开头的地方调用一次。
函数的五大部分
进入frmts/gdalallregister.cpp文件,看到这个函数,很长很长。可见支持的驱动非常之多。整个文件就只有这个函数的实现。这个函数主要分成若干部分:
第一部分,自动加载驱动:
GetGDALDriverManager()->AutoLoadDrivers();
第二部分,根据预编译指令注册特定的驱动
这里有很多,下面只列出两个:
#ifdef FRMT_vrt
GDALRegister_VRT();
#endif #ifdef FRMT_gdb
GDALRegister_GDB();
#endif
第三部分,注册一些raw formats
这里有很多,同样列出两个:
/* -------------------------------------------------------------------- */
/* Put raw formats at the end of the list. These drivers support */
/* various ASCII-header labeled formats, so the driver could be */
/* confused if you have files in some of above formats and such */
/* ASCII-header in the same directory. */
/* -------------------------------------------------------------------- */ #ifdef FRMT_raw
GDALRegister_PNM();
GDALRegister_DOQ1();
...
#endif
第四部分,是注册未充分测试的驱动
放到了最后,我全部列出来,用到这写驱动要十分小心。
/* -------------------------------------------------------------------- */
/* Our test for the following is weak or expensive so we try */
/* them last. */
/* -------------------------------------------------------------------- */ #ifdef FRMT_rik
GDALRegister_RIK();
#endif #ifdef FRMT_usgsdem
GDALRegister_USGSDEM();
#endif #ifdef FRMT_gxf
GDALRegister_GXF();
#endif #ifdef FRMT_grass
GDALRegister_GRASS();
#endif #ifdef FRMT_dods
GDALRegister_DODS();
#endif #ifdef FRMT_wcs
GDALRegister_HTTP();
#endif #ifdef FRMT_hdf5
GDALRegister_BAG();
GDALRegister_HDF5();
GDALRegister_HDF5Image();
#endif #ifdef FRMT_northwood
GDALRegister_NWT_GRD();
GDALRegister_NWT_GRC();
#endif #ifdef FRMT_adrg
GDALRegister_ADRG();
GDALRegister_SRP();
#endif #ifdef FRMT_blx
GDALRegister_BLX();
#endif #ifdef FRMT_pgchip
GDALRegister_PGCHIP();
#endif #ifdef FRMT_georaster
GDALRegister_GEOR();
#endif #ifdef FRMT_rasterlite
GDALRegister_Rasterlite();
#endif #ifdef FRMT_epsilon
GDALRegister_EPSILON();
#endif #ifdef FRMT_postgisraster
GDALRegister_PostGISRaster();
#endif #ifdef FRMT_saga
GDALRegister_SAGA();
#endif #ifdef FRMT_kmlsuperoverlay
GDALRegister_KMLSUPEROVERLAY();
#endif #ifdef FRMT_xyz
GDALRegister_XYZ();
#endif #ifdef FRMT_hf2
GDALRegister_HF2();
#endif #ifdef FRMT_pdf
GDALRegister_PDF();
#endif #ifdef FRMT_jpegls
GDALRegister_JPEGLS();
#endif #ifdef FRMT_ozi
GDALRegister_OZI();
#endif
第五部分,将那些在环境变量GDAL_SKIP被明显标为不支持的驱动反注册
/* -------------------------------------------------------------------- */
/* Deregister any drivers explicitly marked as supressed by the */
/* GDAL_SKIP environment variable. */
/* -------------------------------------------------------------------- */
GetGDALDriverManager()->AutoSkipDrivers();
由于涉及的内容太多,一篇太长,还是分到几篇具体分析吧。
Inside GDALAllRegister之一: 五大部分的更多相关文章
- Inside GDALAllRegister之二: 自动加载驱动
代码 GetGDALDriverManager()->AutoLoadDrivers(); 包含了两部分: 首先获得GDALDriverManager的singleton对象的指针,这点之 ...
- Inside GDALAllRegister之四: 跳过driver
这个函数很短小: /** * \brief This method unload undesirable drivers. * * All drivers specified in the space ...
- Inside GDALAllRegister之三: 注册指定驱动
现在来仔细分析如何注册一个驱动的代码,看下面代码: #ifdef FRMT_vrt GDALRegister_VRT(); #endif 编译时指定或者取消FRMT_vrt,可以控制这条语句是否编译到 ...
- 《Redis入门指南(第二版)》读书思考总结之Redis五大数据类型
热身:系统级命令 1. 获得符合规则的键名列表 KEYS pattern 模式匹配 产品的缓存:product+"."+....; => keys product* 订单的 ...
- 五大主流浏览器 CSS3 和 HTML5 兼容性大比拼
各大主流浏览器对 CSS3 和 HTML5 的支持越来越完善,曾经让多少前端开发人员心碎的IE系也开始拥抱标准.就在前几天,W3C的 HTML5 社区领袖 Shelley 宣布,HTML5的开发工作已 ...
- vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法
---恢复内容开始--- 最近在安装了vsftpd后 添加了虚拟账户后 新建用户 为新用户创立独立的工作目录 因为虚拟用户在工作目录需要上传文件 所以必须拥有此目录的W权限,但每当给此目录加上W权限后 ...
- 解决vsftpd的refusing to run with writable root inside chroot错误
参考 http://www.cnblogs.com/CSGrandeur/p/3754126.html 在Ubuntu下用 vsftpd 配置FTP服务器,配置 “ sudo chmod a-w /h ...
- SQL Server 2016五大优势挖掘企业用户数据价值
SQL Server 2016五大优势挖掘企业用户数据价值 转载自:http://soft.zdnet.com.cn/software_zone/2016/0318/3074442.shtml 3月1 ...
- Android开发-之五大布局
在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...
随机推荐
- Web应用扫描工具Wapiti
Web应用扫描工具Wapiti Wapiti是Kali Linux预置的一款Web应用扫描工具.该工具执行黑盒扫描,用户只需要输入要扫描的网址即可.该工具可以探测文件包含.数据库注入.XSS.CR ...
- iOS WKWebview 网页开发适配指南
iOS WKWebview 网页开发适配指南 微信iOS客户端将于2017年3月1日前逐步升级为WKWebview内核,需要网页开发者提前做好网站的兼容检查和适配.如有问题,可参考文末联系方式,向我们 ...
- python 自带的range是不能实现对小数的操作的,如果要对小数操作可以使用numpy
import numpy as np s = np.arange(0, 1, 0.1) print s [0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9]
- luoguP4696 [CEOI2011]Matching KMP+树状数组
可以非常轻易的将题意转化为有多少子串满足排名相同 注意到$KMP$算法只会在当前字符串的某尾添加和删除字符 因此,如果添加和删除后面的字符对于前面的字符没有影响时,我们可以用$KMP$来模糊匹配 对于 ...
- [CF1086E]Beautiful Matrix(容斥+DP+树状数组)
给一个n*n的矩阵,保证:(1)每行都是一个排列 (2)每行每个位置和上一行对应位置不同.求这个矩阵在所有合法矩阵中字典序排第几.考虑类似数位DP的做法,枚举第几行开始不卡限制,那么显然之前的行都和题 ...
- 【Floyd(并非水题orz)】BZOJ4093-[Usaco2013 Dec]Vacation Planning
最近刷水太多标注一下防止它淹没在silver的水题中……我成为了本题,第一个T掉的人QAQ [题目大意] Bovinia设计了连接N (1 < = N < = 20,000)个农场的航班. ...
- JavaScript将具有父子关系的原始数据格式化成树形结构数据(id,pid)
前几天遇到一个树型组件(类似树形菜单)数据格式化的问题,由于后台把原始查询的数据直接返回给前端,父子关系并未构建,因此需要前端JS来完成,后台返回的数据和下面的测试数据相似. var data=[ { ...
- TensorFlow安装和HelloWorld
TensorFlow安装 TensorFlow可以在各种操作系统上面安装.安装的时候要注意TensorFlow的类型,一种是普通的版本,仅支持CPU,安装简单.另外一种类型带GPU的,可以利用GPU来 ...
- Automate Screen or Button Taps via Tasker : Simulating keypress events
When using Tasker, sometimes we want to do some automation on screen e.g. screen or button taps. At ...
- How to match between physical usb device and its drive letter?
struct tagDrives { WCHAR letter; WCHAR volume[ BUFFER_SIZE ]; } g_drives[ ]; // WCHAR GetUSBDrive( ) ...