1.00.26
C++ Standard Airline IT Object Library
Toggle main menu visibility
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
7
#include <
stdair/factory/FacAbstract.hpp
>
8
#include <
stdair/service/FacServiceAbstract.hpp
>
9
#include <
stdair/service/FacSupervisor.hpp
>
10
#include <
stdair/service/Logger.hpp
>
11
#include <
stdair/service/DBSessionManager.hpp
>
12
13
namespace
stdair
{
14
15
FacSupervisor
* FacSupervisor::_instance = NULL;
16
17
// //////////////////////////////////////////////////////////////////////
18
FacSupervisor
&
FacSupervisor::instance
() {
19
if
(_instance == NULL) {
20
_instance =
new
FacSupervisor
();
21
}
22
23
return
*_instance;
24
}
25
26
// //////////////////////////////////////////////////////////////////////
27
FacSupervisor::~FacSupervisor
() {
28
cleanPersistentBomLayer
();
29
cleanCloneBomLayer
();
30
cleanServiceLayer
();
31
}
32
33
// //////////////////////////////////////////////////////////////////////
34
void
FacSupervisor::registerPersistentBomFactory
(
FacAbstract
* ioFac_ptr) {
35
_persistentBomPool.push_back (ioFac_ptr);
36
}
37
38
// //////////////////////////////////////////////////////////////////////
39
void
FacSupervisor::registerCloneBomFactory
(
FacAbstract
* ioFac_ptr) {
40
_cloneBomPool.push_back (ioFac_ptr);
41
}
42
43
// //////////////////////////////////////////////////////////////////////
44
void
FacSupervisor::registerServiceFactory
(
FacServiceAbstract
* ioFac_ptr) {
45
_svcPool.push_back (ioFac_ptr);
46
}
47
48
// //////////////////////////////////////////////////////////////////////
49
void
FacSupervisor::cleanPersistentBomLayer
() {
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
// //////////////////////////////////////////////////////////////////////
62
void
FacSupervisor::cleanCloneBomLayer
() {
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
// //////////////////////////////////////////////////////////////////////
76
void
FacSupervisor::cleanServiceLayer
() {
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
// //////////////////////////////////////////////////////////////////////
90
void
FacSupervisor::cleanLoggerService
() {
91
// Clean the static instance of the log service
92
Logger::clean();
93
}
94
95
// //////////////////////////////////////////////////////////////////////
96
void
FacSupervisor::cleanDBSessionManager
() {
97
// Clean the static instance of the database service
98
DBSessionManager::clean();
99
}
100
101
// //////////////////////////////////////////////////////////////////////
102
void
FacSupervisor::cleanAll
() {
103
104
// Clean the static instance of the database session manager
105
cleanDBSessionManager
();
106
107
// Clean the static instance of the log service
108
cleanLoggerService
();
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
}
FacAbstract.hpp
DBSessionManager.hpp
FacServiceAbstract.hpp
FacSupervisor.hpp
Logger.hpp
stdair
Handle on the StdAir library context.
Definition
BasChronometer.cpp:9
stdair::FacAbstract
Definition
FacAbstract.hpp:10
stdair::FacServiceAbstract
Definition
FacServiceAbstract.hpp:16
stdair::FacSupervisor
Definition
FacSupervisor.hpp:20
stdair::FacSupervisor::registerCloneBomFactory
void registerCloneBomFactory(FacAbstract *)
Definition
FacSupervisor.cpp:39
stdair::FacSupervisor::~FacSupervisor
~FacSupervisor()
Definition
FacSupervisor.cpp:27
stdair::FacSupervisor::cleanServiceLayer
void cleanServiceLayer()
Definition
FacSupervisor.cpp:76
stdair::FacSupervisor::cleanPersistentBomLayer
void cleanPersistentBomLayer()
Definition
FacSupervisor.cpp:49
stdair::FacSupervisor::registerPersistentBomFactory
void registerPersistentBomFactory(FacAbstract *)
Definition
FacSupervisor.cpp:34
stdair::FacSupervisor::registerServiceFactory
void registerServiceFactory(FacServiceAbstract *)
Definition
FacSupervisor.cpp:44
stdair::FacSupervisor::cleanLoggerService
static void cleanLoggerService()
Definition
FacSupervisor.cpp:90
stdair::FacSupervisor::cleanDBSessionManager
static void cleanDBSessionManager()
Definition
FacSupervisor.cpp:96
stdair::FacSupervisor::FacSupervisor
FacSupervisor()
Definition
FacSupervisor.hpp:120
stdair::FacSupervisor::instance
static FacSupervisor & instance()
Definition
FacSupervisor.cpp:18
stdair::FacSupervisor::cleanAll
static void cleanAll()
Definition
FacSupervisor.cpp:102
stdair::FacSupervisor::cleanCloneBomLayer
void cleanCloneBomLayer()
Definition
FacSupervisor.cpp:62
Generated for StdAir by
1.17.0