Observation.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 Observations.h
22 
23  \brief This file contains a class to represent an observation.
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_OBSERVATION_H
27 #define __TERRALIB_ST_INTERNAL_OBSERVATION_H
28 
29 //ST
30 #include "../../Config.h"
31 
32 //Boost
33 #include <boost/ptr_container/ptr_vector.hpp>
34 
35 // Forward declarations
36 namespace te { namespace dt { class AbstractData; class DateTime; class DateTimePeriod;
37  class DateTimeInstant; } }
38 
39 namespace te { namespace gm { class Geometry; } }
40 
41 namespace te
42 {
43  namespace st
44  {
45  /*!
46  \class Observation
47 
48  \brief A class to represent an observation.
49 
50  An observation is a result of a measurement associated to a discrete
51  time instant or period which assigns values to a phenomenon. It follows
52  the OGC's Observation and Measurement (O&M) specification.
53  An observation is composed of: (1) a phenomenon time, (2) a valid time,
54  (3) a result time, (4) observed values.
55 
56  \ingroup st
57 
58  \sa ObservationDataSet AbstractData DateTime
59  */
61  {
62  public:
63 
64  /*! \brief It constructs an empty Observation
65  */
66  Observation();
67 
68  /*!
69  \brief Constructor.
70 
71  \param phTime A pointer to phenomenon time.
72 
73  \note It will take the ownership of the DateTime input pointer.
74  */
76 
77  /*!
78  \brief Constructor.
79 
80  \param phTime A pointer to phenomenon time.
81  \param obsValue A observed value.
82 
83  \note It will take the ownership of the DateTime and AbstractData input pointers.
84  */
86 
87  /*!
88  \brief Constructor.
89 
90  \param phTime A pointer to phenomenon time.
91  \param geom The observation location.
92  \param obsValues The observed values.
93 
94  \note It will take the ownership of the input pointers.
95  */
97  const boost::ptr_vector<te::dt::AbstractData>& obsValues);
98 
99  /*!
100  \brief Constructor.
101 
102  \param phTime A pointer to phenomenon time.
103  \param resTime A pointer to the result time.
104  \param valTime A pointer to the valid time.
105  \param geom The observation location.
106  \param obsValues The observed values.
107 
108  \note It will take the ownership of the input pointers.
109  */
112  const boost::ptr_vector<te::dt::AbstractData>& obsValues);
113 
114  /*! \brief Copy constructor. */
115  Observation(const Observation& obs);
116 
117  /*!
118  \brief Assignment operator.
119  */
120  const Observation& operator=(const Observation& rhs);
121 
122  /*!
123  \brief It returns the phenomenon time.
124 
125  \return A pointer to the phenomenon time.
126 
127  \note The caller will NOT take the ownership of the returned pointer.
128  */
129  te::dt::DateTime* getTime() const;
130 
131  /*!
132  \brief It sets the phenomenon time.
133 
134  \param A pointer to the the phenomenon time.
135 
136  \note It will take the ownership of the input pointer.
137  */
138  void setTime(te::dt::DateTime* phTime);
139 
140  /*!
141  \brief It returns the result time.
142 
143  \return A pointer to the result time.
144 
145  \note The caller will NOT take the ownership of the returned pointer.
146  */
147  te::dt::DateTimeInstant* getResultTime() const;
148 
149  /*!
150  \brief It sets the result time.
151 
152  \param A pointer to the result time.
153 
154  \note It will take the ownership of the input pointer.
155  */
156  void setResultTime(te::dt::DateTimeInstant* resTime);
157 
158  /*!
159  \brief It returns the valid time.
160 
161  \return A pointer to the valid time.
162 
163  \note The caller will NOT take the ownership of the returned pointer.
164  */
165  te::dt::DateTimePeriod* getValidTime() const;
166 
167  /*!
168  \brief It sets the valid time.
169 
170  \param A pointer to the valid time.
171 
172  \note It will take the ownership of the input pointer.
173  */
174  void setValidTime(te::dt::DateTimePeriod* valTime);
175 
176  /*!
177  \brief It returns the observed values.
178 
179  \return A reference to the observed values.
180 
181  \note The caller will NOT take the ownership of the returned pointer.
182  */
183  boost::ptr_vector<te::dt::AbstractData>& getObservedValues();
184 
185  /*!
186  \brief It returns the idx-th observed value.
187 
188  \return A pointer to the idx-th observed value.
189 
190  \note The caller will NOT take the ownership of the returned pointer.
191  */
192  const te::dt::AbstractData* getObservedValue(int idx = 0) const;
193 
194  /*!
195  \brief It adds an observed value.
196 
197  \param A pointer to the observed value to be added.
198 
199  \note It will take the ownership of the input pointer.
200  */
201  void addValue(te::dt::AbstractData* value);
202 
203  /*!
204  \brief It sets the observed values.
205 
206  \param A reference to the observed values.
207 
208  \note It will take the ownership of the input pointer.
209  */
210  void setValues(const boost::ptr_vector<te::dt::AbstractData>& values);
211 
212  /*!
213  \brief It returns the observation location or region.
214 
215  \return A pointer to the geometry.
216 
217  \note The caller will NOT take the ownership of the returned pointer.
218  */
219  te::gm::Geometry* getGeometry() const;
220 
221  /*!
222  \brief It sets the observation location or region.
223 
224  \param geom A pointer to the observation location or region.
225 
226  \note It will take the ownership of the input pointer.
227  */
228  void setGeometry(te::gm::Geometry* geom);
229 
230  /*!
231  \brief It returns a clone of this object.
232 
233  \return A clone of this object.
234 
235  \note The caller will take the ownership of the input pointer.
236  */
237  Observation* clone() const;
238 
239  /*! \brief Virtual destructor. */
240  virtual ~Observation();
241 
242  private:
243 
244  std::auto_ptr<te::dt::DateTime> m_phTime; //!< The phenomenon time
245  std::auto_ptr<te::dt::DateTimeInstant> m_resultTime; //!< The result time
246  std::auto_ptr<te::dt::DateTimePeriod> m_validTime; //!< The valid time
247  boost::ptr_vector<te::dt::AbstractData> m_observedValues; //!< The observed values
248  std::auto_ptr<te::gm::Geometry> m_geometry; //!< The observation location
249  };
250 
251  } // end namespace st
252 } // end namespace te
253 
254 #endif // __TERRALIB_ST_INTERNAL_OBSERVATION_H
255 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
A class to represent an observation.
Definition: Observation.h:60
std::auto_ptr< te::dt::DateTimePeriod > m_validTime
The valid time.
Definition: Observation.h:246
URI C++ Library.
std::auto_ptr< te::gm::Geometry > m_geometry
The observation location.
Definition: Observation.h:248
boost::ptr_vector< te::dt::AbstractData > m_observedValues
The observed values.
Definition: Observation.h:247
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
std::auto_ptr< te::dt::DateTime > m_phTime
The phenomenon time.
Definition: Observation.h:244
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
An abstract class to represent a period of date and time.
std::auto_ptr< te::dt::DateTimeInstant > m_resultTime
The result time.
Definition: Observation.h:245
An abstract class to represent an instant of date and time.