8 #include <boost/make_shared.hpp>
10 #include <stdair/basic/BasChronometer.hpp>
11 #include <stdair/basic/BasConst_General.hpp>
12 #include <stdair/bom/BomRoot.hpp>
13 #include <stdair/bom/BomDisplay.hpp>
14 #include <stdair/bom/EventStruct.hpp>
15 #include <stdair/bom/EventQueue.hpp>
16 #include <stdair/service/Logger.hpp>
17 #include <stdair/STDAIR_Service.hpp>
28 SEVMGR_Service::SEVMGR_Service() : _sevmgrServiceContext (NULL) {
33 SEVMGR_Service::SEVMGR_Service (
const SEVMGR_Service& iService)
34 : _sevmgrServiceContext (NULL) {
39 SEVMGR_Service::SEVMGR_Service (
const stdair::BasLogParams& iLogParams,
40 const stdair::BasDBParams& iDBParams)
41 : _sevmgrServiceContext (NULL) {
44 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
45 initStdAirService (iLogParams, iDBParams);
52 const bool ownStdairService =
true;
53 addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
60 SEVMGR_Service::SEVMGR_Service (
const stdair::BasLogParams& iLogParams)
61 : _sevmgrServiceContext (NULL) {
64 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
65 initStdAirService (iLogParams);
72 const bool ownStdairService =
true;
73 addStdAirService (lSTDAIR_Service_ptr, ownStdairService);
81 SEVMGR_Service (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr)
82 : _sevmgrServiceContext (NULL) {
89 const bool doesNotOwnStdairService =
false;
90 addStdAirService (ioSTDAIR_Service_ptr, doesNotOwnStdairService);
103 void SEVMGR_Service::finalise() {
104 assert (_sevmgrServiceContext != NULL);
106 _sevmgrServiceContext->reset();
110 void SEVMGR_Service::initServiceContext() {
112 SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
114 _sevmgrServiceContext = &lSEVMGR_ServiceContext;
118 void SEVMGR_Service::
119 addStdAirService (stdair::STDAIR_ServicePtr_T ioSTDAIR_Service_ptr,
120 const bool iOwnStdairService) {
122 assert (_sevmgrServiceContext != NULL);
123 SEVMGR_ServiceContext& lSEVMGR_ServiceContext =
124 *_sevmgrServiceContext;
127 lSEVMGR_ServiceContext.setSTDAIR_Service (ioSTDAIR_Service_ptr,
132 stdair::STDAIR_ServicePtr_T SEVMGR_Service::
133 initStdAirService (
const stdair::BasLogParams& iLogParams,
134 const stdair::BasDBParams& iDBParams) {
141 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
142 boost::make_shared<stdair::STDAIR_Service> (iLogParams, iDBParams);
143 assert (lSTDAIR_Service_ptr != NULL);
145 return lSTDAIR_Service_ptr;
149 stdair::STDAIR_ServicePtr_T SEVMGR_Service::
150 initStdAirService (
const stdair::BasLogParams& iLogParams) {
157 stdair::STDAIR_ServicePtr_T lSTDAIR_Service_ptr =
158 boost::make_shared<stdair::STDAIR_Service> (iLogParams);
159 assert (lSTDAIR_Service_ptr != NULL);
161 return lSTDAIR_Service_ptr;
165 void SEVMGR_Service::initSevmgrService() {
174 if (_sevmgrServiceContext == NULL) {
175 throw stdair::NonInitialisedServiceException (
"The Sevmgr service has "
176 "not been initialised");
178 assert (_sevmgrServiceContext != NULL);
194 if (_sevmgrServiceContext == NULL) {
195 throw stdair::NonInitialisedServiceException (
"The Sevmgr service has "
196 "not been initialised");
198 assert (_sevmgrServiceContext != NULL);
203 stdair::STDAIR_Service& lSTDAIR_Service =
204 lSEVMGR_ServiceContext.getSTDAIR_Service();
207 stdair::EventQueue& lEventQueue = lSTDAIR_Service.getEventQueue();
215 popEvent (stdair::EventStruct& ioEventStruct)
const {
218 assert (_sevmgrServiceContext != NULL);
222 stdair::STDAIR_Service& lSTDAIR_Service =
223 lSEVMGR_ServiceContext.getSTDAIR_Service();
226 stdair::EventQueue& lQueue = lSTDAIR_Service.getEventQueue();
229 return lQueue.popEvent (ioEventStruct);
236 assert (_sevmgrServiceContext != NULL);
238 *_sevmgrServiceContext;
241 stdair::STDAIR_Service& lSTDAIR_Service =
242 lSEVMGR_ServiceContext.getSTDAIR_Service();
245 const stdair::EventQueue& lQueue = lSTDAIR_Service.getEventQueue();
258 assert (_sevmgrServiceContext != NULL);
260 *_sevmgrServiceContext;
263 stdair::STDAIR_Service& lSTDAIR_Service =
264 lSEVMGR_ServiceContext.getSTDAIR_Service();
266 stdair::EventQueue& lQueue = lSTDAIR_Service.getEventQueue();