OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
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
13
14namespace OPENTREP {
15
16 // //////////////////////////////////////////////////////////////////////
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}
Base class for the Business Object Model (BOM) layer.
static std::size_t getID(const BomAbstract *)
static std::string getIDString(const BomAbstract *)