基本信息

在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之一: 五大部分的更多相关文章

  1. Inside GDALAllRegister之二: 自动加载驱动

    代码    GetGDALDriverManager()->AutoLoadDrivers(); 包含了两部分: 首先获得GDALDriverManager的singleton对象的指针,这点之 ...

  2. Inside GDALAllRegister之四: 跳过driver

    这个函数很短小: /** * \brief This method unload undesirable drivers. * * All drivers specified in the space ...

  3. Inside GDALAllRegister之三: 注册指定驱动

    现在来仔细分析如何注册一个驱动的代码,看下面代码: #ifdef FRMT_vrt GDALRegister_VRT(); #endif 编译时指定或者取消FRMT_vrt,可以控制这条语句是否编译到 ...

  4. 《Redis入门指南(第二版)》读书思考总结之Redis五大数据类型

    热身:系统级命令 1. 获得符合规则的键名列表 KEYS pattern 模式匹配 产品的缓存:product+"."+....;  => keys product* 订单的 ...

  5. 五大主流浏览器 CSS3 和 HTML5 兼容性大比拼

    各大主流浏览器对 CSS3 和 HTML5 的支持越来越完善,曾经让多少前端开发人员心碎的IE系也开始拥抱标准.就在前几天,W3C的 HTML5 社区领袖 Shelley 宣布,HTML5的开发工作已 ...

  6. vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法

    ---恢复内容开始--- 最近在安装了vsftpd后 添加了虚拟账户后 新建用户 为新用户创立独立的工作目录 因为虚拟用户在工作目录需要上传文件 所以必须拥有此目录的W权限,但每当给此目录加上W权限后 ...

  7. 解决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 ...

  8. SQL Server 2016五大优势挖掘企业用户数据价值

    SQL Server 2016五大优势挖掘企业用户数据价值 转载自:http://soft.zdnet.com.cn/software_zone/2016/0318/3074442.shtml 3月1 ...

  9. Android开发-之五大布局

    在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...

随机推荐

  1. django组件之contenttype(一)

    方式1:适用于1张表和另一张表要关联的时候. 1.路飞学成表设计: 2.将2个价格策略表合并1张表. 3.如果再加一张表,那价格策略表的表结构会发生改变.  这样不合理的,我们的表结构一般设计完就不会 ...

  2. [BZOJ3309]DZY Loves Math(莫比乌斯反演+线性筛)

    $\sum\limits_{T=1}^{n}\lfloor\frac{n}{T}\rfloor\lfloor\frac{m}{T}\rfloor\sum\limits_{d|T}f(d)\mu(\fr ...

  3. LeetCode:删除排序数组中的重复项 (Remove Duplicates from Sorted Array)

    public class RemoveDuplicates { /** * 修改数组,使数组有序不重复.超出长度不考虑. * @param 排序数组 * @return 数组不重复数的个数 */ pu ...

  4. 【洛谷】NOIP提高组模拟赛Day1【组合数学】【贪心+背包】【网络流判断是否满流以及流量方案】

    U41568 Agent1 题目背景 2018年11月17日,中国香港将会迎来一场XM大战,是世界各地的ENLIGHTENED与RESISTANCE开战的地点,某地 的ENLIGHTENED总部也想派 ...

  5. 【转载】VC操作剪切板

    1.在剪切板上放置数据 if(OpenClipboard())    //打开剪切板{    EmptyClipboard(); //清空剪切板    CString str;       //从控件 ...

  6. HDU 5715 XOR 游戏 二分+字典树

    XOR 游戏 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5715 Description 众所周知,度度熊喜欢XOR运算(XOR百科). 今天,它 ...

  7. Oil Deposits 搜索 bfs 强联通

    Description The GeoSurvComp geologic survey company is responsible for detecting underground oil dep ...

  8. CentOS6.X关闭防火墙

    一.关闭防火墙 1.重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2.即时生效,重启后失效: 开启:service ipta ...

  9. Vue基础知识简介

    基础知识: vue的生命周期: beforeCreate/created.beforeMount/mounted.beforeUpdate/updated.beforeDestory/destorye ...

  10. HDU 4716 A Computer Graphics Problem (水题)

    A Computer Graphics Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J ...