1.00.15
C++ Simulated Airline Inventory Management System Library
Toggle main menu visibility
Loading...
Searching...
No Matches
FacBomAbstract.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
// Boost (STL Extension)
8
#include <boost/functional/hash/hash.hpp>
9
// Airinv
10
#include <
airinv/bom/BomAbstract.hpp
>
11
#include <
airinv/factory/FacBomAbstract.hpp
>
12
13
namespace
AIRINV
{
14
15
// //////////////////////////////////////////////////////////////////////
16
FacBomAbstract::~FacBomAbstract
() {
17
clean ();
18
}
19
20
// //////////////////////////////////////////////////////////////////////
21
void
FacBomAbstract::clean() {
22
for
(BomPool_T::iterator itBom =
_pool
.begin();
23
itBom !=
_pool
.end(); itBom++) {
24
BomAbstract
* currentBom_ptr = *itBom;
25
assert (currentBom_ptr != NULL);
26
27
delete
(currentBom_ptr); currentBom_ptr = NULL;
28
}
29
30
// Empty the pool of Factories
31
_pool
.clear();
32
}
33
34
// //////////////////////////////////////////////////////////////////////
35
std::size_t
FacBomAbstract::getID
(
const
BomAbstract
* iBomAbstract_ptr) {
36
const
void
* lPtr = iBomAbstract_ptr;
37
boost::hash<const void*> ptr_hash;
38
const
std::size_t lID = ptr_hash (lPtr);
39
return
lID;
40
}
41
42
// //////////////////////////////////////////////////////////////////////
43
std::size_t
FacBomAbstract::getID
(
const
BomAbstract
& iBomAbstract) {
44
return
getID
(&iBomAbstract);
45
}
46
47
// //////////////////////////////////////////////////////////////////////
48
std::string
FacBomAbstract::getIDString
(
const
BomAbstract
* iBomAbstract_ptr) {
49
const
std::size_t lID =
getID
(iBomAbstract_ptr);
50
std::ostringstream oStr;
51
oStr << lID;
52
return
oStr.str();
53
}
54
55
// //////////////////////////////////////////////////////////////////////
56
std::string
FacBomAbstract::getIDString
(
const
BomAbstract
& iBomAbstract) {
57
return
getIDString
(&iBomAbstract);
58
}
59
60
}
BomAbstract.hpp
FacBomAbstract.hpp
AIRINV::BomAbstract
Definition
BomAbstract.hpp:14
AIRINV::FacBomAbstract::getIDString
static std::string getIDString(const BomAbstract *)
Definition
FacBomAbstract.cpp:48
AIRINV::FacBomAbstract::_pool
BomPool_T _pool
Definition
FacBomAbstract.hpp:53
AIRINV::FacBomAbstract::~FacBomAbstract
virtual ~FacBomAbstract()
Definition
FacBomAbstract.cpp:16
AIRINV::FacBomAbstract::getID
static std::size_t getID(const BomAbstract *)
Definition
FacBomAbstract.cpp:35
AIRINV
Definition
AIRINV_Master_Service.hpp:38
Generated on
for AirInv by
1.17.0