Event.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 Event.h
22 
23  \brief This file contains a class to represent an event.
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_EVENT_H
27 #define __TERRALIB_ST_INTERNAL_EVENT_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 
40 namespace te
41 {
42  namespace st
43  {
44  // Forward declarations
45  class Object;
46 
47  /*!
48  \class Event
49 
50  \brief A class to represent an event.
51 
52  An event is an individual episode with a definite beginning and end
53  which can involve one or more objects.
54 
55  \ingroup st
56 
57  \sa Object
58  */
60  {
61  public:
62 
63  /*! \name Event Constructors */
64  //@{
65 
66  /*!
67  \brief Constructor.
68 
69  \param id The identification of the event.
70  \param t The time when the event happened.
71  \param g The location where the event happened.
72 
73  \note It will take the ownership of the input pointers.
74  */
75  Event(const std::string& id, te::dt::DateTime* t, te::gm::Geometry* g);
76 
77  /*!
78  \brief Constructor.
79 
80  \param id The identification of the event.
81  \param t The time when the event happened.
82  \param g The location where the event happened.
83  \param objs The objects involved to the event.
84 
85  \note It will take the ownership of the input pointers.
86  \note It will NOT take the ownership of the involved objects.
87  */
88  Event(const std::string& id, te::dt::DateTime* t, te::gm::Geometry* g,
89  std::vector<te::st::Object*> objs);
90 
91  /*!
92  \brief Copy constructor.
93  */
94  Event(const Event& ts);
95  //@}
96 
97  /*!
98  \brief Copy assignment operator
99  */
100  Event& operator=(const Event& other);
101 
102  /*!
103  \brief It returns a clone of this event.
104 
105  \return A new event.
106 
107  \note The caller will take the ownership of the returned pointer.
108  */
109  Event* clone() const;
110 
111  /*!
112  \brief It returns the object identification.
113 
114  \return The object identification.
115  */
116  std::string getId() const;
117 
118  /*!
119  \brief It sets the object identification.
120 
121  \param id The object identification.
122  */
123  void setId(const std::string& id);
124 
125  /*!
126  \brief It returns the time when the event happened.
127 
128  \return A pointer to the time when the event happened.
129 
130  \note The caller will NOT take the ownership of the returned pointer.
131  */
132  te::dt::DateTime* getTime() const;
133 
134  /*!
135  \brief It sets the time when the event happened.
136 
137  \param t The time when the event happened.
138 
139  \note It will take the ownership of the input pointer.
140  */
141  void setTime(te::dt::DateTime* t);
142 
143  /*!
144  \brief It returns the location where the event happened.
145 
146  \return A pointer to the location where the event happened.
147 
148  \note The caller will NOT take the ownership of the returned pointer.
149  */
150  te::gm::Geometry* getLocation() const;
151 
152  /*!
153  \brief It sets the location where the event happened.
154 
155  \param t The location where the event happened.
156 
157  \note It will take the ownership of the input pointer.
158  */
159  void setLocation(te::gm::Geometry* g);
160 
161  /*!
162  \brief It returns the objects involved to the event.
163 
164  \return A pointer to the objects involved to the event.
165 
166  \note The caller will NOT take the ownership of the output pointers.
167  */
168  void getObjects(std::vector<te::st::Object*>& output) const;
169 
170  /*!
171  \brief It sets the objects involved to the event.
172 
173  \param objs The objects involved to the event.
174 
175  \note It will NOT take the ownership of the input objects.
176  */
177  void setObjects(std::vector<te::st::Object*>& objs);
178 
179  /*! \brief Virtual destructor. */
180  virtual ~Event();
181 
182  private:
183 
184  std::string m_id; //!< The identification of the event.
185  std::auto_ptr<te::dt::DateTime> m_time; //!< The time when the event happened.
186  std::auto_ptr<te::gm::Geometry> m_location; //!< The location where the event happened.
187  std::vector<te::st::Object*> m_objects; //!< The objects involved to the event.
188  };
189 
190  } // end namespace st
191 } // end namespace te
192 
193 #endif // __TERRALIB_ST_INTERNAL_EVENT_H
194 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
std::auto_ptr< te::gm::Geometry > m_location
The location where the event happened.
Definition: Event.h:186
std::auto_ptr< te::dt::DateTime > m_time
The time when the event happened.
Definition: Event.h:185
std::string m_id
The identification of the event.
Definition: Event.h:184
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
std::vector< te::st::Object * > m_objects
The objects involved to the event.
Definition: Event.h:187
A class to represent an event.
Definition: Event.h:59