Algorithm.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/Algorithm.h
22  \brief Raster Processing algorithm base interface class.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_ALGORITHM_H
26 #define __TERRALIB_RP_INTERNAL_ALGORITHM_H
27 
30 #include "Config.h"
31 #include "Exception.h"
32 
33 namespace te
34 {
35  namespace rp
36  {
37  /*!
38  \class Algorithm
39  \brief Raster Processing algorithm base interface.
40  */
42  {
43  public:
44 
45  virtual ~Algorithm();
46 
47  /*!
48  \brief Initialize the algorithm instance making it ready for execution.
49 
50  \param inputParams Input parameters.
51 
52  \return true if OK, false on errors.
53 
54  \note A return error string can be obtained via Algorithm::getErrorMessage()
55  */
56  virtual bool initialize( const AlgorithmInputParameters& inputParams ) _NOEXCEPT_OP(false) = 0;
57 
58  /*!
59  \brief Returns true if the algorithm instance is initialized and ready for execution.
60 
61  \return true if the algorithm instance is initialized and ready for execution.
62  */
63  virtual bool isInitialized() const = 0;
64 
65  /*!
66  \brief Executes the algorithm using the supplied parameters.
67 
68  \param outputParams Output parameters.
69 
70  \return true if OK, false on errors.
71 
72  \note A return error string can be obtained via Algorithm::getErrorMessage()
73  */
74  virtual bool execute( AlgorithmOutputParameters& outputParams ) _NOEXCEPT_OP(false) = 0;
75 
76  /*!
77  \brief Clear all internal allocated objects and reset the algorithm to its initial state.
78  */
79  virtual void reset() _NOEXCEPT_OP(false);
80 
81  /*!
82  \brief Return the current error message if there is any.
83 
84  \return Return the current error message if there is any.
85  */
86  const std::string& getErrorMessage() const;
87 
88  protected:
89 
90  Algorithm();
91 
92  /*!
93  \brief Set the current error message.
94 
95  \param newErrorMessage New error message;
96  */
97  void setErrorMessage( const std::string& newErrorMessage );
98 
99  private:
100 
101  /*!
102  \brief Current error message.
103  */
104  std::string m_errorMessage;
105 
106  Algorithm( const Algorithm& );
107 
108  Algorithm& operator=( const Algorithm& );
109  };
110 
111  } // end namespace rp
112 } // end namespace te
113 
114 #endif // __TERRALIB_RP_INTERNAL_ALGORITHM_H
115 
Raster Processing algorithm input parameters base interface.
Raster Processing algorithm output parameters base interface.
#define _NOEXCEPT_OP(x)
Exception class.
Raster Processing algorithm output parameters base interface.
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Configuration flags for the Raster Processing module of TerraLib.
std::string m_errorMessage
Current error message.
Definition: Algorithm.h:104
Raster Processing algorithm input parameters base interface.