$treeview $search $mathjax
00001 // ////////////////////////////////////////////////////////////////////// 00002 // Import section 00003 // ////////////////////////////////////////////////////////////////////// 00004 // STL 00005 #include <cassert> 00006 #include <sstream> 00007 // Boost 00008 #include <boost/make_shared.hpp> 00009 // StdAir 00010 #include <stdair/basic/BasChronometer.hpp> 00011 #include <stdair/basic/BasConst_General.hpp> 00012 #include <stdair/basic/JSonCommand.hpp> 00013 #include <stdair/bom/BomRoot.hpp> 00014 #include <stdair/bom/BomDisplay.hpp> 00015 #include <stdair/bom/EventStruct.hpp> 00016 #include <stdair/bom/BookingRequestStruct.hpp> 00017 #include <stdair/bom/BomJSONImport.hpp> 00018 #include <stdair/service/Logger.hpp> 00019 #include <stdair/STDAIR_Service.hpp> 00020 // Sevmgr 00021 #include <sevmgr/basic/BasConst_SEVMGR_Service.hpp> 00022 #include <sevmgr/factory/FacSEVMGRServiceContext.hpp> 00023 #include <sevmgr/command/EventQueueManager.hpp> 00024 #include <sevmgr/service/SEVMGR_ServiceContext.hpp> 00025 #include <sevmgr/SEVMGR_Service.hpp> 00026 #include <sevmgr/bom/EventQueue.hpp> 00027 #include <sevmgr/bom/BomJSONExport.hpp> 00028 00029 namespace SEVMGR { 00030 00031 // ////////////////////////////////////////////////////////////////////// 00032 SEVMGR_Service::SEVMGR_Service() : _sevmgrServiceContext (NULL) { 00033 assert (false); 00034 } 00035 00036 // ////////////////////////////////////////////////////////////////////// 00037 SEVMGR_Service::SEVMGR_Service (const SEVMGR_Service& iService) 00038 : _sevmgrServiceContext (NULL) { 00039 assert (false); 00040 } 00041 00042 // ////////////////////////////////////////////////////////////////////// 00043 SEVMGR_Service::SEVMGR_Service (const stdair::BasLogParams& iLogParams, 00044 const stdair::BasDBParams& iDBParams) 00045 : _sevmgrServiceContext (NULL) { 00046 00047 // Initialise the STDAIR service handler 00048 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00049 initStdAirService (iLogParams, iDBParams); 00050 00051 // Initialise the service context 00052 initServiceContext(); 00053 00054 // Add the StdAir service context to the SEvMgr service context 00055 // \note SEvMgr owns the STDAIR service resources here. 00056 const bool ownStdairService = true; 00057 addStdAirService (lSTDAIR_Service_ptr, ownStdairService); 00058 00059 // Initialise the (remaining of the) context 00060 initSevmgrService(); 00061 } 00062 00063 // ////////////////////////////////////////////////////////////////////// 00064 SEVMGR_Service::SEVMGR_Service (const stdair::BasLogParams& iLogParams) 00065 : _sevmgrServiceContext (NULL) { 00066 00067 // Initialise the STDAIR service handler 00068 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00069 initStdAirService (iLogParams); 00070 00071 // Initialise the service context 00072 initServiceContext(); 00073 00074 // Add the StdAir service context to the SEvMgr service context 00075 // \note SEvMgr owns the STDAIR service resources here. 00076 const bool ownStdairService = true; 00077 addStdAirService (lSTDAIR_Service_ptr, ownStdairService); 00078 00079 // Initialise the (remaining of the) context 00080 initSevmgrService(); 00081 } 00082 00083 // //////////////////////////////////////////////////////////////////// 00084 SEVMGR_Service:: 00085 SEVMGR_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr) 00086 : _sevmgrServiceContext (NULL) { 00087 00088 // Initialise the service context 00089 initServiceContext(); 00090 00091 // Add the StdAir service context to the SEvMgr service context 00092 // \note SEvMgr does not own the STDAIR service resources here. 00093 const bool doesNotOwnStdairService = false; 00094 addStdAirService (ioSTDAIR_Service_ptr, doesNotOwnStdairService); 00095 00096 // Initialise the context 00097 initSevmgrService(); 00098 } 00099 00100 // ////////////////////////////////////////////////////////////////////// 00101 SEVMGR_Service::~SEVMGR_Service() { 00102 // Delete/Clean all the objects from memory 00103 finalise(); 00104 } 00105 00106 // //////////////////////////////////////////////////////////////////// 00107 void SEVMGR_Service::finalise() { 00108 assert (_sevmgrServiceContext != NULL); 00109 // Reset the (Boost.)Smart pointer pointing on the STDAIR_Service object. 00110 _sevmgrServiceContext->reset(); 00111 } 00112 00113 // ////////////////////////////////////////////////////////////////////// 00114 void SEVMGR_Service::initServiceContext() { 00115 // Initialise the service context 00116 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00117 FacSEVMGRServiceContext::instance().create(); 00118 _sevmgrServiceContext = &lSEVMGR_ServiceContext; 00119 } 00120 00121 // //////////////////////////////////////////////////////////////////// 00122 void SEVMGR_Service:: 00123 addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr, 00124 const bool iOwnStdairService) { 00125 // Retrieve the SEvMgr service context 00126 assert (_sevmgrServiceContext != NULL); 00127 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00128 *_sevmgrServiceContext; 00129 00130 // Store the STDAIR service object within the (SEvMgr) service context 00131 lSEVMGR_ServiceContext.setSTDAIR_Service (ioSTDAIR_Service_ptr, 00132 iOwnStdairService); 00133 } 00134 00135 // ////////////////////////////////////////////////////////////////////// 00136 stdair::STDAIR_ServicePtr_T SEVMGR_Service:: 00137 initStdAirService (const stdair::BasLogParams& iLogParams, 00138 const stdair::BasDBParams& iDBParams) { 00139 00145 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00146 boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams); 00147 assert (lSTDAIR_Service_ptr != NULL); 00148 00149 return lSTDAIR_Service_ptr; 00150 } 00151 00152 // ////////////////////////////////////////////////////////////////////// 00153 stdair::STDAIR_ServicePtr_T SEVMGR_Service:: 00154 initStdAirService (const stdair::BasLogParams& iLogParams) { 00155 00161 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00162 boost::make_shared<stdair::STDAIR_Service> (iLogParams); 00163 assert (lSTDAIR_Service_ptr != NULL); 00164 00165 return lSTDAIR_Service_ptr; 00166 } 00167 00168 // ////////////////////////////////////////////////////////////////////// 00169 void SEVMGR_Service::initSevmgrService() { 00170 // Do nothing at this stage. A sample BOM tree may be built by 00171 // calling the buildSampleBom() method 00172 } 00173 00174 // //////////////////////////////////////////////////////////////////// 00175 void SEVMGR_Service::buildSampleQueue() { 00176 00177 // Retrieve the SEvMgr service context 00178 if (_sevmgrServiceContext == NULL) { 00179 throw stdair::NonInitialisedServiceException ("The SEvMgr service has " 00180 "not been initialised"); 00181 } 00182 assert (_sevmgrServiceContext != NULL); 00183 00184 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00185 00186 // Retrieve the StdAir service context 00187 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00188 lSEVMGR_ServiceContext.getSTDAIR_ServicePtr(); 00189 00190 // Retrieve the EventQueue 00191 EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue(); 00192 00193 // Delegate the building process to the dedicated command 00194 EventQueueManager::buildSampleQueue (lSTDAIR_Service_ptr, lEventQueue); 00195 00196 } 00197 00198 // ////////////////////////////////////////////////////////////////////// 00199 stdair::BookingRequestStruct SEVMGR_Service:: 00200 buildSampleBookingRequest(const bool isForCRS) { 00201 00202 // Retrieve the SEvMgr service context 00203 if (_sevmgrServiceContext == NULL) { 00204 throw stdair::NonInitialisedServiceException ("The SEvMgr service has " 00205 "not been initialised"); 00206 } 00207 assert (_sevmgrServiceContext != NULL); 00208 00209 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00210 00211 // Retrieve the StdAir service context 00212 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00213 lSEVMGR_ServiceContext.getSTDAIR_ServicePtr(); 00214 00215 // Delegate the booking request building to the dedicated service 00216 stdair::BookingRequestStruct oBookingRequest = 00217 EventQueueManager::buildSampleBookingRequest (lSTDAIR_Service_ptr, 00218 isForCRS); 00219 00220 return oBookingRequest; 00221 } 00222 00223 // ////////////////////////////////////////////////////////////////////// 00224 std::string SEVMGR_Service::describeKey() const { 00225 00226 // Retrieve the SEvMgr service context 00227 if (_sevmgrServiceContext == NULL) { 00228 throw stdair::NonInitialisedServiceException ("The SEvMgr service has " 00229 "not been initialised"); 00230 } 00231 assert (_sevmgrServiceContext != NULL); 00232 00233 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00234 00235 // Retrieve the event queue 00236 EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue(); 00237 00238 // Delegate the key display to the dedicated command 00239 return EventQueueManager::describeKey(lEventQueue); 00240 } 00241 00242 // ////////////////////////////////////////////////////////////////////// 00243 std::string SEVMGR_Service::list () const { 00244 00245 // Retrieve the SEvMgr service context 00246 if (_sevmgrServiceContext == NULL) { 00247 throw stdair::NonInitialisedServiceException ("The SEvMgr service has " 00248 "not been initialised"); 00249 } 00250 assert (_sevmgrServiceContext != NULL); 00251 00252 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00253 00254 // Retrieve the event queue 00255 EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue (); 00256 00257 // Delegate the key display to the dedicated command 00258 return EventQueueManager::list (lEventQueue); 00259 } 00260 00261 // ////////////////////////////////////////////////////////////////////// 00262 std::string SEVMGR_Service:: 00263 list (const stdair::EventType::EN_EventType& iEventType) const { 00264 00265 // Retrieve the SEvMgr service context 00266 if (_sevmgrServiceContext == NULL) { 00267 throw stdair::NonInitialisedServiceException ("The SEvMgr service has " 00268 "not been initialised"); 00269 } 00270 assert (_sevmgrServiceContext != NULL); 00271 00272 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00273 00274 // Retrieve the event queue 00275 EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue (); 00276 00277 // Delegate the key display to the dedicated command 00278 return EventQueueManager::list (lEventQueue, iEventType); 00279 } 00280 00281 // //////////////////////////////////////////////////////////////////// 00282 std::string SEVMGR_Service:: 00283 jsonHandler (const stdair::JSONString& iJSONString) const { 00284 00285 // 00286 // Extract from the JSON-ified string the command 00287 // 00288 stdair::JSonCommand::EN_JSonCommand lEN_JSonCommand; 00289 const bool hasCommandBeenRetrieved = 00290 stdair::BomJSONImport::jsonImportCommand (iJSONString, 00291 lEN_JSonCommand); 00292 00293 if (hasCommandBeenRetrieved == false) { 00294 // Return an error JSON-ified string 00295 std::ostringstream oErrorStream; 00296 oErrorStream << "{\"error\": \"Wrong JSON-ified string: " 00297 << "the command is not understood.\"}"; 00298 return oErrorStream.str(); 00299 } 00300 assert (hasCommandBeenRetrieved == true); 00301 00302 // 00303 // Dispatch the command to the right JSon service handler 00304 // 00305 switch (lEN_JSonCommand) { 00306 case stdair::JSonCommand::EVENT_LIST:{ 00307 00308 // 00309 // Try to extract the event type from the JSON-ified string 00310 // 00311 stdair::EventType::EN_EventType lEN_EventType; 00312 const bool hasEventTypeBeenRetrieved = 00313 stdair::BomJSONImport::jsonImportEventType (iJSONString, 00314 lEN_EventType); 00315 00316 if (hasEventTypeBeenRetrieved == true) { 00317 return jsonExportEventQueue (lEN_EventType); 00318 } 00319 return jsonExportEventQueue (); 00320 } 00321 default: { 00322 // Return an Error string 00323 std::ostringstream lErrorCmdMessage; 00324 const std::string& lCommandStr = 00325 stdair::JSonCommand::getLabel(lEN_JSonCommand); 00326 lErrorCmdMessage << "{\"error\": \"The command '" << lCommandStr 00327 << "' is not handled by the DSim service.\"}"; 00328 return lErrorCmdMessage.str(); 00329 break; 00330 } 00331 } 00332 00333 // Return an error JSON-ified string 00334 assert (false); 00335 std::string lJSONDump ("{\"error\": \"Wrong JSON-ified string\"}"); 00336 return lJSONDump; 00337 00338 } 00339 00340 // //////////////////////////////////////////////////////////////////// 00341 std::string SEVMGR_Service:: 00342 jsonExportEventQueue (const stdair::EventType::EN_EventType& iEventType) const { 00343 00344 std::ostringstream oStr; 00345 00346 // Retrieve the SEvMgr service context 00347 if (_sevmgrServiceContext == NULL) { 00348 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00349 "has not been initialised"); 00350 } 00351 assert (_sevmgrServiceContext != NULL); 00352 00353 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00354 00355 // Retrieve the StdAir service context 00356 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr = 00357 lSEVMGR_ServiceContext.getSTDAIR_ServicePtr(); 00358 00359 // Retrieve the event queue 00360 const EventQueue& lEventQueue = 00361 lSEVMGR_ServiceContext.getEventQueue(); 00362 00363 // Delegate the JSON export to the dedicated command 00364 BomJSONExport::jsonExportEventQueue (lSTDAIR_Service_ptr, oStr, 00365 lEventQueue, iEventType); 00366 return oStr.str(); 00367 00368 } 00369 00370 // //////////////////////////////////////////////////////////////////// 00371 std::string SEVMGR_Service:: 00372 jsonExportEvent (const stdair::EventStruct& iEvent) const { 00373 00374 std::ostringstream oStr; 00375 00376 // Retrieve the SEvMgr service context 00377 if (_sevmgrServiceContext == NULL) { 00378 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00379 "has not been initialised"); 00380 } 00381 assert (_sevmgrServiceContext != NULL); 00382 00383 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00384 00385 // Retrieve the STDAIR service object from the (SEvMgr) service context 00386 stdair::STDAIR_Service& lSTDAIR_Service = 00387 lSEVMGR_ServiceContext.getSTDAIR_Service(); 00388 00389 // Delegate the JSON export to the dedicated service 00390 oStr << lSTDAIR_Service.jsonExportEventObject (iEvent); 00391 00392 return oStr.str(); 00393 00394 } 00395 00396 // //////////////////////////////////////////////////////////////////// 00397 stdair::ProgressStatusSet SEVMGR_Service:: 00398 popEvent (stdair::EventStruct& iEventStruct) const { 00399 00400 // Retrieve the SEvMgr service context 00401 if (_sevmgrServiceContext == NULL) { 00402 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00403 "has not been initialised"); 00404 } 00405 assert (_sevmgrServiceContext != NULL); 00406 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00407 00408 // Retrieve the event queue object instance 00409 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00410 00411 // Delegate the call to the dedicated command 00412 return EventQueueManager::popEvent(lQueue, iEventStruct); 00413 } 00414 00415 // //////////////////////////////////////////////////////////////////// 00416 void SEVMGR_Service:: 00417 run (stdair::EventStruct& iEventStruct) const { 00418 00419 // Retrieve the SEvMgr service context 00420 if (_sevmgrServiceContext == NULL) { 00421 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00422 "has not been initialised"); 00423 } 00424 assert (_sevmgrServiceContext != NULL); 00425 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00426 00427 // Retrieve the event queue object instance 00428 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00429 00430 // Delegate the call to the dedicated command 00431 EventQueueManager::run (lQueue, iEventStruct); 00432 00433 } 00434 00435 // //////////////////////////////////////////////////////////////////// 00436 bool SEVMGR_Service:: 00437 select (stdair::EventStruct& iEventStruct, 00438 const stdair::DateTime_T& iEventDateTime) const { 00439 00440 // Retrieve the SEvMgr service context 00441 if (_sevmgrServiceContext == NULL) { 00442 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00443 "has not been initialised"); 00444 } 00445 assert (_sevmgrServiceContext != NULL); 00446 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00447 00448 // Retrieve the event queue object instance 00449 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00450 00451 // Delegate the call to the dedicated command 00452 return EventQueueManager::select (lQueue, iEventStruct, iEventDateTime); 00453 00454 } 00455 00456 // //////////////////////////////////////////////////////////////////// 00457 void SEVMGR_Service:: 00458 updateStatus (const stdair::EventType::EN_EventType& iEventType, 00459 const stdair::Count_T& iEventCount) const { 00460 00461 // Retrieve the SEvMgr service context 00462 if (_sevmgrServiceContext == NULL) { 00463 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00464 "has not been initialised"); 00465 } 00466 assert (_sevmgrServiceContext != NULL); 00467 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00468 00469 // Retrieve the event queue object instance 00470 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00471 00472 // Delegate the call to the dedicated command 00473 EventQueueManager::updateStatus (lQueue, iEventType, iEventCount); 00474 } 00475 00476 // //////////////////////////////////////////////////////////////////// 00477 void SEVMGR_Service:: 00478 addStatus (const stdair::EventType::EN_EventType& iEventType, 00479 const stdair::Count_T& iEventCount) const { 00480 00481 // Retrieve the SEvMgr service context 00482 if (_sevmgrServiceContext == NULL) { 00483 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00484 "has not been initialised"); 00485 } 00486 assert (_sevmgrServiceContext != NULL); 00487 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext; 00488 00489 // Retrieve the event queue object instance 00490 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00491 00492 // Delegate the call to the dedicated function 00493 EventQueueManager::addStatus (lQueue, iEventType, iEventCount); 00494 } 00495 00496 // //////////////////////////////////////////////////////////////////// 00497 bool SEVMGR_Service::isQueueDone() const { 00498 00499 // Retrieve the SEvMgr service context 00500 if (_sevmgrServiceContext == NULL) { 00501 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00502 "has not been initialised"); 00503 } 00504 assert (_sevmgrServiceContext != NULL); 00505 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00506 *_sevmgrServiceContext; 00507 00508 // Retrieve the event queue object instance 00509 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00510 00511 // Calculates whether the event queue has been fully emptied 00512 const bool isQueueDone = EventQueueManager::isQueueDone(lQueue); 00513 00514 // 00515 return isQueueDone; 00516 } 00517 00518 // //////////////////////////////////////////////////////////////////// 00519 bool SEVMGR_Service::hasProgressStatus(const stdair::EventType::EN_EventType& iEventType) const { 00520 00521 // Retrieve the SEvMgr service context 00522 if (_sevmgrServiceContext == NULL) { 00523 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00524 "has not been initialised"); 00525 } 00526 assert (_sevmgrServiceContext != NULL); 00527 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00528 *_sevmgrServiceContext; 00529 00530 // Retrieve the event queue object instance 00531 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00532 00533 // Calculates whether the event queue has been fully emptied 00534 const bool hasProgressStatus = 00535 EventQueueManager::hasProgressStatus (lQueue, iEventType); 00536 00537 // 00538 return hasProgressStatus; 00539 } 00540 00541 // //////////////////////////////////////////////////////////////////// 00542 const stdair::Count_T& SEVMGR_Service::getQueueSize() const { 00543 00544 // Retrieve the SEvMgr service context 00545 if (_sevmgrServiceContext == NULL) { 00546 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00547 "has not been initialised"); 00548 } 00549 assert (_sevmgrServiceContext != NULL); 00550 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00551 *_sevmgrServiceContext; 00552 00553 // Retrieve the event queue object instance 00554 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00555 00556 // Delegate the call to the dedicated command 00557 return EventQueueManager::getQueueSize(lQueue); 00558 } 00559 00560 // //////////////////////////////////////////////////////////////////// 00561 void SEVMGR_Service::reset() const { 00562 00563 // Retrieve the SEvMgr service context 00564 if (_sevmgrServiceContext == NULL) { 00565 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00566 "has not been initialised"); 00567 } 00568 assert (_sevmgrServiceContext != NULL); 00569 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00570 *_sevmgrServiceContext; 00571 00572 // Retrieve the event queue object instance 00573 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00574 00575 // Delegate the call to the dedicated command 00576 EventQueueManager::reset (lQueue); 00577 } 00578 00579 // ////////////////////////////////////////////////////////////////////// 00580 EventQueue& SEVMGR_Service::getEventQueue() const { 00581 00582 // Retrieve the SEvMgr service context 00583 if (_sevmgrServiceContext == NULL) { 00584 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00585 "has not been initialised"); 00586 } 00587 assert (_sevmgrServiceContext != NULL); 00588 00589 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00590 *_sevmgrServiceContext; 00591 00592 return lSEVMGR_ServiceContext.getEventQueue(); 00593 } 00594 00595 // //////////////////////////////////////////////////////////////////// 00596 void SEVMGR_Service::addEvent(stdair::EventStruct& iEventStruct) const { 00597 00598 // Retrieve the SEvMgr service context 00599 if (_sevmgrServiceContext == NULL) { 00600 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00601 "has not been initialised"); 00602 } 00603 assert (_sevmgrServiceContext != NULL); 00604 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00605 *_sevmgrServiceContext; 00606 00607 // Retrieve the event queue object instance 00608 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00609 00610 // Delegate the call to the dedicated command 00611 EventQueueManager::addEvent (lQueue, iEventStruct); 00612 } 00613 00614 // //////////////////////////////////////////////////////////////////// 00615 const stdair::Count_T& SEVMGR_Service:: 00616 getExpectedTotalNumberOfEventsToBeGenerated() const { 00617 00618 // Retrieve the SEvMgr service context 00619 if (_sevmgrServiceContext == NULL) { 00620 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00621 "has not been initialised"); 00622 } 00623 assert (_sevmgrServiceContext != NULL); 00624 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00625 *_sevmgrServiceContext; 00626 00627 // Retrieve the event queue object instance 00628 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00629 00630 // Delegate the call to the dedicated function 00631 return EventQueueManager::getExpectedTotalNumberOfEventsToBeGenerated (lQueue); 00632 } 00633 00634 // //////////////////////////////////////////////////////////////////// 00635 const stdair::Count_T& SEVMGR_Service:: 00636 getExpectedTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType& iEventType) const { 00637 00638 // Retrieve the SEvMgr service context 00639 if (_sevmgrServiceContext == NULL) { 00640 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00641 "has not been initialised"); 00642 } 00643 assert (_sevmgrServiceContext != NULL); 00644 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00645 *_sevmgrServiceContext; 00646 00647 // Retrieve the event queue object instance 00648 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00649 00650 // Delegate the call to the dedicated function 00651 return EventQueueManager::getExpectedTotalNumberOfEventsToBeGenerated (lQueue, 00652 iEventType); 00653 } 00654 00655 // //////////////////////////////////////////////////////////////////// 00656 const stdair::Count_T& SEVMGR_Service:: 00657 getActualTotalNumberOfEventsToBeGenerated() const { 00658 00659 // Retrieve the SEvMgr service context 00660 if (_sevmgrServiceContext == NULL) { 00661 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00662 "has not been initialised"); 00663 } 00664 assert (_sevmgrServiceContext != NULL); 00665 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00666 *_sevmgrServiceContext; 00667 00668 // Retrieve the event queue object instance 00669 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00670 00671 // Delegate the call to the dedicated function 00672 return EventQueueManager::getActualTotalNumberOfEventsToBeGenerated(lQueue); 00673 00674 } 00675 00676 // //////////////////////////////////////////////////////////////////// 00677 const stdair::Count_T& SEVMGR_Service:: 00678 getActualTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType& iEventType) const { 00679 00680 // Retrieve the SEvMgr service context 00681 if (_sevmgrServiceContext == NULL) { 00682 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00683 "has not been initialised"); 00684 } 00685 assert (_sevmgrServiceContext != NULL); 00686 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00687 *_sevmgrServiceContext; 00688 00689 // Retrieve the event queue object instance 00690 const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00691 00692 // Delegate the call to the dedicated function 00693 return EventQueueManager::getActualTotalNumberOfEventsToBeGenerated(lQueue, 00694 iEventType); 00695 00696 } 00697 00699 const stdair::STDAIR_Service& SEVMGR_Service::getSTDAIR_Service() const { 00700 00701 // Retrieve the StdAir service context 00702 if (_sevmgrServiceContext == NULL) { 00703 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00704 "has not been initialised"); 00705 } 00706 assert (_sevmgrServiceContext != NULL); 00707 const stdair::STDAIR_Service& lSTDAIR_Service = 00708 _sevmgrServiceContext->getSTDAIR_Service(); 00709 00710 // 00711 return lSTDAIR_Service; 00712 } 00713 00715 const stdair::ProgressStatus& SEVMGR_Service::getStatus() const { 00716 00717 // Retrieve the SEvMgr service context 00718 if (_sevmgrServiceContext == NULL) { 00719 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00720 "has not been initialised"); 00721 } 00722 assert (_sevmgrServiceContext != NULL); 00723 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00724 *_sevmgrServiceContext; 00725 00726 // Retrieve the event queue object instance 00727 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00728 00729 // Delegate the call to the dedicated function 00730 return EventQueueManager::getStatus(lQueue); 00731 00732 } 00733 00735 const stdair::ProgressStatus& SEVMGR_Service:: 00736 getStatus(const stdair::EventType::EN_EventType& iEventType) const { 00737 00738 // Retrieve the SEvMgr service context 00739 if (_sevmgrServiceContext == NULL) { 00740 throw stdair::NonInitialisedServiceException ("The SEvMgr service " 00741 "has not been initialised"); 00742 } 00743 assert (_sevmgrServiceContext != NULL); 00744 SEVMGR_ServiceContext& lSEVMGR_ServiceContext = 00745 *_sevmgrServiceContext; 00746 00747 // Retrieve the event queue object instance 00748 EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue(); 00749 00750 // Delegate the call to the dedicated function 00751 return EventQueueManager::getStatus(lQueue, iEventType); 00752 00753 } 00754 00755 00756 }