All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Observation.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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
40 {
41  namespace st
42  {
43  /*!
44  \class Observation
45 
46  \brief A class to represent an observation.
47 
48  An observation is a result of a measurement associated to a discrete
49  time instant or period which assigns values to a phenomenon. It follows
50  the OGC's Observation and Measurement (O&M) specification.
51  An observation is composed of: (1) a phenomenon time, (2) a valid time,
52  (3) a result time, (4) observed values.
53 
54  \ingroup st
55 
56  \sa ObservationDataSet AbstractData DateTime
57  */
59  {
60  public:
61 
62  /*! \brief It constructs an empty Observation
63  */
64  Observation();
65 
66  /*!
67  \brief Constructor.
68 
69  \param phTime A pointer to phenomenon time.
70 
71  \note It will take the ownership of the DateTime input pointer.
72  */
74 
75  /*!
76  \brief Constructor.
77 
78  \param phTime A pointer to phenomenon time.
79  \param obsValue A observed value.
80 
81  \note It will take the ownership of the DateTime and AbstractData input pointers.
82  */
84 
85  /*!
86  \brief Constructor.
87 
88  \param phTime A pointer to phenomenon time.
89  \param obsValues The observed values.
90 
91  \note It will take the ownership of the input pointers.
92  */
93  Observation(te::dt::DateTime* phTime, const boost::ptr_vector<te::dt::AbstractData>& obsValues);
94 
95  /*!
96  \brief Constructor.
97 
98  \param phTime A pointer to phenomenon time.
99  \param resTime A pointer to the result time.
100  \param valTime A pointer to the valid time.
101  \param obsValues The observed values.
102 
103  \note It will take the ownership of the input pointers.
104  */
106  te::dt::DateTimePeriod* valTime,
107  const boost::ptr_vector<te::dt::AbstractData>& obsValues);
108 
109  /*! \brief Copy constructor. */
110  Observation(const Observation& obs);
111 
112  /*!
113  \brief Assignment operator.
114  */
115  const Observation& operator=(const Observation& rhs);
116 
117  /*!
118  \brief It returns the phenomenon time.
119 
120  \return A pointer to the phenomenon time.
121 
122  \note The caller will NOT take the ownership of the returned pointer.
123  */
124  te::dt::DateTime* getTime() const;
125 
126  /*!
127  \brief It sets the phenomenon time.
128 
129  \param A pointer to the the phenomenon time.
130 
131  \note It will take the ownership of the input pointer.
132  */
133  void setTime(te::dt::DateTime* phTime);
134 
135  /*!
136  \brief It returns the result time.
137 
138  \return A pointer to the result time.
139 
140  \note The caller will NOT take the ownership of the returned pointer.
141  */
142  te::dt::DateTimeInstant* getResultTime() const;
143 
144  /*!
145  \brief It sets the result time.
146 
147  \param A pointer to the result time.
148 
149  \note It will take the ownership of the input pointer.
150  */
151  void setResultTime(te::dt::DateTimeInstant* resTime);
152 
153  /*!
154  \brief It returns the valid time.
155 
156  \return A pointer to the valid time.
157 
158  \note The caller will NOT take the ownership of the returned pointer.
159  */
160  te::dt::DateTimePeriod* getValidTime() const;
161 
162  /*!
163  \brief It sets the valid time.
164 
165  \param A pointer to the valid time.
166 
167  \note It will take the ownership of the input pointer.
168  */
169  void setValidTime(te::dt::DateTimePeriod* valTime);
170 
171  /*!
172  \brief It returns the observed values.
173 
174  \return A reference to the observed values.
175 
176  \note The caller will NOT take the ownership of the returned pointer.
177  */
178  boost::ptr_vector<te::dt::AbstractData>& getObservedValues();
179 
180  /*!
181  \brief It returns the idx-th observed value.
182 
183  \return A pointer to the idx-th observed value.
184 
185  \note The caller will NOT take the ownership of the returned pointer.
186  */
187  const te::dt::AbstractData* getObservedValue(int idx = 0) const;
188 
189  /*!
190  \brief It adds an observed value.
191 
192  \param A pointer to the observed value to be added.
193 
194  \note It will take the ownership of the input pointer.
195  */
196  void addValue(te::dt::AbstractData* value);
197 
198  /*!
199  \brief It sets the observed values.
200 
201  \param A reference to the observed values.
202 
203  \note It will take the ownership of the input pointer.
204  */
205  void setValues(const boost::ptr_vector<te::dt::AbstractData>& values);
206 
207  /*!
208  \brief It returns a clone of this object.
209 
210  \return A clone of this object.
211 
212  \note The caller will take the ownership of the input pointer.
213  */
214  Observation* clone() const;
215 
216  /*! \brief Virtual destructor. */
217  virtual ~Observation();
218 
219  private:
220 
221  std::auto_ptr<te::dt::DateTime> m_phTime; //!< The phenomenon time
222  std::auto_ptr<te::dt::DateTimeInstant> m_resultTime; //!< The result time
223  std::auto_ptr<te::dt::DateTimePeriod> m_validTime; //!< The valid time
224  boost::ptr_vector<te::dt::AbstractData> m_observedValues; //!< The observed values
225  };
226 
227  } // end namespace st
228 } // end namespace te
229 
230 #endif // __TERRALIB_ST_INTERNAL_OBSERVATION_H
231 
boost::ptr_vector< te::dt::AbstractData > m_observedValues
The observed values.
Definition: Observation.h:224
A class to represent an observation.
Definition: Observation.h:58
An abstract class to represent a period of date and time.
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:136
std::auto_ptr< te::dt::DateTimeInstant > m_resultTime
The result time.
Definition: Observation.h:222
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
An abstract class to represent an instant of date and time.
std::auto_ptr< te::dt::DateTime > m_phTime
The phenomenon time.
Definition: Observation.h:221
std::auto_ptr< te::dt::DateTimePeriod > m_validTime
The valid time.
Definition: Observation.h:223