1.01.9
C++ Simulated Travel-Oriented Distribution System 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
// SIMCRS
7
#include <
simcrs/factory/FacBomAbstract.hpp
>
8
#include <
simcrs/factory/FacServiceAbstract.hpp
>
9
#include <
simcrs/factory/FacSupervisor.hpp
>
10
11
namespace
SIMCRS
{
12
13
FacSupervisor* FacSupervisor::_instance = NULL;
14
15
// //////////////////////////////////////////////////////////////////////
16
FacSupervisor::FacSupervisor
() {
17
}
18
19
// //////////////////////////////////////////////////////////////////////
20
FacSupervisor
&
FacSupervisor::instance
() {
21
if
(_instance == NULL) {
22
_instance =
new
FacSupervisor
();
23
}
24
25
return
*_instance;
26
}
27
28
// //////////////////////////////////////////////////////////////////////
29
void
FacSupervisor::
30
registerBomFactory
(
FacBomAbstract
* ioFacBomAbstract_ptr) {
31
_bomPool.push_back (ioFacBomAbstract_ptr);
32
}
33
34
// //////////////////////////////////////////////////////////////////////
35
void
FacSupervisor::
36
registerServiceFactory
(
FacServiceAbstract
* ioFacServiceAbstract_ptr) {
37
_svcPool.push_back (ioFacServiceAbstract_ptr);
38
}
39
40
// //////////////////////////////////////////////////////////////////////
41
FacSupervisor::~FacSupervisor
() {
42
cleanBomLayer
();
43
cleanServiceLayer
();
44
}
45
46
// //////////////////////////////////////////////////////////////////////
47
void
FacSupervisor::cleanBomLayer
() {
48
for
(BomFactoryPool_T::const_iterator itFactory = _bomPool.begin();
49
itFactory != _bomPool.end(); itFactory++) {
50
const
FacBomAbstract
* currentFactory_ptr = *itFactory;
51
assert (currentFactory_ptr != NULL);
52
53
delete
(currentFactory_ptr); currentFactory_ptr = NULL;
54
}
55
56
// Empty the pool of Bom Factories
57
_bomPool.clear();
58
}
59
60
// //////////////////////////////////////////////////////////////////////
61
void
FacSupervisor::cleanServiceLayer
() {
62
for
(ServiceFactoryPool_T::const_iterator itFactory = _svcPool.begin();
63
itFactory != _svcPool.end(); itFactory++) {
64
const
FacServiceAbstract
* currentFactory_ptr = *itFactory;
65
assert (currentFactory_ptr != NULL);
66
67
delete
(currentFactory_ptr); currentFactory_ptr = NULL;
68
}
69
70
// Empty the pool of Service Factories
71
_svcPool.clear();
72
}
73
74
// //////////////////////////////////////////////////////////////////////
75
void
FacSupervisor::cleanFactory
() {
76
if
(_instance != NULL) {
77
_instance->
cleanBomLayer
();
78
_instance->
cleanServiceLayer
();
79
}
80
delete
(_instance); _instance = NULL;
81
}
82
83
}
FacBomAbstract.hpp
FacServiceAbstract.hpp
FacSupervisor.hpp
SIMCRS::FacBomAbstract
Definition
FacBomAbstract.hpp:17
SIMCRS::FacServiceAbstract
Definition
FacServiceAbstract.hpp:16
SIMCRS::FacSupervisor
Definition
FacSupervisor.hpp:17
SIMCRS::FacSupervisor::registerServiceFactory
void registerServiceFactory(FacServiceAbstract *)
Definition
FacSupervisor.cpp:36
SIMCRS::FacSupervisor::registerBomFactory
void registerBomFactory(FacBomAbstract *)
Definition
FacSupervisor.cpp:30
SIMCRS::FacSupervisor::FacSupervisor
FacSupervisor()
Definition
FacSupervisor.cpp:16
SIMCRS::FacSupervisor::instance
static FacSupervisor & instance()
Definition
FacSupervisor.cpp:20
SIMCRS::FacSupervisor::~FacSupervisor
~FacSupervisor()
Definition
FacSupervisor.cpp:41
SIMCRS::FacSupervisor::cleanBomLayer
void cleanBomLayer()
Definition
FacSupervisor.cpp:47
SIMCRS::FacSupervisor::cleanFactory
static void cleanFactory()
Definition
FacSupervisor.cpp:75
SIMCRS::FacSupervisor::cleanServiceLayer
void cleanServiceLayer()
Definition
FacSupervisor.cpp:61
SIMCRS
Definition
BasConst.cpp:7
Generated on Sat Mar 23 2024 00:00:00 for SimCRS by
1.10.0