StdAir Logo  0.45.1
C++ Standard Airline IT Object Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FacSupervisor.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 // StdAir
12 
13 namespace 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  // //////////////////////////////////////////////////////////////////////
28  cleanBomLayer();
30  }
31 
32  // //////////////////////////////////////////////////////////////////////
34  _bomPool.push_back (ioFac_ptr);
35  }
36 
37  // //////////////////////////////////////////////////////////////////////
39  _svcPool.push_back (ioFac_ptr);
40  }
41 
42  // //////////////////////////////////////////////////////////////////////
44  for (BomFactoryPool_T::const_iterator itFactory = _bomPool.begin();
45  itFactory != _bomPool.end(); itFactory++) {
46  const FacAbstract* currentFactory_ptr = *itFactory;
47  assert (currentFactory_ptr != NULL);
48 
49  delete (currentFactory_ptr); currentFactory_ptr = NULL;
50  }
51 
52  // Empty the pool of BOM factories
53  _bomPool.clear();
54  }
55 
56  // //////////////////////////////////////////////////////////////////////
58  for (ServiceFactoryPool_T::const_iterator itFactory = _svcPool.begin();
59  itFactory != _svcPool.end(); itFactory++) {
60  const FacServiceAbstract* currentFactory_ptr = *itFactory;
61  assert (currentFactory_ptr != NULL);
62 
63  delete (currentFactory_ptr); currentFactory_ptr = NULL;
64  }
65 
66  // Empty the pool of Service Factories
67  _svcPool.clear();
68  }
69 
70  // //////////////////////////////////////////////////////////////////////
72  // Clean the static instance of the log service
73  Logger::clean();
74  }
75 
76  // //////////////////////////////////////////////////////////////////////
78  // Clean the static instance of the database service
79  DBSessionManager::clean();
80  }
81 
82  // //////////////////////////////////////////////////////////////////////
84 
85  // Clean the static instance of the database session manager
87 
88  // Clean the static instance of the log service
90 
91  // Clean the static instance of the FacSupervisor.
92  // This in turn will invoke the destructor (~FacSupervisor() method)
93  // of the static instance, thus cleaning both the BOM and service layers.
94  delete _instance; _instance = NULL;
95  }
96 
97 }