All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RasterSummaryManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/raster/RasterSummaryManager.h
22 
23  \brief A singleton for keeping raster summaries (most statistics).
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
27 #define __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
28 
29 // TerraLib
30 #include "../common/Singleton.h"
31 #include "Config.h"
32 #include "Enums.h"
33 #include "RasterSummary.h"
34 
35 // Boost
36 #include <boost/ptr_container/ptr_map.hpp>
37 
38 namespace te
39 {
40  namespace rst
41  {
42 // Forward declaration
43  class Raster;
44 
45  /*!
46  \class RasterSummaryManager
47 
48  \brief A singleton for keeping raster summaries (most statistics).
49  It stores an internal map of raster references and their
50  respective summaries.
51 
52  \ingroup rst
53 
54  \sa RasterSummary, BandSummary.
55  */
56  class TERASTEREXPORT RasterSummaryManager : public te::common::Singleton<RasterSummaryManager>
57  {
59 
60  public:
61 
62  /*!
63  \brief Adds a new entry in the summary manager.
64 
65  \param raster The raster to be added.
66  \param summary The raster summary of the respective raster.
67  The manager will take its ownership.
68 
69  \note If the raster was already added, the summary will be replaced.
70  */
71  void add(const Raster* raster, RasterSummary* summary);
72 
73  /*!
74  \brief It searches for a raster summary.
75 
76  \param raster The raster to be found.
77 
78  \return The calculated raster summary, or a null summary otherwise.
79  */
80  const RasterSummary* find(const Raster* raster) const;
81 
82  /*!
83  \brief Removes the summary from the specified raster.
84 
85  \param raster The raster to remove the summary.
86  */
87  void remove(const Raster* raster);
88 
89  /*!
90  \brief It searches for a raster summary. If not found it creates the summary and returns it.
91 
92  \param raster The raster to be found.
93  \param types The desired types of summary to be calculated (min, max, ...).
94 
95  \return The calculated raster summary.
96  */
97  const RasterSummary* get(const Raster* raster, const SummaryTypes st);
98 
99  /*! \brief Destructor. */
101 
102  protected:
103 
104  /*! \brief Constructor. */
106 
107  private:
108 
109  boost::ptr_map<const Raster*, RasterSummary> m_rasterSummaries; //!< A map of rasters and their respective summaries.
110  };
111 
112  } // end namespace rst
113 } // end namespace te
114 
115 #endif // __TERRALIB_RASTER_INTERNAL_RASTERSUMMARYMANAGER_H
116 
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:65
Enumerations for the Raster module.
An abstract class for raster data strucutures.
Definition: Raster.h:71
boost::ptr_map< const Raster *, RasterSummary > m_rasterSummaries
A map of rasters and their respective summaries.
SummaryTypes
Types for the BandSummary.
Definition: Enums.h:38
RasterSummary is just a typedef of a boost::ptr_vector.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
Definition: RasterSummary.h:44
A singleton for keeping raster summaries (most statistics). It stores an internal map of raster refer...
Configuration flags for the Raster module of TerraLib.
Template support for singleton pattern.
Definition: Singleton.h:100