8#include <boost/make_shared.hpp>
10#include <stdair/basic/BasChronometer.hpp>
11#include <stdair/basic/BasConst_General.hpp>
12#include <stdair/basic/JSonCommand.hpp>
13#include <stdair/bom/BomRoot.hpp>
14#include <stdair/bom/BomDisplay.hpp>
15#include <stdair/bom/EventStruct.hpp>
16#include <stdair/bom/BookingRequestStruct.hpp>
17#include <stdair/bom/BomJSONImport.hpp>
18#include <stdair/service/Logger.hpp>
19#include <stdair/STDAIR_Service.hpp>
32 SEVMGR_Service::SEVMGR_Service() : _sevmgrServiceContext (NULL) {
37 SEVMGR_Service::SEVMGR_Service (
const SEVMGR_Service& iService)
38 : _sevmgrServiceContext (NULL) {
43 SEVMGR_Service::SEVMGR_Service (
const stdair::BasLogParams& iLogParams,
44 const stdair::BasDBParams& iDBParams)
45 : _sevmgrServiceContext (NULL) {
64 SEVMGR_Service::SEVMGR_Service (
const stdair::BasLogParams& iLogParams)
65 : _sevmgrServiceContext (NULL) {
86 : _sevmgrServiceContext (NULL) {
107 void SEVMGR_Service::finalise() {
110 _sevmgrServiceContext->reset();
114 void SEVMGR_Service::initServiceContext() {
124 const bool iOwnStdairService) {
128 *_sevmgrServiceContext;
138 const stdair::BasDBParams& iDBParams) {
162 boost::make_shared<stdair::STDAIR_Service> (
iLogParams);
169 void SEVMGR_Service::initSevmgrService() {
178 if (_sevmgrServiceContext ==
NULL) {
179 throw stdair::NonInitialisedServiceException (
"The SEvMgr service has "
180 "not been initialised");
203 if (_sevmgrServiceContext ==
NULL) {
204 throw stdair::NonInitialisedServiceException (
"The SEvMgr service has "
205 "not been initialised");
227 if (_sevmgrServiceContext ==
NULL) {
228 throw stdair::NonInitialisedServiceException (
"The SEvMgr service has "
229 "not been initialised");
239 return EventQueueManager::describeKey(
lEventQueue);
246 if (_sevmgrServiceContext ==
NULL) {
247 throw stdair::NonInitialisedServiceException (
"The SEvMgr service has "
248 "not been initialised");
263 list (
const stdair::EventType::EN_EventType& iEventType)
const {
266 if (_sevmgrServiceContext ==
NULL) {
267 throw stdair::NonInitialisedServiceException (
"The SEvMgr service has "
268 "not been initialised");
283 jsonHandler (
const stdair::JSONString& iJSONString)
const {
290 stdair::BomJSONImport::jsonImportCommand (
iJSONString,
296 oErrorStream <<
"{\"error\": \"Wrong JSON-ified string: "
297 <<
"the command is not understood.\"}";
306 case stdair::JSonCommand::EVENT_LIST:{
313 stdair::BomJSONImport::jsonImportEventType (
iJSONString,
327 <<
"' is not handled by the DSim service.\"}";
335 std::string
lJSONDump (
"{\"error\": \"Wrong JSON-ified string\"}");
344 std::ostringstream
oStr;
347 if (_sevmgrServiceContext ==
NULL) {
348 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
349 "has not been initialised");
374 std::ostringstream
oStr;
377 if (_sevmgrServiceContext ==
NULL) {
378 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
379 "has not been initialised");
398 popEvent (stdair::EventStruct& iEventStruct)
const {
401 if (_sevmgrServiceContext ==
NULL) {
402 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
403 "has not been initialised");
417 run (stdair::EventStruct& iEventStruct)
const {
420 if (_sevmgrServiceContext ==
NULL) {
421 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
422 "has not been initialised");
437 select (stdair::EventStruct& iEventStruct,
438 const stdair::DateTime_T& iEventDateTime)
const {
441 if (_sevmgrServiceContext ==
NULL) {
442 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
443 "has not been initialised");
458 updateStatus (
const stdair::EventType::EN_EventType& iEventType,
459 const stdair::Count_T& iEventCount)
const {
462 if (_sevmgrServiceContext ==
NULL) {
463 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
464 "has not been initialised");
478 addStatus (
const stdair::EventType::EN_EventType& iEventType,
479 const stdair::Count_T& iEventCount)
const {
482 if (_sevmgrServiceContext ==
NULL) {
483 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
484 "has not been initialised");
500 if (_sevmgrServiceContext ==
NULL) {
501 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
502 "has not been initialised");
506 *_sevmgrServiceContext;
522 if (_sevmgrServiceContext ==
NULL) {
523 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
524 "has not been initialised");
528 *_sevmgrServiceContext;
545 if (_sevmgrServiceContext ==
NULL) {
546 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
547 "has not been initialised");
551 *_sevmgrServiceContext;
557 return EventQueueManager::getQueueSize(
lQueue);
564 if (_sevmgrServiceContext ==
NULL) {
565 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
566 "has not been initialised");
570 *_sevmgrServiceContext;
576 EventQueueManager::reset (
lQueue);
583 if (_sevmgrServiceContext ==
NULL) {
584 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
585 "has not been initialised");
590 *_sevmgrServiceContext;
599 if (_sevmgrServiceContext ==
NULL) {
600 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
601 "has not been initialised");
605 *_sevmgrServiceContext;
619 if (_sevmgrServiceContext ==
NULL) {
620 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
621 "has not been initialised");
625 *_sevmgrServiceContext;
631 return EventQueueManager::getExpectedTotalNumberOfEventsToBeGenerated (
lQueue);
639 if (_sevmgrServiceContext ==
NULL) {
640 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
641 "has not been initialised");
645 *_sevmgrServiceContext;
651 return EventQueueManager::getExpectedTotalNumberOfEventsToBeGenerated (
lQueue,
660 if (_sevmgrServiceContext ==
NULL) {
661 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
662 "has not been initialised");
666 *_sevmgrServiceContext;
672 return EventQueueManager::getActualTotalNumberOfEventsToBeGenerated(
lQueue);
681 if (_sevmgrServiceContext ==
NULL) {
682 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
683 "has not been initialised");
687 *_sevmgrServiceContext;
693 return EventQueueManager::getActualTotalNumberOfEventsToBeGenerated(
lQueue,
699 const stdair::STDAIR_Service& SEVMGR_Service::getSTDAIR_Service()
const {
702 if (_sevmgrServiceContext ==
NULL) {
703 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
704 "has not been initialised");
708 _sevmgrServiceContext->getSTDAIR_Service();
718 if (_sevmgrServiceContext ==
NULL) {
719 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
720 "has not been initialised");
724 *_sevmgrServiceContext;
730 return EventQueueManager::getStatus(
lQueue);
736 getStatus(
const stdair::EventType::EN_EventType& iEventType)
const {
739 if (_sevmgrServiceContext ==
NULL) {
740 throw stdair::NonInitialisedServiceException (
"The SEvMgr service "
741 "has not been initialised");
745 *_sevmgrServiceContext;
static void jsonExportEventQueue(stdair::STDAIR_ServicePtr_T &, std::ostream &, const EventQueue &, const stdair::EventType::EN_EventType &)
Class holding event structures.
SEVMGR_ServiceContext & create()
static FacSEVMGRServiceContext & instance()
Class holding the context of the Sevmgr services.
const stdair::Count_T & getActualTotalNumberOfEventsToBeGenerated() const
stdair::BookingRequestStruct buildSampleBookingRequest(const bool isForCRS=false)
void run(stdair::EventStruct &) const
bool hasProgressStatus(const stdair::EventType::EN_EventType &) const
bool select(stdair::EventStruct &, const stdair::DateTime_T &) const
void addEvent(stdair::EventStruct &) const
const stdair::ProgressStatus & getStatus() const
void updateStatus(const stdair::EventType::EN_EventType &, const stdair::Count_T &) const
stdair::ProgressStatusSet popEvent(stdair::EventStruct &) const
EventQueue & getEventQueue() const
std::string jsonHandler(const stdair::JSONString &) const
std::string jsonExportEventQueue(const stdair::EventType::EN_EventType &=stdair::EventType::LAST_VALUE) const
void addStatus(const stdair::EventType::EN_EventType &, const stdair::Count_T &) const
const stdair::Count_T getQueueSize() const
const stdair::Count_T & getExpectedTotalNumberOfEventsToBeGenerated() const
std::string jsonExportEvent(const stdair::EventStruct &) const
std::string describeKey() const