SEvMgr Logo  1.00.5
C++ Simulation-Oriented Discrete Event Management Library
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
SEVMGR::SEVMGR_Service::buildSampleQueue
void buildSampleQueue()
Definition: SEVMGR_Service.cpp:175
SEVMGR::SEVMGR_Service::hasEventGeneratorList
bool hasEventGeneratorList() const
SEVMGR::SEVMGR_Service::hasEventGenerator
bool hasEventGenerator(const Key &iKey) const
SEVMGR::SEVMGR_Service::~SEVMGR_Service
~SEVMGR_Service()
Definition: SEVMGR_Service.cpp:101
SEVMGR::SEVMGR_Service::hasProgressStatus
bool hasProgressStatus(const stdair::EventType::EN_EventType &) const
Definition: SEVMGR_Service.cpp:519
SEVMGR::EventQueue
Class holding event structures.
Definition: EventQueue.hpp:68
stdair
Forward declarations.
Definition: EventQueue.hpp:23
SEVMGR::SEVMGR_Service::jsonExportEvent
std::string jsonExportEvent(const stdair::EventStruct &) const
Definition: SEVMGR_Service.cpp:372
SEVMGR::SEVMGR_Service::describeKey
std::string describeKey() const
Definition: SEVMGR_Service.cpp:224
SEVMGR::SEVMGR_Service::getEventGenerator
EventGenerator & getEventGenerator(const Key &iKey) const
SEVMGR::SEVMGR_Service::buildSampleBookingRequest
stdair::BookingRequestStruct buildSampleBookingRequest(const bool isForCRS=false)
Definition: SEVMGR_Service.cpp:200
SEVMGR::SEVMGR_Service::select
bool select(stdair::EventStruct &, const stdair::DateTime_T &) const
Definition: SEVMGR_Service.cpp:437
SEVMGR::SEVMGR_Service::getExpectedTotalNumberOfEventsToBeGenerated
const stdair::Count_T & getExpectedTotalNumberOfEventsToBeGenerated() const
Definition: SEVMGR_Service.cpp:616
SEVMGR::SEVMGR_Service::popEvent
stdair::ProgressStatusSet popEvent(stdair::EventStruct &) const
Definition: SEVMGR_Service.cpp:398
SEVMGR::SEVMGR_Service::getEventQueue
EventQueue & getEventQueue() const
Definition: SEVMGR_Service.cpp:580
SEVMGR::SEVMGR_Service::jsonHandler
std::string jsonHandler(const stdair::JSONString &) const
Definition: SEVMGR_Service.cpp:283
SEVMGR::SEVMGR_ServiceContext
Class holding the context of the Sevmgr services.
Definition: SEVMGR_ServiceContext.hpp:30
SEVMGR::SEVMGR_Service::getQueueSize
const stdair::Count_T getQueueSize() const
Definition: SEVMGR_Service.cpp:542
SEVMGR::SEVMGR_Service::addEventGenerator
void addEventGenerator(EventGenerator &iEventGenerator) const
SEVMGR
Definition: BasConst.cpp:10
SEVMGR::SEVMGR_Service::getActualTotalNumberOfEventsToBeGenerated
const stdair::Count_T & getActualTotalNumberOfEventsToBeGenerated() const
Definition: SEVMGR_Service.cpp:657
SEVMGR::SEVMGR_Service::isQueueDone
bool isQueueDone() const
Definition: SEVMGR_Service.cpp:497
SEVMGR::SEVMGR_Service::getEventGeneratorList
const std::list< EventGenerator * > getEventGeneratorList() const
SEVMGR::SEVMGR_Service::jsonExportEventQueue
std::string jsonExportEventQueue(const stdair::EventType::EN_EventType &=stdair::EventType::LAST_VALUE) const
Definition: SEVMGR_Service.cpp:342
SEVMGR::SEVMGR_Service
class holding the services related to Travel Demand Generation.
Definition: SEVMGR_Service.hpp:32
SEVMGR::SEVMGR_Service::addStatus
void addStatus(const stdair::EventType::EN_EventType &, const stdair::Count_T &) const
Definition: SEVMGR_Service.cpp:478
SEVMGR::SEVMGR_Service::updateStatus
void updateStatus(const stdair::EventType::EN_EventType &, const stdair::Count_T &) const
Definition: SEVMGR_Service.cpp:458
SEVMGR::SEVMGR_Service::reset
void reset() const
Definition: SEVMGR_Service.cpp:561
SEVMGR::SEVMGR_Service::list
std::string list() const
Definition: SEVMGR_Service.cpp:243
SEVMGR::SEVMGR_Service::addEvent
void addEvent(stdair::EventStruct &) const
Definition: SEVMGR_Service.cpp:596
SEVMGR::SEVMGR_Service::run
void run(stdair::EventStruct &) const
Definition: SEVMGR_Service.cpp:417
SEVMGR::SEVMGR_Service::getStatus
const stdair::ProgressStatus & getStatus() const
Definition: SEVMGR_Service.cpp:715