SimCRS Logo  1.01.8
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
10
11namespace SIMCRS {
12
13 FacSupervisor* FacSupervisor::_instance = NULL;
14
15 // //////////////////////////////////////////////////////////////////////
17 }
18
19 // //////////////////////////////////////////////////////////////////////
21 if (_instance == NULL) {
22 _instance = new FacSupervisor();
23 }
24
25 return *_instance;
26 }
27
28 // //////////////////////////////////////////////////////////////////////
30 registerBomFactory (FacBomAbstract* ioFacBomAbstract_ptr) {
31 _bomPool.push_back (ioFacBomAbstract_ptr);
32 }
33
34 // //////////////////////////////////////////////////////////////////////
36 registerServiceFactory (FacServiceAbstract* ioFacServiceAbstract_ptr) {
37 _svcPool.push_back (ioFacServiceAbstract_ptr);
38 }
39
40 // //////////////////////////////////////////////////////////////////////
44 }
45
46 // //////////////////////////////////////////////////////////////////////
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 // //////////////////////////////////////////////////////////////////////
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 // //////////////////////////////////////////////////////////////////////
76 if (_instance != NULL) {
77 _instance->cleanBomLayer();
78 _instance->cleanServiceLayer();
79 }
80 delete (_instance); _instance = NULL;
81 }
82
83}
void registerServiceFactory(FacServiceAbstract *)
void registerBomFactory(FacBomAbstract *)
static FacSupervisor & instance()
static void cleanFactory()