Documentation for OpenFLUID 2.2.0
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  @file EventsCollection.hpp
35 
36  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37 */
38 
39 
40 #ifndef __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__
41 #define __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__
42 
43 
44 #include <list>
45 
46 #include <openfluid/core/Event.hpp>
47 #include <openfluid/dllexport.hpp>
48 
49 
50 namespace openfluid { namespace core {
51 
52 
53 class Event;
54 
55 typedef std::list<Event> EventsList_t;
56 
57 
58 /**
59  Class defining a collection of discrete events
60 
61  @cond OpenFLUID:completion
62  {
63  "contexts" : ["ANYWARE"],
64  "menupath" : ["Types", "Events"],
65  "title" : "Events collection",
66  "text" : "openfluid::core::EventsCollection %%SEL_START%%EvColl%%SEL_END%%"
67  }
68  @endcond
69 */
71 {
72  private:
73 
74  EventsList_t m_Events;
75 
76 
77  public:
78 
79  /**
80  Inserts an event in the event collection, ordered by date
81  @deprecated Since version 1.7.1. Use openfluid::core::EventsCollection::addEvent(const Event&) instead
82  */
83  [[deprecated]] bool addEvent(const Event* Ev);
84 
85  /**
86  Inserts an event in the event collection, ordered by date
87  */
88  bool addEvent(const Event& Ev);
89 
90  /**
91  Returns an event collection extracted from the current event collection, taking into account a time period
92  If some events are already in the given collection, they are not deleted. Events matching the period are appended
93  at the end of the given collection
94  @deprecated Since version 1.7.1.
95  Use openfluid::core::EventsCollection::getEventsBetween(const DateTime&,const DateTime&,EventsCollection&) const
96  instead
97  */
98  [[deprecated]] bool getEventsBetween(const DateTime& BeginDate, const DateTime& EndDate,
99  EventsCollection* Events) const ;
100 
101  /**
102  Returns an event collection extracted from the current event collection, taking into account a time period
103  If some events are already in the given collection, they are not deleted. Events matching the period are appended
104  at the end of the given collection
105  */
106  bool getEventsBetween(const DateTime& BeginDate, const DateTime& EndDate, EventsCollection& Events) const;
107 
108  /**
109  Returns the event collection as a list
110  */
112  {
113  return &m_Events;
114  };
115 
116  /**
117  @deprecated Since version 2.1.0. Use openfluid::core::EventsCollection::eventsList() instead
118  */
119  [[deprecated]] inline EventsList_t* getEventsList()
120  {
121  return &m_Events;
122  };
123 
124  /**
125  Returns number of events in the event collection
126  */
127  inline int getCount() const
128  {
129  return m_Events.size();
130  };
131 
132  /**
133  Clears the event collection
134  */
135  void clear()
136  {
137  m_Events.clear();
138  };
139 
140  void println() const;
141 };
142 
143 
144 } } // namespace openfluid::core
145 
146 
147 #endif /* __OPENFLUID_CORE_EVENTSCOLLECTION_HPP__ */
Class for management of date and time information.
Definition: DateTime.hpp:88
Definition: Event.hpp:69
Definition: EventsCollection.hpp:71
void clear()
Definition: EventsCollection.hpp:135
int getCount() const
Definition: EventsCollection.hpp:127
bool addEvent(const Event &Ev)
EventsList_t * eventsList()
Definition: EventsCollection.hpp:111
bool addEvent(const Event *Ev)
EventsList_t * getEventsList()
Definition: EventsCollection.hpp:119
bool getEventsBetween(const DateTime &BeginDate, const DateTime &EndDate, EventsCollection &Events) const
bool getEventsBetween(const DateTime &BeginDate, const DateTime &EndDate, EventsCollection *Events) const
#define OPENFLUID_API
Definition: dllexport.hpp:86
std::list< Event > EventsList_t
Definition: EventsCollection.hpp:53
Definition: ApplicationException.hpp:47