SimCRS Logo  1.01.8
C++ Simulated Travel-Oriented Distribution System Library
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// Simcrs
12
13namespace SIMCRS {
14
15 // //////////////////////////////////////////////////////////////////////
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}
static std::size_t getID(const BomAbstract *)
static std::string getIDString(const BomAbstract *)