ScopedDataSetHandle.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/dataaccess/gdal/ScopedDataSetHandle.h
22 
23  \brief This encapsulates a GDAL dataSet and closes it when it runs out of scope. It also creates a wrapper to the dataSet in the cases which the file has a RPC metadata.
24  */
25 
26 #ifndef __TERRALIB_DATAACCES_GDAL_INTERNAL_SCOPEDDATASETHANDLE_H
27 #define __TERRALIB_DATAACCES_GDAL_INTERNAL_SCOPEDDATASETHANDLE_H
28 
29 #include "Config.h"
30 
31 //boost include files
32 #include <boost/noncopyable.hpp>
33 
34 //STL include files
35 #include <memory>
36 
37 class GDALDataset;
38 
39 namespace te
40 {
41  namespace gdal
42  {
43  /*!
44  \class ScopedDataSetHandle
45 
46  \brief This encapsulates a GDAL dataSet and closes it when it runs out of scope. It also creates a wrapper to the dataSet in the cases which the file has a RPC metadata.
47  */
48  class TEGDALEXPORT ScopedDataSetHandle : protected boost::noncopyable
49  {
50  public :
51 
52  /*!
53  \brief Default constructor.
54  */
55  ScopedDataSetHandle(GDALDataset* gdalDataSetHandle);
56 
58 
59  GDALDataset* getGDALDataSetHandle() const;
60 
61  private:
62 
63  GDALDataset* m_gdalDataSetHandle;
65  };
66 
67  using ScopedDataSetHandlePtr = std::unique_ptr<ScopedDataSetHandle>;
68 
69  } // end namespace gdal
70 } // end namespace te
71 
72 #endif // __TERRALIB_DATAACCES_GDAL_INTERNAL_SCOPEDDATASETHANDLE_H
This encapsulates a GDAL dataSet and closes it when it runs out of scope. It also creates a wrapper t...
GDALDataset * getGDALDataSetHandle() const
ScopedDataSetHandle(GDALDataset *gdalDataSetHandle)
Default constructor.
std::unique_ptr< ScopedDataSetHandle > ScopedDataSetHandlePtr
TerraLib.
#define TEGDALEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:67
Proxy configuration file for TerraView (see terraview_config.h).