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五大布局让界面更加美化,开发起来也更加方便.当然 ...
随机推荐
- alpha冲刺阶段博客集合
作业格式 课程名称:软件工程1916|W(福州大学) 作业要求:项目Alpha冲刺(团队) 团队名称: 那周余嘉熊掌将得队 作业目标:作业集合 团队信息: 队员学号 队员姓名 博客地址 备注 2216 ...
- BZOJ 1283 序列 费用流 网络流 线性规划
https://darkbzoj.cf/problem/1283 给出一个长度为N的正整数序列Ci,求一个子序列,使得原序列中任意长度为M的子串中被选出的元素不超过K(K,M<=100) 个,并 ...
- bzoj3173 Splay 维护前缀中的最大值
大致题意: 有一个空序列,依次插入1~N到该序列中,每次指定插入的位置,每次插入完成返回当前序列的LIS的长度. 题解: 设dp[i]表示 前缀1~i的最长上升子序列的长度. 因为是按照递增顺序插入的 ...
- Codeforces Round #294 (Div. 2)A - A and B and Chess 水题
A. A and B and Chess time limit per test 1 second memory limit per test 256 megabytes input standard ...
- PUSH MESSAGE 云控等交互类测试业务的自动化
针对的业务: 1. PUSH消息,即由云端服务向客户端推送消息 2. MESSAG消息,即用户间消息.用户群消息和聊天室消息 上干货,框架见下图:
- poj 1279 Art Gallery - 求多边形核的面积
/* poj 1279 Art Gallery - 求多边形核的面积 */ #include<stdio.h> #include<math.h> #include <al ...
- make and make bzImage
2.6内核 make = make bzImage + make modules 无非是改下Makefile而已 2.4 内核 01.make menuconfig 02.make dep 03.ma ...
- Flex4+spring+hibernate+BlazeDS整合案例
http://wenku.baidu.com/link?url=7v5xAyD2nvChQRT60QewpvAASFHMZNvD0OxX11OASYvae8jbVNsr5I000TwwYOlChzq0 ...
- 人类即将进入互联网梦境时代(IDA)
在电影<盗梦空间>中,男主角科布和妻子在梦境中生活了50年,从楼宇.商铺.到河流浅滩.一草一木.这两位造梦师用意念建造了属于自己的梦境空间.你或许并不会想到,在不久未来,这看似科幻的情节将 ...
- java hashcode()和equal()方法比较
通常equals,toString,hashCode,在应用中都会被复写,建立具体对象的特有的内容. 之所以有hashCode方法,是因为在批量的对象比较中,hashCode要比equals来得快,很 ...