SEvMgr Logo  1.00.0
C++ Simulation-Oriented Discrete Event Management Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
SEVMGR_Service.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 #include <sstream>
7 // Boost
8 #include <boost/make_shared.hpp>
9 // StdAir
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>
20 // Sevmgr
28 
29 namespace SEVMGR {
30 
31  // //////////////////////////////////////////////////////////////////////
32  SEVMGR_Service::SEVMGR_Service() : _sevmgrServiceContext (NULL) {
33  assert (false);
34  }
35 
36  // //////////////////////////////////////////////////////////////////////
37  SEVMGR_Service::SEVMGR_Service (const SEVMGR_Service& iService)
38  : _sevmgrServiceContext (NULL) {
39  assert (false);
40  }
41 
42  // //////////////////////////////////////////////////////////////////////
43  SEVMGR_Service::SEVMGR_Service (const stdair::BasLogParams& iLogParams,
44  const stdair::BasDBParams& iDBParams)
45  : _sevmgrServiceContext (NULL) {
46 
47  // Initialise the STDAIR service handler
48  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
49  initStdAirService (iLogParams, iDBParams);
50 
51  // Initialise the service context
52  initServiceContext();
53 
54  // Add the StdAir service context to the SEvMgr service context
55  // \note SEvMgr owns the STDAIR service resources here.
56  const bool ownStdairService = true;
57  addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
58 
59  // Initialise the (remaining of the) context
60  initSevmgrService();
61  }
62 
63  // //////////////////////////////////////////////////////////////////////
64  SEVMGR_Service::SEVMGR_Service (const stdair::BasLogParams& iLogParams)
65  : _sevmgrServiceContext (NULL) {
66 
67  // Initialise the STDAIR service handler
68  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
69  initStdAirService (iLogParams);
70 
71  // Initialise the service context
72  initServiceContext();
73 
74  // Add the StdAir service context to the SEvMgr service context
75  // \note SEvMgr owns the STDAIR service resources here.
76  const bool ownStdairService = true;
77  addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
78 
79  // Initialise the (remaining of the) context
80  initSevmgrService();
81  }
82 
83  // ////////////////////////////////////////////////////////////////////
84  SEVMGR_Service::
85  SEVMGR_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr)
86  : _sevmgrServiceContext (NULL) {
87 
88  // Initialise the service context
89  initServiceContext();
90 
91  // Add the StdAir service context to the SEvMgr service context
92  // \note SEvMgr does not own the STDAIR service resources here.
93  const bool doesNotOwnStdairService = false;
94  addStdAirService (ioSTDAIR_Service_ptr, doesNotOwnStdairService);
95 
96  // Initialise the context
97  initSevmgrService();
98  }
99 
100  // //////////////////////////////////////////////////////////////////////
102  // Delete/Clean all the objects from memory
103  finalise();
104  }
105 
106  // ////////////////////////////////////////////////////////////////////
107  void SEVMGR_Service::finalise() {
108  assert (_sevmgrServiceContext != NULL);
109  // Reset the (Boost.)Smart pointer pointing on the STDAIR_Service object.
110  _sevmgrServiceContext->reset();
111  }
112 
113  // //////////////////////////////////////////////////////////////////////
114  void SEVMGR_Service::initServiceContext() {
115  // Initialise the service context
116  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
118  _sevmgrServiceContext = &lSEVMGR_ServiceContext;
119  }
120 
121  // ////////////////////////////////////////////////////////////////////
122  void SEVMGR_Service::
123  addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr,
124  const bool iOwnStdairService) {
125  // Retrieve the SEvMgr service context
126  assert (_sevmgrServiceContext != NULL);
127  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
128  *_sevmgrServiceContext;
129 
130  // Store the STDAIR service object within the (SEvMgr) service context
131  lSEVMGR_ServiceContext.setSTDAIR_Service (ioSTDAIR_Service_ptr,
132  iOwnStdairService);
133  }
134 
135  // //////////////////////////////////////////////////////////////////////
136  stdair::STDAIR_ServicePtr_T SEVMGR_Service::
137  initStdAirService (const stdair::BasLogParams& iLogParams,
138  const stdair::BasDBParams& iDBParams) {
139 
145  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
146  boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams);
147  assert (lSTDAIR_Service_ptr != NULL);
148 
149  return lSTDAIR_Service_ptr;
150  }
151 
152  // //////////////////////////////////////////////////////////////////////
153  stdair::STDAIR_ServicePtr_T SEVMGR_Service::
154  initStdAirService (const stdair::BasLogParams& iLogParams) {
155 
161  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
162  boost::make_shared<stdair::STDAIR_Service> (iLogParams);
163  assert (lSTDAIR_Service_ptr != NULL);
164 
165  return lSTDAIR_Service_ptr;
166  }
167 
168  // //////////////////////////////////////////////////////////////////////
169  void SEVMGR_Service::initSevmgrService() {
170  // Do nothing at this stage. A sample BOM tree may be built by
171  // calling the buildSampleBom() method
172  }
173 
174  // ////////////////////////////////////////////////////////////////////
176 
177  // Retrieve the SEvMgr service context
178  if (_sevmgrServiceContext == NULL) {
179  throw stdair::NonInitialisedServiceException ("The SEvMgr service has "
180  "not been initialised");
181  }
182  assert (_sevmgrServiceContext != NULL);
183 
184  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
185 
186  // Retrieve the StdAir service context
187  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
188  lSEVMGR_ServiceContext.getSTDAIR_ServicePtr();
189 
190  // Retrieve the EventQueue
191  EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue();
192 
193  // Delegate the building process to the dedicated command
194  EventQueueManager::buildSampleQueue (lSTDAIR_Service_ptr, lEventQueue);
195 
196  }
197 
198  // //////////////////////////////////////////////////////////////////////
199  stdair::BookingRequestStruct SEVMGR_Service::
200  buildSampleBookingRequest(const bool isForCRS) {
201 
202  // Retrieve the SEvMgr service context
203  if (_sevmgrServiceContext == NULL) {
204  throw stdair::NonInitialisedServiceException ("The SEvMgr service has "
205  "not been initialised");
206  }
207  assert (_sevmgrServiceContext != NULL);
208 
209  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
210 
211  // Retrieve the StdAir service context
212  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
213  lSEVMGR_ServiceContext.getSTDAIR_ServicePtr();
214 
215  // Delegate the booking request building to the dedicated service
216  stdair::BookingRequestStruct oBookingRequest =
217  EventQueueManager::buildSampleBookingRequest (lSTDAIR_Service_ptr,
218  isForCRS);
219 
220  return oBookingRequest;
221  }
222 
223  // //////////////////////////////////////////////////////////////////////
224  std::string SEVMGR_Service::describeKey() const {
225 
226  // Retrieve the SEvMgr service context
227  if (_sevmgrServiceContext == NULL) {
228  throw stdair::NonInitialisedServiceException ("The SEvMgr service has "
229  "not been initialised");
230  }
231  assert (_sevmgrServiceContext != NULL);
232 
233  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
234 
235  // Retrieve the event queue
236  EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue();
237 
238  // Delegate the key display to the dedicated command
239  return EventQueueManager::describeKey(lEventQueue);
240  }
241 
242  // //////////////////////////////////////////////////////////////////////
243  std::string SEVMGR_Service::list () const {
244 
245  // Retrieve the SEvMgr service context
246  if (_sevmgrServiceContext == NULL) {
247  throw stdair::NonInitialisedServiceException ("The SEvMgr service has "
248  "not been initialised");
249  }
250  assert (_sevmgrServiceContext != NULL);
251 
252  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
253 
254  // Retrieve the event queue
255  EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue ();
256 
257  // Delegate the key display to the dedicated command
258  return EventQueueManager::list (lEventQueue);
259  }
260 
261  // //////////////////////////////////////////////////////////////////////
262  std::string SEVMGR_Service::
263  list (const stdair::EventType::EN_EventType& iEventType) const {
264 
265  // Retrieve the SEvMgr service context
266  if (_sevmgrServiceContext == NULL) {
267  throw stdair::NonInitialisedServiceException ("The SEvMgr service has "
268  "not been initialised");
269  }
270  assert (_sevmgrServiceContext != NULL);
271 
272  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
273 
274  // Retrieve the event queue
275  EventQueue& lEventQueue = lSEVMGR_ServiceContext.getEventQueue ();
276 
277  // Delegate the key display to the dedicated command
278  return EventQueueManager::list (lEventQueue, iEventType);
279  }
280 
281  // ////////////////////////////////////////////////////////////////////
282  std::string SEVMGR_Service::
283  jsonHandler (const stdair::JSONString& iJSONString) const {
284 
285  //
286  // Extract from the JSON-ified string the command
287  //
288  stdair::JSonCommand::EN_JSonCommand lEN_JSonCommand;
289  const bool hasCommandBeenRetrieved =
290  stdair::BomJSONImport::jsonImportCommand (iJSONString,
291  lEN_JSonCommand);
292 
293  if (hasCommandBeenRetrieved == false) {
294  // Return an error JSON-ified string
295  std::ostringstream oErrorStream;
296  oErrorStream << "{\"error\": \"Wrong JSON-ified string: "
297  << "the command is not understood.\"}";
298  return oErrorStream.str();
299  }
300  assert (hasCommandBeenRetrieved == true);
301 
302  //
303  // Dispatch the command to the right JSon service handler
304  //
305  switch (lEN_JSonCommand) {
306  case stdair::JSonCommand::EVENT_LIST:{
307 
308  //
309  // Try to extract the event type from the JSON-ified string
310  //
311  stdair::EventType::EN_EventType lEN_EventType;
312  const bool hasEventTypeBeenRetrieved =
313  stdair::BomJSONImport::jsonImportEventType (iJSONString,
314  lEN_EventType);
315 
316  if (hasEventTypeBeenRetrieved == true) {
317  return jsonExportEventQueue (lEN_EventType);
318  }
319  return jsonExportEventQueue ();
320  }
321  default: {
322  // Return an Error string
323  std::ostringstream lErrorCmdMessage;
324  const std::string& lCommandStr =
325  stdair::JSonCommand::getLabel(lEN_JSonCommand);
326  lErrorCmdMessage << "{\"error\": \"The command '" << lCommandStr
327  << "' is not handled by the DSim service.\"}";
328  return lErrorCmdMessage.str();
329  break;
330  }
331  }
332 
333  // Return an error JSON-ified string
334  assert (false);
335  std::string lJSONDump ("{\"error\": \"Wrong JSON-ified string\"}");
336  return lJSONDump;
337 
338  }
339 
340  // ////////////////////////////////////////////////////////////////////
341  std::string SEVMGR_Service::
342  jsonExportEventQueue (const stdair::EventType::EN_EventType& iEventType) const {
343 
344  std::ostringstream oStr;
345 
346  // Retrieve the SEvMgr service context
347  if (_sevmgrServiceContext == NULL) {
348  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
349  "has not been initialised");
350  }
351  assert (_sevmgrServiceContext != NULL);
352 
353  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
354 
355  // Retrieve the StdAir service context
356  stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
357  lSEVMGR_ServiceContext.getSTDAIR_ServicePtr();
358 
359  // Retrieve the event queue
360  const EventQueue& lEventQueue =
361  lSEVMGR_ServiceContext.getEventQueue();
362 
363  // Delegate the JSON export to the dedicated command
364  BomJSONExport::jsonExportEventQueue (lSTDAIR_Service_ptr, oStr,
365  lEventQueue, iEventType);
366  return oStr.str();
367 
368  }
369 
370  // ////////////////////////////////////////////////////////////////////
371  std::string SEVMGR_Service::
372  jsonExportEvent (const stdair::EventStruct& iEvent) const {
373 
374  std::ostringstream oStr;
375 
376  // Retrieve the SEvMgr service context
377  if (_sevmgrServiceContext == NULL) {
378  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
379  "has not been initialised");
380  }
381  assert (_sevmgrServiceContext != NULL);
382 
383  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
384 
385  // Retrieve the STDAIR service object from the (SEvMgr) service context
386  stdair::STDAIR_Service& lSTDAIR_Service =
387  lSEVMGR_ServiceContext.getSTDAIR_Service();
388 
389  // Delegate the JSON export to the dedicated service
390  oStr << lSTDAIR_Service.jsonExportEventObject (iEvent);
391 
392  return oStr.str();
393 
394  }
395 
396  // ////////////////////////////////////////////////////////////////////
397  stdair::ProgressStatusSet SEVMGR_Service::
398  popEvent (stdair::EventStruct& iEventStruct) const {
399 
400  // Retrieve the SEvMgr service context
401  if (_sevmgrServiceContext == NULL) {
402  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
403  "has not been initialised");
404  }
405  assert (_sevmgrServiceContext != NULL);
406  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
407 
408  // Retrieve the event queue object instance
409  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
410 
411  // Delegate the call to the dedicated command
412  return EventQueueManager::popEvent(lQueue, iEventStruct);
413  }
414 
415  // ////////////////////////////////////////////////////////////////////
416  void SEVMGR_Service::
417  run (stdair::EventStruct& iEventStruct) const {
418 
419  // Retrieve the SEvMgr service context
420  if (_sevmgrServiceContext == NULL) {
421  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
422  "has not been initialised");
423  }
424  assert (_sevmgrServiceContext != NULL);
425  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
426 
427  // Retrieve the event queue object instance
428  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
429 
430  // Delegate the call to the dedicated command
431  EventQueueManager::run (lQueue, iEventStruct);
432 
433  }
434 
435  // ////////////////////////////////////////////////////////////////////
436  bool SEVMGR_Service::
437  select (stdair::EventStruct& iEventStruct,
438  const stdair::DateTime_T& iEventDateTime) const {
439 
440  // Retrieve the SEvMgr service context
441  if (_sevmgrServiceContext == NULL) {
442  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
443  "has not been initialised");
444  }
445  assert (_sevmgrServiceContext != NULL);
446  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
447 
448  // Retrieve the event queue object instance
449  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
450 
451  // Delegate the call to the dedicated command
452  return EventQueueManager::select (lQueue, iEventStruct, iEventDateTime);
453 
454  }
455 
456  // ////////////////////////////////////////////////////////////////////
457  void SEVMGR_Service::
458  updateStatus (const stdair::EventType::EN_EventType& iEventType,
459  const stdair::Count_T& iEventCount) const {
460 
461  // Retrieve the SEvMgr service context
462  if (_sevmgrServiceContext == NULL) {
463  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
464  "has not been initialised");
465  }
466  assert (_sevmgrServiceContext != NULL);
467  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
468 
469  // Retrieve the event queue object instance
470  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
471 
472  // Delegate the call to the dedicated command
473  EventQueueManager::updateStatus (lQueue, iEventType, iEventCount);
474  }
475 
476  // ////////////////////////////////////////////////////////////////////
477  void SEVMGR_Service::
478  addStatus (const stdair::EventType::EN_EventType& iEventType,
479  const stdair::Count_T& iEventCount) const {
480 
481  // Retrieve the SEvMgr service context
482  if (_sevmgrServiceContext == NULL) {
483  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
484  "has not been initialised");
485  }
486  assert (_sevmgrServiceContext != NULL);
487  SEVMGR_ServiceContext& lSEVMGR_ServiceContext = *_sevmgrServiceContext;
488 
489  // Retrieve the event queue object instance
490  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
491 
492  // Delegate the call to the dedicated function
493  EventQueueManager::addStatus (lQueue, iEventType, iEventCount);
494  }
495 
496  // ////////////////////////////////////////////////////////////////////
498 
499  // Retrieve the SEvMgr service context
500  if (_sevmgrServiceContext == NULL) {
501  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
502  "has not been initialised");
503  }
504  assert (_sevmgrServiceContext != NULL);
505  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
506  *_sevmgrServiceContext;
507 
508  // Retrieve the event queue object instance
509  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
510 
511  // Calculates whether the event queue has been fully emptied
512  const bool isQueueDone = EventQueueManager::isQueueDone(lQueue);
513 
514  //
515  return isQueueDone;
516  }
517 
518  // ////////////////////////////////////////////////////////////////////
519  bool SEVMGR_Service::hasProgressStatus(const stdair::EventType::EN_EventType& iEventType) const {
520 
521  // Retrieve the SEvMgr service context
522  if (_sevmgrServiceContext == NULL) {
523  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
524  "has not been initialised");
525  }
526  assert (_sevmgrServiceContext != NULL);
527  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
528  *_sevmgrServiceContext;
529 
530  // Retrieve the event queue object instance
531  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
532 
533  // Calculates whether the event queue has been fully emptied
534  const bool hasProgressStatus =
535  EventQueueManager::hasProgressStatus (lQueue, iEventType);
536 
537  //
538  return hasProgressStatus;
539  }
540 
541  // ////////////////////////////////////////////////////////////////////
542  const stdair::Count_T& SEVMGR_Service::getQueueSize() const {
543 
544  // Retrieve the SEvMgr service context
545  if (_sevmgrServiceContext == NULL) {
546  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
547  "has not been initialised");
548  }
549  assert (_sevmgrServiceContext != NULL);
550  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
551  *_sevmgrServiceContext;
552 
553  // Retrieve the event queue object instance
554  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
555 
556  // Delegate the call to the dedicated command
557  return EventQueueManager::getQueueSize(lQueue);
558  }
559 
560  // ////////////////////////////////////////////////////////////////////
561  void SEVMGR_Service::reset() const {
562 
563  // Retrieve the SEvMgr service context
564  if (_sevmgrServiceContext == NULL) {
565  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
566  "has not been initialised");
567  }
568  assert (_sevmgrServiceContext != NULL);
569  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
570  *_sevmgrServiceContext;
571 
572  // Retrieve the event queue object instance
573  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
574 
575  // Delegate the call to the dedicated command
576  EventQueueManager::reset (lQueue);
577  }
578 
579  // //////////////////////////////////////////////////////////////////////
581 
582  // Retrieve the SEvMgr service context
583  if (_sevmgrServiceContext == NULL) {
584  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
585  "has not been initialised");
586  }
587  assert (_sevmgrServiceContext != NULL);
588 
589  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
590  *_sevmgrServiceContext;
591 
592  return lSEVMGR_ServiceContext.getEventQueue();
593  }
594 
595  // ////////////////////////////////////////////////////////////////////
596  void SEVMGR_Service::addEvent(stdair::EventStruct& iEventStruct) const {
597 
598  // Retrieve the SEvMgr service context
599  if (_sevmgrServiceContext == NULL) {
600  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
601  "has not been initialised");
602  }
603  assert (_sevmgrServiceContext != NULL);
604  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
605  *_sevmgrServiceContext;
606 
607  // Retrieve the event queue object instance
608  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
609 
610  // Delegate the call to the dedicated command
611  EventQueueManager::addEvent (lQueue, iEventStruct);
612  }
613 
614  // ////////////////////////////////////////////////////////////////////
615  const stdair::Count_T& SEVMGR_Service::
617 
618  // Retrieve the SEvMgr service context
619  if (_sevmgrServiceContext == NULL) {
620  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
621  "has not been initialised");
622  }
623  assert (_sevmgrServiceContext != NULL);
624  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
625  *_sevmgrServiceContext;
626 
627  // Retrieve the event queue object instance
628  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
629 
630  // Delegate the call to the dedicated function
632  }
633 
634  // ////////////////////////////////////////////////////////////////////
635  const stdair::Count_T& SEVMGR_Service::
636  getExpectedTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType& iEventType) const {
637 
638  // Retrieve the SEvMgr service context
639  if (_sevmgrServiceContext == NULL) {
640  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
641  "has not been initialised");
642  }
643  assert (_sevmgrServiceContext != NULL);
644  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
645  *_sevmgrServiceContext;
646 
647  // Retrieve the event queue object instance
648  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
649 
650  // Delegate the call to the dedicated function
652  iEventType);
653  }
654 
655  // ////////////////////////////////////////////////////////////////////
656  const stdair::Count_T& SEVMGR_Service::
658 
659  // Retrieve the SEvMgr service context
660  if (_sevmgrServiceContext == NULL) {
661  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
662  "has not been initialised");
663  }
664  assert (_sevmgrServiceContext != NULL);
665  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
666  *_sevmgrServiceContext;
667 
668  // Retrieve the event queue object instance
669  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
670 
671  // Delegate the call to the dedicated function
673 
674  }
675 
676  // ////////////////////////////////////////////////////////////////////
677  const stdair::Count_T& SEVMGR_Service::
678  getActualTotalNumberOfEventsToBeGenerated(const stdair::EventType::EN_EventType& iEventType) const {
679 
680  // Retrieve the SEvMgr service context
681  if (_sevmgrServiceContext == NULL) {
682  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
683  "has not been initialised");
684  }
685  assert (_sevmgrServiceContext != NULL);
686  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
687  *_sevmgrServiceContext;
688 
689  // Retrieve the event queue object instance
690  const EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
691 
692  // Delegate the call to the dedicated function
694  iEventType);
695 
696  }
697 
699  const stdair::STDAIR_Service& SEVMGR_Service::getSTDAIR_Service() const {
700 
701  // Retrieve the StdAir service context
702  if (_sevmgrServiceContext == NULL) {
703  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
704  "has not been initialised");
705  }
706  assert (_sevmgrServiceContext != NULL);
707  const stdair::STDAIR_Service& lSTDAIR_Service =
708  _sevmgrServiceContext->getSTDAIR_Service();
709 
710  //
711  return lSTDAIR_Service;
712  }
713 
715  const stdair::ProgressStatus& SEVMGR_Service::getStatus() const {
716 
717  // Retrieve the SEvMgr service context
718  if (_sevmgrServiceContext == NULL) {
719  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
720  "has not been initialised");
721  }
722  assert (_sevmgrServiceContext != NULL);
723  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
724  *_sevmgrServiceContext;
725 
726  // Retrieve the event queue object instance
727  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
728 
729  // Delegate the call to the dedicated function
730  return EventQueueManager::getStatus(lQueue);
731 
732  }
733 
735  const stdair::ProgressStatus& SEVMGR_Service::
736  getStatus(const stdair::EventType::EN_EventType& iEventType) const {
737 
738  // Retrieve the SEvMgr service context
739  if (_sevmgrServiceContext == NULL) {
740  throw stdair::NonInitialisedServiceException ("The SEvMgr service "
741  "has not been initialised");
742  }
743  assert (_sevmgrServiceContext != NULL);
744  SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
745  *_sevmgrServiceContext;
746 
747  // Retrieve the event queue object instance
748  EventQueue& lQueue = lSEVMGR_ServiceContext.getEventQueue();
749 
750  // Delegate the call to the dedicated function
751  return EventQueueManager::getStatus(lQueue, iEventType);
752 
753  }
754 
755 
756 }