StdAir Logo  1.00.12
C++ Standard Airline IT Object Library
Loading...
Searching...
No Matches
FacSupervisor.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6// StdAir
12
13namespace stdair {
14
15 FacSupervisor* FacSupervisor::_instance = NULL;
16
17 // //////////////////////////////////////////////////////////////////////
19 if (_instance == NULL) {
20 _instance = new FacSupervisor();
21 }
22
23 return *_instance;
24 }
25
26 // //////////////////////////////////////////////////////////////////////
31 }
32
33 // //////////////////////////////////////////////////////////////////////
35 _persistentBomPool.push_back (ioFac_ptr);
36 }
37
38 // //////////////////////////////////////////////////////////////////////
40 _cloneBomPool.push_back (ioFac_ptr);
41 }
42
43 // //////////////////////////////////////////////////////////////////////
45 _svcPool.push_back (ioFac_ptr);
46 }
47
48 // //////////////////////////////////////////////////////////////////////
50 for (PersistentBomFactoryPool_T::const_iterator itFactory = _persistentBomPool.begin();
51 itFactory != _persistentBomPool.end(); itFactory++) {
52 const FacAbstract* currentFactory_ptr = *itFactory;
53 assert (currentFactory_ptr != NULL);
54
55 delete (currentFactory_ptr); currentFactory_ptr = NULL;
56 }
57 // Empty the pool of BOM factories
58 _persistentBomPool.clear();
59 }
60
61 // //////////////////////////////////////////////////////////////////////
63 for (CloneBomFactoryPool_T::const_iterator itFactory = _cloneBomPool.begin();
64 itFactory != _cloneBomPool.end(); itFactory++) {
65 const FacAbstract* currentFactory_ptr = *itFactory;
66 assert (currentFactory_ptr != NULL);
67
68 delete (currentFactory_ptr); currentFactory_ptr = NULL;
69 }
70
71 // Empty the pool of BOM factories
72 _cloneBomPool.clear();
73 }
74
75 // //////////////////////////////////////////////////////////////////////
77 for (ServiceFactoryPool_T::const_iterator itFactory = _svcPool.begin();
78 itFactory != _svcPool.end(); itFactory++) {
79 const FacServiceAbstract* currentFactory_ptr = *itFactory;
80 assert (currentFactory_ptr != NULL);
81
82 delete (currentFactory_ptr); currentFactory_ptr = NULL;
83 }
84
85 // Empty the pool of Service Factories
86 _svcPool.clear();
87 }
88
89 // //////////////////////////////////////////////////////////////////////
91 // Clean the static instance of the log service
92 Logger::clean();
93 }
94
95 // //////////////////////////////////////////////////////////////////////
97 // Clean the static instance of the database service
98 DBSessionManager::clean();
99 }
100
101 // //////////////////////////////////////////////////////////////////////
103
104 // Clean the static instance of the database session manager
106
107 // Clean the static instance of the log service
109
110 // Clean the static instance of the FacSupervisor.
111 // This in turn will invoke the destructor (~FacSupervisor() method)
112 // of the static instance, thus cleaning both the BOM and service layers.
113 delete _instance; _instance = NULL;
114 }
115
116}
Handle on the StdAir library context.
void registerCloneBomFactory(FacAbstract *)
void registerPersistentBomFactory(FacAbstract *)
void registerServiceFactory(FacServiceAbstract *)
static void cleanLoggerService()
static void cleanDBSessionManager()
static FacSupervisor & instance()