RasterHandler.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/rp/RasterHandler.h
22  \brief Raster tuple.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_RASTERHANDLER_H
26 #define __TERRALIB_RP_INTERNAL_RASTERHANDLER_H
27 
28 #include "Config.h"
29 
30 #include "../dataaccess/datasource/DataSource.h"
31 #include "../dataaccess/datasource/DataSourceTransactor.h"
32 #include "../dataaccess/dataset/DataSet.h"
33 #include "../raster/Raster.h"
34 
35 #include <boost/noncopyable.hpp>
36 
37 #include <memory>
38 
39 namespace te
40 {
41  namespace rp
42  {
43  /*!
44  \class RasterHandler
45  \brief RasterHandler
46  */
47  class TERPEXPORT RasterHandler : private boost::noncopyable
48  {
49  public :
50 
51  RasterHandler();
52 
53  ~RasterHandler();
54 
55  /*!
56  \brief Build a instance using the given naked pointers.
57  \param dataSourcePtr Data source pointer.
58  \param transactorPtr A pointer to a transactor instance related to the data source pointed by dataSourcePtr.
59  \param dataSetPtr A pointer to a data set instance related to the instance pointed by persistencePtr.
60  \param rasterPtr A pointer to a raster instance related to the instance pointed by rasterPtr.
61  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
62  */
64  te::da::DataSource* dataSourcePtr,
65  te::da::DataSourceTransactor* transactorPtr,
66  te::da::DataSet* dataSetPtr,
67  te::rst::Raster* rasterPtr );
68 
69  /*!
70  \brief Build a instance using the given naked pointers.
71  \param transactorPtr Transactor pointer.
72  \param dataSetPtr A pointer to a data set instance related to the instance pointed by persistencePtr.
73  \param rasterPtr A pointer to a raster instance related to the instance pointed by rasterPtr.
74  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
75  */
77  te::da::DataSourceTransactor* transactorPtr,
78  te::da::DataSet* dataSetPtr,
79  te::rst::Raster* rasterPtr );
80 
81  /*!
82  \brief Build a instance using the given raster naked pointer.
83  \param rasterPtr A pointer to a raster instance.
84  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
85  */
86  RasterHandler( te::rst::Raster* rasterPtr );
87 
88  /*!
89  \brief Reset the internal state (all internal pointed objects are deleted).
90  */
91  void reset();
92 
93  /*!
94  \brief Reset the internal state (all pointed objects are deleted).
95  \param dataSourcePtr Data source pointer.
96  \param transactorPtr A pointer to a transactor instance related to the data source pointed by dataSourcePtr.
97  \param dataSetPtr A pointer to a data set instance related to the instance pointed by persistencePtr.
98  \param rasterPtr A pointer to a raster instance related to the instance pointed by rasterPtr.
99  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
100  */
101  void reset(
102  te::da::DataSource* dataSourcePtr,
103  te::da::DataSourceTransactor* transactorPtr,
104  te::da::DataSet* dataSetPtr,
105  te::rst::Raster* rasterPtr );
106 
107  /*!
108  \brief Reset the internal state (all pointed objects are deleted).
109  \param transactorPtr A pointer to a transactor instance related to the data source pointed by dataSourcePtr.
110  \param dataSetPtr A pointer to a data set instance related to the instance pointed by persistencePtr.
111  \param rasterPtr A pointer to a raster instance related to the instance pointed by rasterPtr.
112  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
113  */
114  void reset(
115  te::da::DataSourceTransactor* transactorPtr,
116  te::da::DataSet* dataSetPtr,
117  te::rst::Raster* rasterPtr );
118 
119  /*!
120  \brief Reset the internal state (all pointed objects are deleted).
121  \param rasterPtr A pointer to a raster instance.
122  \note All given pionters will be acquired and their respective objects will be deleted at desctruction time.
123  */
124  void reset( te::rst::Raster* rasterPtr );
125 
126  /*!
127  \brief Returns a pointer the the handled raster instance or NULL if no instance is handled.
128  \return Returns a pointer the the handled raster instance or NULL if no instance is handled.
129  */
130  te::rst::Raster* getRasterPtr();
131 
132  /*!
133  \brief Relase the internal state and give the ownership to the given pointers.
134  \param dataSourcePtr Data source pointer.
135  \param transactorPtr A pointer to a transactor instance related to the data source pointed by dataSourcePtr.
136  \param dataSetPtr A pointer to a data set instance related to the instance pointed by persistencePtr.
137  \param rasterPtr A pointer to a raster instance related to the instance pointed by rasterPtr.
138  */
139  void release(
140  std::auto_ptr< te::da::DataSource >& dataSourcePtr,
141  std::auto_ptr< te::da::DataSourceTransactor >& transactorPtr,
142  std::auto_ptr< te::da::DataSet >& dataSetPtr,
143  std::auto_ptr< te::rst::Raster >& rasterPtr );
144 
145  /*!
146  \brief Relase the internal state and give the ownership to the given external handler instance.
147  \param other The external handler instance.
148  */
149  void release( RasterHandler& other );
150 
151  protected :
152 
153  mutable std::auto_ptr< te::da::DataSource > m_dataSourcePtr; //!< A pointer to a datasource instance.
154 
155  mutable std::auto_ptr< te::da::DataSourceTransactor > m_transactorPtr; //!< A pointer to a transactor instance that may or may not be related to data source instance pointed by m_dataSourcePtr.
156 
157  mutable std::auto_ptr< te::da::DataSet > m_dataSetPtr; //!< A pointer to a data set instance related to the transactor instance pointed by m_transactorPtr.
158 
159  mutable std::auto_ptr< te::rst::Raster > m_rasterPtr; //!< A pointer to a raster instance related to the data set instance pointed by m_dataSetPtr.
160  };
161  } // end namespace rp
162 } // end namespace te
163 
164 #endif // __TERRALIB_RP_INTERNAL_RASTERHANDLER_H
165 
std::auto_ptr< te::da::DataSourceTransactor > m_transactorPtr
A pointer to a transactor instance that may or may not be related to data source instance pointed by ...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
std::auto_ptr< te::da::DataSet > m_dataSetPtr
A pointer to a data set instance related to the transactor instance pointed by m_transactorPtr.
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
std::auto_ptr< te::da::DataSource > m_dataSourcePtr
A pointer to a datasource instance.
RasterHandler.
Definition: RasterHandler.h:47
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
std::auto_ptr< te::rst::Raster > m_rasterPtr
A pointer to a raster instance related to the data set instance pointed by m_dataSetPtr.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
Configuration flags for the Raster Processing module of TerraLib.