All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EventsColl.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
36 
37  @author Jean-Christophe FABRE <fabrejc@supagro.inra.fr>
38 */
39 
40 
41 #ifndef __EVENTSCOLL_H__
42 #define __EVENTSCOLL_H__
43 
44 #include <openfluid/core/Event.hpp>
45 #include <openfluid/dllexport.hpp>
46 
47 #include <list>
48 
49 
50 namespace openfluid { namespace core {
51 
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
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
91  */
92  bool getEventsBetween(const DateTime BeginDate, const DateTime EndDate, EventsCollection *Events) const OPENFLUID_DEPRECATED;
93 
94  /**
95  Returns an event collection extracted from the current event collection, taking into account a time period
96  If some events are already in the given collection, they are not deleted. Events matching the period are appended
97  at the end of the given collection
98  */
99  bool getEventsBetween(const DateTime BeginDate, const DateTime EndDate, EventsCollection& Events) const;
100 
101  /**
102  Returns the event collection as a list
103  */
104  inline EventsList_t* getEventsList() { return &m_Events; };
105 
106  /**
107  Returns number of events in the event collection
108  */
109  inline int getCount() const { return m_Events.size(); };
110 
111  /**
112  Clears the event collection
113  */
114  void clear() { m_Events.clear(); };
115 
116  void println() const;
117 };
118 
119 
120 } } // namespace openfluid::core
121 
122 
123 
124 #endif /* __EVENTSCOLL_H__*/
int getCount() const
Definition: EventsColl.hpp:109
EventsList_t * getEventsList()
Definition: EventsColl.hpp:104
Class for management of date and time information.
Definition: DateTime.hpp:131
std::list< Event > EventsList_t
Definition: EventsColl.hpp:54
Class defining a collection of discrete events.
Definition: EventsColl.hpp:59
Class defining a discrete event, including attached information.
Definition: Event.hpp:61
#define OPENFLUID_DEPRECATED
Definition: deprecation.hpp:55
void clear()
Definition: EventsColl.hpp:114
#define DLLEXPORT
Definition: dllexport.hpp:51