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五大布局让界面更加美化,开发起来也更加方便.当然 ...
随机推荐
- CLR基础
一.各个语言的长处 ①非托管C/C++可对系统进行低级控制.可完全按照自己的想法管理内存,必要时方便地创建线程②使用Microsoft Visual Basic 6.0可以快速生成UI应用程序,并可以 ...
- JavaSE基础之double数据类型的格式化
JavaSE基础之double数据类型的格式化 1.double 数据类型的格式化工具类:DoubleFormatUtil.java package cn.com.zfc.util; import j ...
- EL表达式和JSTL标准标签库
一.EL表达式 什么是EL表达式 EL(Express Lanuage)表达式可以嵌入在jsp页面内部 减少jsp脚本的编写 EL出现的目的是要替代jsp页面中脚本的编写. EL表达式的作用 EL最主 ...
- codevs 5790 素数序数
5790 素数序数(筛素数版) 时间限制: 1 s 空间限制: 32000 KB 题目等级 : 黄金 Gold 题目描述 Description 给定一个整数n,保证n为正整数且在int范 ...
- 【扩展欧几里得】BZOJ1477-青蛙的约会
一直在WA,后来我发现我把东西看反了…… [题目大意] 给出一个长度为L的环状坐标轴,两个点开始时位于(X,0).(Y,0).每次两点分别往右边移动m和n,问能否相遇? [思路] 由题意,可得: X+ ...
- BlocksKit(2)-DynamicDelegate
BlocksKit(2)-DynamicDelegate 动态代理可以说是这个Block里面最精彩的一部分了,可以通过自己给一个类的的协议方法指定对应的block来实现让这个协议的回调都直接在bloc ...
- hdu 2197 推公式
题意:由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串?答案mod2008.例如,100100不是本原串,因为他是由两 ...
- opencv第一课 打开一个图片
#include<stdio.h>#include<stdlib.h>#include<opencv2\opencv.hpp>#include<iostrea ...
- Codeforces Round #280 (Div. 2) A. Vanya and Cubes 水题
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 华为S5300系列升级固件S5300SI-V100R003C00SPC301.cc
这个固件是升级V100R005的中间件,所以是必经的,注意,这个固件带有http的服务,但现在无论官网还是外面,几乎找不到这个固件的web功能,如果非要实现,可以拿V100R005的web文件改名为w ...