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