EventsCollection.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 
33 
34 /**
35  @file EventsCollection.hpp
36 
37  @author Jean-Christophe FABRE <jean-christophe.fabre@supagro.inra.fr>
38 */
39 
40 
41 #ifndef __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__
42 #define __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__
43 
44 #include <openfluid/core/Event.hpp>
45 #include <openfluid/dllexport.hpp>
46 
47 #include <list>
48 
49 
50 namespace openfluid { namespace core {
51 
52 class Event;
53 
54 typedef std::list<Event> EventsList_t;
55 
56 /**
57  @brief Class defining a collection of discrete events
58 */
60 {
61  private:
62 
63  EventsList_t m_Events;
64 
65  public:
66 
67  /**
68  Default constructor
69  */
71 
72  virtual ~EventsCollection();
73 
74 
75  /**
76  Inserts an event in the event collection, ordered by date
77  @deprecated Since version 1.7.1. Use openfluid::core::EventsCollection::addEvent(const Event&) instead
78  */
79  bool addEvent(const Event* Ev) OPENFLUID_DEPRECATED;
80 
81  /**
82  Inserts an event in the event collection, ordered by date
83  */
84  bool addEvent(const Event& Ev);
85 
86  /**
87  Returns an event collection extracted from the current event collection, taking into account a time period
88  If some events are already in the given collection, they are not deleted. Events matching the period are appended
89  at the end of the given collection
90  @deprecated Since version 1.7.1.
91  Use openfluid::core::EventsCollection::getEventsBetween(const DateTime&,const DateTime&,EventsCollection&) const
92  instead
93  */
94  bool getEventsBetween(const DateTime& BeginDate, const DateTime& EndDate,
96 
97  /**
98  Returns an event collection extracted from the current event collection, taking into account a time period
99  If some events are already in the given collection, they are not deleted. Events matching the period are appended
100  at the end of the given collection
101  */
102  bool getEventsBetween(const DateTime& BeginDate, const DateTime& EndDate, EventsCollection& Events) const;
103 
104  /**
105  Returns the event collection as a list
106  */
107  inline EventsList_t* eventsList()
108  { return &m_Events; };
109 
110  /**
111  @deprecated Since version 2.1.0. Use openfluid::core::EventsCollection::eventsList() instead
112  */
113  inline EventsList_t* getEventsList() OPENFLUID_DEPRECATED
114  { return &m_Events; };
115 
116  /**
117  Returns number of events in the event collection
118  */
119  inline int getCount() const
120  { return m_Events.size(); };
121 
122  /**
123  Clears the event collection
124  */
125  void clear()
126  { m_Events.clear(); };
127 
128  void println() const;
129 };
130 
131 
132 } } // namespace openfluid::core
133 
134 
135 
136 #endif /* __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__*/
void clear()
Definition: EventsCollection.hpp:125
EventsList_t * getEventsList() OPENFLUID_DEPRECATED
Definition: EventsCollection.hpp:113
int getCount() const
Definition: EventsCollection.hpp:119
#define OPENFLUID_API
Definition: dllexport.hpp:87
Class defining a collection of discrete events.
Definition: EventsCollection.hpp:59
EventsList_t * eventsList()
Definition: EventsCollection.hpp:107
std::list< Event > EventsList_t
Definition: EventsCollection.hpp:52
Definition: ApplicationException.hpp:47
Class for management of date and time information.
Definition: DateTime.hpp:132
Definition: Event.hpp:59
SpatialUnit Unit OPENFLUID_DEPRECATED
Definition: SpatialUnit.hpp:304