Go to the documentation of this file.00001
00005
00006
00007
00008
00009 #include <cassert>
00010 #include <sstream>
00011
00012 #include <stdair/basic/BasConst_General.hpp>
00013 #include <stdair/bom/BomRoot.hpp>
00014 #include <stdair/bom/EventQueue.hpp>
00015 #include <stdair/factory/FacBom.hpp>
00016 #include <stdair/service/STDAIR_ServiceContext.hpp>
00017
00018 namespace stdair {
00019
00020
00021 STDAIR_ServiceContext::STDAIR_ServiceContext()
00022 : _bomRoot (NULL), _eventQueue (NULL),
00023 _initType (ServiceInitialisationType::NOT_YET_INITIALISED) {
00024
00025 init();
00026 }
00027
00028
00029 STDAIR_ServiceContext::
00030 STDAIR_ServiceContext (const STDAIR_ServiceContext& iServiceContext)
00031 : _bomRoot (iServiceContext._bomRoot),
00032 _eventQueue (iServiceContext._eventQueue),
00033 _initType (ServiceInitialisationType::NOT_YET_INITIALISED) {
00034 assert (false);
00035 }
00036
00037
00038 STDAIR_ServiceContext::~STDAIR_ServiceContext() {
00039 }
00040
00041
00042 void STDAIR_ServiceContext::init() {
00043
00044 initBomRoot();
00045
00046
00047 initEventQueue();
00048 }
00049
00050
00051 void STDAIR_ServiceContext::initBomRoot() {
00052 _bomRoot = &FacBom<BomRoot>::instance().create();
00053 }
00054
00055
00056 void STDAIR_ServiceContext::initEventQueue() {
00057
00058
00059 const EventQueueKey lKey ("EQ01");
00060
00061
00062 EventQueue& lEventQueue = FacBom<EventQueue>::instance().create (lKey);
00063
00064
00065 _eventQueue = &lEventQueue;
00066 }
00067
00068
00069 const std::string STDAIR_ServiceContext::shortDisplay() const {
00070 std::ostringstream oStr;
00071 oStr << "STDAIR_ServiceContext -- " << _initType
00072 << " -- DB: " << _dbParams;
00073 if (_eventQueue != NULL) {
00074 oStr << " -- Queue: " << _eventQueue->toString();
00075 }
00076 return oStr.str();
00077 }
00078
00079
00080 const std::string STDAIR_ServiceContext::display() const {
00081 std::ostringstream oStr;
00082 oStr << shortDisplay();
00083 return oStr.str();
00084 }
00085
00086
00087 const std::string STDAIR_ServiceContext::describe() const {
00088 return shortDisplay();
00089 }
00090
00091
00092 BomRoot& STDAIR_ServiceContext::getBomRoot() const {
00093 assert (_bomRoot != NULL);
00094 return *_bomRoot;
00095 }
00096
00097
00098 EventQueue& STDAIR_ServiceContext::getEventQueue() const {
00099 assert (_eventQueue != NULL);
00100 return *_eventQueue;
00101 }
00102
00103 }
00104