Object.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 Object.h
22 
23  \brief This file contains a class to represent an object.
24  */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_OBJECT_H
27 #define __TERRALIB_ST_INTERNAL_OBJECT_H
28 
29 //STL
30 #include <vector>
31 
32 //ST
33 #include "../../Config.h"
34 
35 // Forward declarations
36 namespace te { namespace dt { class AbstractData; class DateTime; } }
37 namespace te { namespace gm { class Geometry; } }
38 
39 namespace te
40 {
41  namespace st
42  {
43  // Forward declarations
44  class TimeSeries;
45  class Trajectory;
46 
47  /*!
48  \class Object
49 
50  \brief A class to represent an object.
51 
52  An object is an identifiable entity whose spatial and non-spatial properties
53  can change. The spatial property variation is represented by a trajectory
54  and the non-spatial property variation by a time series.
55  This first version will consider only a non-spatial property.
56 
57  \sa TimeSeries Trajectory
58  */
60  {
61  public:
62 
63  /*! \name Object Constructors */
64  //@{
65 
66  /*!
67  \brief Constructor.
68 
69  \param id The identification of the object.
70  \param ts The time series that represents the variation of a non-spatial property.
71  \param tj The trajectory that represents the variation of the spatial property.
72 
73  \note It will take the ownership of the input pointers.
74  */
75  Object(const std::string& id, TimeSeries* ts, Trajectory* tj);
76 
77  /*!
78  \brief Constructor.
79 
80  \param id The identification of the object.
81  \param ts The time series that represents the variation of a non-spatial property.
82 
83  \note It will take the ownership of the input pointers.
84  */
85  Object(const std::string& id, TimeSeries* ts);
86 
87  /*!
88  \brief Constructor.
89 
90  \param id The identification of the object.
91  \param tj The trajectory that represents the variation of the spatial property.
92 
93  \note It will take the ownership of the input pointers.
94  */
95  Object(const std::string& id, Trajectory* tj);
96 
97  /*!
98  \brief Copy constructor.
99  */
100  Object(const Object& obj);
101  //@}
102 
103  /*!
104  \brief Copy assignment operator
105  */
106  Object& operator=(const Object& other);
107 
108  /*!
109  \brief It returns a clone of this object.
110 
111  \return A new object.
112 
113  \note The caller will take the ownership of the returned pointer.
114  */
115  Object* clone() const;
116 
117  /*!
118  \brief It returns the object identification.
119 
120  \return The object identification.
121  */
122  std::string getId() const;
123 
124  /*!
125  \brief It sets the object identification.
126 
127  \param id The object identification.
128  */
129  void setId(const std::string& id);
130 
131  /*!
132  \brief It returns the time series associated to the object.
133 
134  \return A pointer to the time series associated to the object.
135 
136  \note The caller will NOT take the ownership of the returned pointer.
137  */
138  TimeSeries* getTimeSeries() const;
139 
140  /*!
141  \brief It sets the time series associated to the object.
142 
143  \param ts The time series to be set.
144 
145  \note It will take the ownership of the input pointer.
146  */
147  void setTimeSeries(TimeSeries* ts);
148 
149  /*!
150  \brief It returns the trajectory associated to the object.
151 
152  \return A pointer to the trajectory associated to the object.
153 
154  \note The caller will NOT take the ownership of the returned pointer.
155  */
156  Trajectory* getTrajectory() const;
157 
158  /*!
159  \brief It sets the trajectory associated to the object.
160 
161  \param ts The trajectory associated to the object.
162 
163  \note It will take the ownership of the input pointer.
164  */
165  void setTrajectory(Trajectory* tj);
166 
167  /*!
168  \brief It returns the state of the object at a given date and time.
169 
170  \param t The given date and time.
171 
172  \return A pair of the value and geometry of the object at the given time.
173 
174  \note The caller will take the ownership of the returned pointers.
175  */
176  std::pair<te::dt::AbstractData*,te::gm::Geometry*> getState(te::dt::DateTime* t) const;
177 
178  /*! \brief Virtual destructor. */
179  virtual ~Object();
180 
181  private:
182 
183  std::string m_id; //!< The time series identification.
184  std::auto_ptr<Trajectory> m_trajectory; //!< The variation of the spatial property of the object
185  std::auto_ptr<TimeSeries> m_timeseries; //!< The variation of a property of the object
186  };
187 
188  } // end namespace st
189 } // end namespace te
190 
191 #endif // __TERRALIB_ST_INTERNAL_OBJECT_H
192 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
std::string m_id
The time series identification.
Definition: Object.h:183
std::auto_ptr< TimeSeries > m_timeseries
The variation of a property of the object.
Definition: Object.h:185
A class to represent an object.
Definition: Object.h:59
URI C++ Library.
std::auto_ptr< Trajectory > m_trajectory
The variation of the spatial property of the object.
Definition: Object.h:184
A class to represent time series.
Definition: TimeSeries.h:66
A class to represent trajectory.
Definition: Trajectory.h:75