Commit 8d94a678 authored by Cédric Traizet's avatar Cédric Traizet

ENH: replaced version_proxy::GDALDatasetType by GDALDataset

parent 570807bf
......@@ -164,7 +164,7 @@ public:
* \note No condition is assumed on the non-nullity of \c source.
* \see \c DataSource(GDALDataset *)
*/
static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read , const std::vector< std::string > & layerOptions = std::vector< std::string >() );
static Pointer New(GDALDataset * sourcemode, Modes::type mode = Modes::Read , const std::vector< std::string > & layerOptions = std::vector< std::string >() );
//@}
/**\name Projection Reference property */
......@@ -301,7 +301,7 @@ public:
* \throw None
* \post Assumes ownership of the \c source.
*/
void Reset(ogr::version_proxy::GDALDatasetType * source);
void Reset(GDALDataset * source);
/**\name Layers modification */
//@{
......@@ -495,7 +495,7 @@ public:
* \warning You must under no circumstance try to delete the \c GDALDataset
* obtained this way.
*/
ogr::version_proxy::GDALDatasetType & ogr();
GDALDataset & ogr();
void SetLayerCreationOptions( const std::vector< std::string > & options );
void AddLayerCreationOptions( std::vector< std::string > options );
......@@ -515,7 +515,7 @@ protected:
/** Init constructor.
* \post The newly constructed object owns the \c source parameter.
*/
DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode , const std::vector< std::string > & layerOption = std::vector< std::string >() );
DataSource(GDALDataset * source, Modes::type mode , const std::vector< std::string > & layerOption = std::vector< std::string >() );
/** Destructor.
* \post The \c GDALDataset owned is released (if not null).
*/
......@@ -552,7 +552,7 @@ private:
std::string GetDatasetDescription() const;
private:
ogr::version_proxy::GDALDatasetType *m_DataSource;
GDALDataset *m_DataSource;
std::vector< std::string > m_LayerOptions;
Modes::type m_OpenMode;
int m_FirstModifiableLayerID;
......
......@@ -43,7 +43,7 @@
// to the compilation mode of the client code.
inline
otb::ogr::version_proxy::GDALDatasetType & otb::ogr::DataSource::ogr()
GDALDataset & otb::ogr::DataSource::ogr()
{
assert(m_DataSource && "GDALDataset not initialized");
return *m_DataSource;
......
......@@ -119,7 +119,7 @@ public:
* OGRDataSource::ExecuteSQL(). It's actually the constructor called by \c
* DataSource::ExecuteSQL().
*/
Layer(OGRLayer* layer, otb::ogr::version_proxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable);
Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime, bool modifiable);
//@}
/**\name Features collection */
......
......@@ -58,13 +58,12 @@ namespace version_proxy
*
* Whenever GDALDataset and GDALDriver have to be used to open a
* vector dataset (or OGRDataSource an OGRSFDriver for gdal 1.x), one
* should use ogr::version_proxy types GDALDatasetType and
* should use ogr::version_proxy types GDALDataset and
* GDALDriverType.
*
* See function documentation for details.
*/
typedef GDALDataset GDALDatasetType;
typedef GDALDriver GDALDriverType;
/**
......@@ -79,7 +78,7 @@ namespace version_proxy
* \return NULL if file could not be open.
*/
OTBGdalAdapters_EXPORT
GDALDatasetType * Open(const char * filename, bool readOnly = true , std::vector< std::string > const & options = std::vector< std::string >() );
GDALDataset * Open(const char * filename, bool readOnly = true , std::vector< std::string > const & options = std::vector< std::string >() );
/**
* This function closes a dataset.
......@@ -91,7 +90,7 @@ namespace version_proxy
* checked for null pointer.
*/
OTBGdalAdapters_EXPORT
void Close(GDALDatasetType * dataset);
void Close(GDALDataset * dataset);
/**
* This function creates a new dataset.
......@@ -108,7 +107,7 @@ namespace version_proxy
* \return NULL if dataset could not be created.
*/
OTBGdalAdapters_EXPORT
GDALDatasetType * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options = std::vector< std::string >() );
GDALDataset * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options = std::vector< std::string >() );
/**
......@@ -136,7 +135,7 @@ namespace version_proxy
*/
OTBGdalAdapters_EXPORT
std::vector<std::string> GetFileListAsStringVector(GDALDatasetType * dataset);
std::vector<std::string> GetFileListAsStringVector(GDALDataset * dataset);
/**
* Return the list of available drivers.
......
......@@ -48,7 +48,7 @@ bool otb::ogr::DataSource::Clear()
return true;
}
void otb::ogr::DataSource::Reset(otb::ogr::version_proxy::GDALDatasetType * source)
void otb::ogr::DataSource::Reset(GDALDataset * source)
{
if (m_DataSource) {
// OGR makes a pointless check for non-nullity in
......@@ -137,7 +137,7 @@ otb::ogr::DataSource::DataSource()
}
otb::ogr::DataSource::DataSource(
otb::ogr::version_proxy::GDALDatasetType * source ,
GDALDataset * source ,
Modes::type mode ,
const std::vector< std::string > & options /*NULL*/ )
: m_DataSource(source) ,
......@@ -155,7 +155,7 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c
std::string simpleFileName = fileNameHelper->GetSimpleFileName();
bool update = (mode != Modes::Read);
ogr::version_proxy::GDALDatasetType * source =
GDALDataset * source =
ogr::version_proxy::Open( simpleFileName.c_str() ,
!update ,
fileNameHelper->GetGDALOpenOptions() );
......@@ -228,7 +228,7 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
}
Drivers::Init();
ogr::version_proxy::GDALDatasetType * ds =
GDALDataset * ds =
ogr::version_proxy::Open( simpleFileName.c_str() , true );
bool ds_exists = (ds!=nullptr);
......@@ -246,7 +246,7 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
/*static*/
otb::ogr::DataSource::Pointer
otb::ogr::DataSource::New(otb::ogr::version_proxy::GDALDatasetType * source , Modes::type mode , const std::vector< std::string > & layerOptions )
otb::ogr::DataSource::New(GDALDataset * source , Modes::type mode , const std::vector< std::string > & layerOptions )
{
Pointer res = new DataSource( source , mode , layerOptions );
res->UnRegister();
......
......@@ -69,8 +69,8 @@ otb::ogr::Layer::Layer(OGRLayer* layer, bool modifiable)
{
}
otb::ogr::Layer::Layer(OGRLayer* layer, otb::ogr::version_proxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable)
: m_Layer(layer, boost::bind(&otb::ogr::version_proxy::GDALDatasetType::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
otb::ogr::Layer::Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime, bool modifiable)
: m_Layer(layer, boost::bind(&GDALDataset::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
, m_Modifiable(modifiable)
{
assert(layer && "A null OGRlayer cannot belong to an OGRDataSource" );
......
......@@ -49,13 +49,13 @@ namespace ogr
namespace version_proxy
{
GDALDatasetType * Open(const char * filename, bool readOnly , std::vector< std::string > const & options )
GDALDataset * Open(const char * filename, bool readOnly , std::vector< std::string > const & options )
{
#if GDAL_VERSION_NUM<2000000
(void)options;
return OGRSFDriverRegistrar::Open(filename,!readOnly);
#else
return (GDALDatasetType *)GDALOpenEx(
return (GDALDataset *)GDALOpenEx(
filename,
(readOnly? GDAL_OF_READONLY : GDAL_OF_UPDATE) | GDAL_OF_VECTOR,
NULL,
......@@ -64,7 +64,7 @@ GDALDatasetType * Open(const char * filename, bool readOnly , std::vector< std::
#endif
}
void Close(GDALDatasetType * dataset)
void Close(GDALDataset * dataset)
{
#if GDAL_VERSION_NUM<2000000
OGRDataSource::DestroyDataSource(dataset);
......@@ -73,11 +73,11 @@ void Close(GDALDatasetType * dataset)
#endif
}
GDALDatasetType * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options )
GDALDataset * Create(GDALDriverType * driver, const char * name , std::vector< std::string > const & options )
{
#if GDAL_VERSION_NUM<2000000
(void)options;
GDALDatasetType * ds = driver->CreateDataSource(name);
GDALDataset * ds = driver->CreateDataSource(name);
if(ds)
ds->SetDriver(driver);
......@@ -96,7 +96,7 @@ GDALDatasetType * Create(GDALDriverType * driver, const char * name , std::vect
bool Delete(const char * name)
{
// Open dataset
GDALDatasetType * poDS = otb::ogr::version_proxy::Open(name,false);
GDALDataset * poDS = otb::ogr::version_proxy::Open(name,false);
GDALDriverType * poDriver = NULL;
if(poDS)
{
......@@ -148,7 +148,7 @@ private:
}
#endif
std::vector<std::string> GetFileListAsStringVector(GDALDatasetType * dataset)
std::vector<std::string> GetFileListAsStringVector(GDALDataset * dataset)
{
std::vector<std::string> ret;
#if GDAL_VERSION_NUM<2000000
......
......@@ -74,14 +74,14 @@ public:
unsigned int ProcessNodeWrite(InternalTreeNodeType * source,
ogr::version_proxy::GDALDatasetType * m_DataSource,
GDALDataset * m_DataSource,
OGRGeometryCollection * ogrCollection,
OGRLayer * ogrCurrentLayer,
OGRSpatialReference * oSRS);
/** Return a list of OGRLayer * */
std::vector<OGRLayer*> ConvertDataTreeNodeToOGRLayers(InternalTreeNodeType * source,
ogr::version_proxy::GDALDatasetType * dummyDatasource,
GDALDataset * dummyDatasource,
OGRLayer* ogrCurrentLayer,
OGRSpatialReference * oSRS);
......
......@@ -123,7 +123,7 @@ private:
void CloseInternalDataSource();
ogr::version_proxy::GDALDatasetType * m_DataSource;
GDALDataset * m_DataSource;
};
......
......@@ -651,7 +651,7 @@ void OGRIOHelper
unsigned int OGRIOHelper
::ProcessNodeWrite(InternalTreeNodeType * source,
ogr::version_proxy::GDALDatasetType * m_DataSource,
GDALDataset * m_DataSource,
OGRGeometryCollection * ogrCollection,
OGRLayer * ogrCurrentLayer,
OGRSpatialReference * oSRS)
......@@ -1027,7 +1027,7 @@ unsigned int OGRIOHelper
**/
std::vector<OGRLayer*> OGRIOHelper
::ConvertDataTreeNodeToOGRLayers(InternalTreeNodeType * source,
ogr::version_proxy::GDALDatasetType * inMemoryDataSource,
GDALDataset * inMemoryDataSource,
OGRLayer* ogrCurrentLayer,
OGRSpatialReference * oSRS)
{
......
......@@ -54,7 +54,7 @@ OGRVectorDataIO::~OGRVectorDataIO()
bool
OGRVectorDataIO::CanReadFile(const char* filename) const
{
otb::ogr::version_proxy::GDALDatasetType * poDS = ogr::version_proxy::Open(filename, true);
GDALDataset * poDS = ogr::version_proxy::Open(filename, true);
if (poDS == nullptr)
{
......
......@@ -1727,10 +1727,10 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
/* -------------------------------------------------------------------- */
/* Open data source. */
/* -------------------------------------------------------------------- */
otb::ogr::version_proxy::GDALDatasetType *ref_poDS = nullptr;
GDALDataset *ref_poDS = nullptr;
otb::ogr::version_proxy::GDALDriverType * ref_poDriver = nullptr;
//OGRGeometry * ref_poSpatialFilter = NULL;
otb::ogr::version_proxy::GDALDatasetType *test_poDS = nullptr;
GDALDataset *test_poDS = nullptr;
otb::ogr::version_proxy::GDALDriverType * test_poDriver = nullptr;
//OGRGeometry * test_poSpatialFilter = NULL;
......
......@@ -160,7 +160,7 @@ private:
RasterizeVectorDataFilter(const Self&) = delete;
void operator=(const Self&) = delete;
ogr::version_proxy::GDALDatasetType * m_OGRDataSourcePointer;
GDALDataset * m_OGRDataSourcePointer;
// Vector Of LayersH
std::vector< OGRLayerH > m_SrcDataSetLayers;
......
......@@ -163,7 +163,7 @@ private:
VectorDataToLabelImageFilter(const Self&) = delete;
void operator=(const Self&) = delete;
ogr::version_proxy::GDALDatasetType * m_OGRDataSourcePointer;
GDALDataset * m_OGRDataSourcePointer;
// Vector Of OGRGeometyH
std::vector< OGRGeometryH > m_SrcDataSetGeometries;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment