OTB  9.0.0
Orfeo Toolbox
otbGDALDriverManagerWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbGDALDriverManagerWrapper_h
22 #define otbGDALDriverManagerWrapper_h
23 
24 
25 #include "itkLightObject.h"
26 #include "itkProcessObject.h"
27 #include "otbConfigure.h"
28 
29 class GDALDataset;
30 class GDALDriver;
31 
32 /* GDAL Libraries */
33 #include "gdal.h"
34 #include "gdaljp2metadata.h"
35 #include "gdal_priv.h"
36 #include "gdal_alg.h"
37 
38 #include "otbGDALDatasetWrapper.h"
39 // otb::GDALOverviewsBuilder moved to self header & body files.
40 // Including its header file here for compile time compatibility.
42 
43 namespace otb
44 {
45 
59 // Wraps the GdalDriverManager so that GDALAllRegister is called automatically
61 {
62 public:
63  // GetInstance returns a reference to a GDALDriverManagerWrapper
64  // This is the only entry point to interact with this class
66  {
67 
68  // Declare a static method variable of type GDALDriverManagerWrapper
69  // so that it is constructed and initialized only on the first call
70  // to GetInstance(), and so try to avoid static initialization order problems
71 
72  static GDALDriverManagerWrapper theUniqueInstance;
73  return theUniqueInstance;
74  }
75 
76  // Open the file for reading and returns a smart dataset pointer
77  GDALDatasetWrapper::Pointer Open(std::string filename) const;
78 
79  // Open the new file for writing and returns a smart dataset pointer
80  GDALDatasetWrapper::Pointer Create(std::string& driverShortName, std::string filename, int nXSize, int nYSize, int nBands, GDALDataType eType,
81  char** papszOptions) const;
82 
83 
84  GDALDriver* GetDriverByName(std::string driverShortName) const;
85 
86 private:
87  // private constructor so that this class is allocated only inside GetInstance
89 
91 }; // end of GDALDriverManagerWrapper
92 
93 
94 } // end namespace otb
95 
96 
97 #endif // otbGDALDriverManagerWrapper_h
otbGDALDatasetWrapper.h
otbGDALOverviewsBuilder.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::GDALDriverManagerWrapper::GetDriverByName
GDALDriver * GetDriverByName(std::string driverShortName) const
otb::GDALDriverManagerWrapper::Open
GDALDatasetWrapper::Pointer Open(std::string filename) const
otb::GDALDriverManagerWrapper::GetInstance
static GDALDriverManagerWrapper & GetInstance()
Definition: otbGDALDriverManagerWrapper.h:65
otb::GDALDriverManagerWrapper
Provide an unique instance of a GDALDataSet.
Definition: otbGDALDriverManagerWrapper.h:60
otb::GDALDriverManagerWrapper::GDALDriverManagerWrapper
GDALDriverManagerWrapper()
otb::GDALDatasetWrapper::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGDALDatasetWrapper.h:46
otb::GDALDriverManagerWrapper::~GDALDriverManagerWrapper
~GDALDriverManagerWrapper()
otb::GDALDriverManagerWrapper::Create
GDALDatasetWrapper::Pointer Create(std::string &driverShortName, std::string filename, int nXSize, int nYSize, int nBands, GDALDataType eType, char **papszOptions) const