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  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
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  */
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::unique_ptr<te::dt::DateTime> m_phTime; //!< The phenomenon time
245  std::unique_ptr<te::dt::DateTimeInstant> m_resultTime; //!< The result time
246  std::unique_ptr<te::dt::DateTimePeriod> m_validTime; //!< The valid time
247  boost::ptr_vector<te::dt::AbstractData> m_observedValues; //!< The observed values
248  std::unique_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 
te::st::Observation::setValues
void setValues(const boost::ptr_vector< te::dt::AbstractData > &values)
It sets the observed values.
te::st::Observation::addValue
void addValue(te::dt::AbstractData *value)
It adds an observed value.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::st::Observation
A class to represent an observation.
Definition: Observation.h:61
te::st::Observation::Observation
Observation()
It constructs an empty Observation.
te::dt::DateTime
Definition: DateTime.h:56
te::dt::DateTimePeriod
An abstract class to represent a period of date and time.
Definition: DateTimePeriod.h:49
te::st::Observation::getResultTime
te::dt::DateTimeInstant * getResultTime() const
It returns the result time.
te::st::Observation::getValidTime
te::dt::DateTimePeriod * getValidTime() const
It returns the valid time.
te::st::Observation::m_phTime
std::unique_ptr< te::dt::DateTime > m_phTime
The phenomenon time.
Definition: Observation.h:244
te::st::Observation::getObservedValues
boost::ptr_vector< te::dt::AbstractData > & getObservedValues()
It returns the observed values.
te::st::Observation::operator=
const Observation & operator=(const Observation &rhs)
Assignment operator.
te::st::Observation::m_resultTime
std::unique_ptr< te::dt::DateTimeInstant > m_resultTime
The result time.
Definition: Observation.h:245
te::st::Observation::setValidTime
void setValidTime(te::dt::DateTimePeriod *valTime)
It sets the valid time.
te::st::Observation::Observation
Observation(te::dt::DateTime *phTime, te::dt::DateTimeInstant *resTime, te::dt::DateTimePeriod *valTime, te::gm::Geometry *geom, const boost::ptr_vector< te::dt::AbstractData > &obsValues)
Constructor.
te::st::Observation::clone
Observation * clone() const
It returns a clone of this object.
te::st::Observation::~Observation
virtual ~Observation()
Virtual destructor.
te::st::Observation::getObservedValue
const te::dt::AbstractData * getObservedValue(int idx=0) const
It returns the idx-th observed value.
TESTEXPORT
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
te::st::Observation::setTime
void setTime(te::dt::DateTime *phTime)
It sets the phenomenon time.
te::st::Observation::m_observedValues
boost::ptr_vector< te::dt::AbstractData > m_observedValues
The observed values.
Definition: Observation.h:247
te::dt::AbstractData
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
te::st::Observation::setGeometry
void setGeometry(te::gm::Geometry *geom)
It sets the observation location or region.
te::st::Observation::m_geometry
std::unique_ptr< te::gm::Geometry > m_geometry
The observation location.
Definition: Observation.h:248
te::st::Observation::getGeometry
te::gm::Geometry * getGeometry() const
It returns the observation location or region.
te::st::Observation::Observation
Observation(te::dt::DateTime *phTime, te::gm::Geometry *geom, const boost::ptr_vector< te::dt::AbstractData > &obsValues)
Constructor.
te::st::Observation::setResultTime
void setResultTime(te::dt::DateTimeInstant *resTime)
It sets the result time.
te::st::Observation::Observation
Observation(te::dt::DateTime *phTime, te::dt::AbstractData *obsValue)
Constructor.
te::dt::DateTimeInstant
An abstract class to represent an instant of date and time.
Definition: DateTimeInstant.h:44
te::st::Observation::Observation
Observation(te::dt::DateTime *phTime)
Constructor.
te::st::Observation::getTime
te::dt::DateTime * getTime() const
It returns the phenomenon time.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::st::Observation::m_validTime
std::unique_ptr< te::dt::DateTimePeriod > m_validTime
The valid time.
Definition: Observation.h:246
te::st::Observation::Observation
Observation(const Observation &obs)
Copy constructor.