DataSetsManager.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/DataSetsManager.h
22 
23  \brief GDAL data set manager.
24  */
25 
26 #ifndef __TERRALIB_DATAACCES_GDAL_INTERNAL_DATASETSMANAGER_H
27 #define __TERRALIB_DATAACCES_GDAL_INTERNAL_DATASETSMANAGER_H
28 
29 #include "Config.h"
30 #include "../common/Singleton.h"
31 
32 #include <map>
33 #include <string>
34 
35 #include <boost/thread/mutex.hpp>
36 
37 #include <memory>
38 
39 namespace te
40 {
41  namespace gdal
42  {
43  class DataSet;
44 
45  /*!
46  \class DataSetsManager
47 
48  \brief GDAL data set manager.
49  */
50  class TEGDALEXPORT DataSetsManager : public te::common::Singleton< te::gdal::DataSetsManager >
51  {
53 
54  public :
55 
56  /*! \enum Info regarding the uri access (bit field). */
58  {
59  MultipleAccessType = 0, /*!< Allows multiple concurrent connections to the uri. */
60  SingleAccessType = 1 /*!< Allows just one single connection to the uri. */
61  };
62 
63  /*!
64  \brief Try to increment the use counter for the given raster URI.
65  \param uri RasterURI.
66  \param aType Access type.
67  \return true if OK, false if the increment could not be done.
68  */
69  bool incrementUseCounter( const std::string& uri, const AccessType aType );
70 
71  /*!
72  \brief Decrement the use counter for the given raster URI.
73  \param uri RasterURI.
74  */
75  void decrementUseCounter( const std::string& uri );
76 
77 
78  protected :
79 
80  typedef std::map< std::string, std::pair< AccessType, unsigned long int > > UrisInfoT;
81 
83 
84  ~DataSetsManager();
85 
86  mutable UrisInfoT m_openURIS; //!< Current open URIs.
87 
88  mutable boost::mutex m_mutex; //!< Internal thread sync mutex.
89  };
90  } // end namespace gdal
91 } // end namespace te
92 
93 #endif // __TERRALIB_DATAACCES_GDAL_INTERNAL_DATASETSMANAGER_H
UrisInfoT m_openURIS
Current open URIs.
#define TEGDALEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:67
std::map< std::string, std::pair< AccessType, unsigned long int > > UrisInfoT
URI C++ Library.
boost::mutex m_mutex
Internal thread sync mutex.
GDAL data set manager.
Configuration flags for the GDAL Driver of TerraLib.
Template support for singleton pattern.
Definition: Singleton.h:100