SEvMgr Logo  1.00.0
C++ Simulation-Oriented Discrete Event Management Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
SEVMGR_Service.hpp
Go to the documentation of this file.
1 #ifndef __SEVMGR_SEVMGR_SERVICE_HPP
2 #define __SEVMGR_SEVMGR_SERVICE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // StdAir
8 #include <stdair/stdair_basic_types.hpp>
9 #include <stdair/stdair_json.hpp>
10 #include <stdair/stdair_service_types.hpp>
11 #include <stdair/bom/EventTypes.hpp>
12 #include <stdair/bom/EventStruct.hpp>
13 
14 // Forward declarations
15 namespace stdair {
16  struct ProgressStatusSet;
17  struct BasLogParams;
18  struct BasDBParams;
19  struct BookingRequestStruct;
20 }
21 
22 namespace SEVMGR {
23 
25  class SEVMGR_ServiceContext;
26  class EventQueue;
27  //struct EventStruct;
28 
33  public:
34  // ////////////////// Constructors and Destructors //////////////////
50  SEVMGR_Service (const stdair::BasLogParams&, const stdair::BasDBParams&);
51 
63  SEVMGR_Service (const stdair::BasLogParams&);
64 
80  SEVMGR_Service (stdair::STDAIR_ServicePtr_T);
81 
86 
87 
88  public:
89  // ////////////////// Business support methods //////////////////
93  void buildSampleQueue();
94 
125  stdair::BookingRequestStruct buildSampleBookingRequest(const bool isForCRS = false);
126 
143  stdair::ProgressStatusSet popEvent (stdair::EventStruct&) const;
144 
145 
153  void run (stdair::EventStruct&) const;
154 
169  bool select (stdair::EventStruct&,
170  const stdair::DateTime_T&) const;
171 
180  template<class EventGenerator>
181  void addEventGenerator(EventGenerator& iEventGenerator) const;
182 
186  void addEvent(stdair::EventStruct&) const;
187 
192  void reset() const;
193 
203  void updateStatus (const stdair::EventType::EN_EventType&,
204  const stdair::Count_T&) const;
205 
215  void addStatus (const stdair::EventType::EN_EventType&,
216  const stdair::Count_T&) const;
217 
223  bool isQueueDone() const;
224 
229  bool hasProgressStatus(const stdair::EventType::EN_EventType&) const;
230 
231  /* @brief Get a reference on the EventQueue object.
232  *
233  * @return EventQueue& Reference on the EventQueue.
234  */
235  EventQueue& getEventQueue() const;
236 
240  const stdair::Count_T& getQueueSize() const;
241 
251  template<class EventGenerator, class Key>
252  EventGenerator& getEventGenerator(const Key& iKey) const;
253 
263  template<class EventGenerator, class Key>
264  bool hasEventGenerator(const Key& iKey) const;
265 
275  template<class EventGenerator>
276  const std::list<EventGenerator*> getEventGeneratorList() const;
277 
287  template<class EventGenerator>
288  bool hasEventGeneratorList() const;
289 
304  const stdair::Count_T& getExpectedTotalNumberOfEventsToBeGenerated() const;
305 
322  const stdair::Count_T&
323  getExpectedTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType&) const;
324 
337  const stdair::Count_T& getActualTotalNumberOfEventsToBeGenerated() const;
338 
355  const stdair::Count_T&
356  getActualTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType&) const;
357 
361  const stdair::ProgressStatus& getStatus () const;
362 
367  const stdair::ProgressStatus& getStatus (const stdair::EventType::EN_EventType&) const;
368 
369  public:
370  // //////////////// Display support methods /////////////////
371 
378  std::string describeKey() const;
379 
386  std::string list () const;
387 
397  std::string list (const stdair::EventType::EN_EventType&) const;
398 
399  public:
400  // //////////////// Export support methods /////////////////
409  std::string jsonHandler (const stdair::JSONString&) const;
410 
415  std::string jsonExportEventQueue (const stdair::EventType::EN_EventType& =
416  stdair::EventType::LAST_VALUE) const;
417 
421  std::string jsonExportEvent (const stdair::EventStruct&) const;
422 
423  private:
424  // ////////////////// Constructors and Destructors //////////////////
428  SEVMGR_Service();
429 
434 
439  void initServiceContext();
440 
452  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&,
453  const stdair::BasDBParams&);
454 
464  stdair::STDAIR_ServicePtr_T initStdAirService (const stdair::BasLogParams&);
465 
474  void addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_ServicePtr,
475  const bool iOwnStdairService);
476 
483  void initSevmgrService();
484 
488  void finalise();
489 
490  private:
491  // ////////////////// Getters //////////////////
498  const stdair::STDAIR_Service& getSTDAIR_Service() const;
499 
500  private:
501  // ///////// Service Context /////////
505  SEVMGR_ServiceContext* _sevmgrServiceContext;
506  };
507 
508 }
509 #endif // __SEVMGR_SEVMGR_SERVICE_HPP