OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
FacPlaceHolder.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// C
5#include <cassert>
6// OPENTREP
12
13namespace OPENTREP {
14
15 FacPlaceHolder* FacPlaceHolder::_instance = NULL;
16
17 // //////////////////////////////////////////////////////////////////////
18 FacPlaceHolder::FacPlaceHolder () {
19 }
20
21 // //////////////////////////////////////////////////////////////////////
22 FacPlaceHolder::FacPlaceHolder (const FacPlaceHolder&) {
23 }
24
25 // //////////////////////////////////////////////////////////////////////
27 _instance = NULL;
28 }
29
30 // //////////////////////////////////////////////////////////////////////
31 FacPlaceHolder& FacPlaceHolder::instance () {
32
33 if (_instance == NULL) {
34 _instance = new FacPlaceHolder();
35 assert (_instance != NULL);
36
38 }
39 return *_instance;
40 }
41
42 // //////////////////////////////////////////////////////////////////////
44 PlaceHolder* oPlaceHolder_ptr = NULL;
45
46 oPlaceHolder_ptr = new PlaceHolder ();
47 assert (oPlaceHolder_ptr != NULL);
48
49 // The new object is added to the Bom pool
50 _pool.push_back (oPlaceHolder_ptr);
51
52 return *oPlaceHolder_ptr;
53 }
54
55 // //////////////////////////////////////////////////////////////////////
57 Place& ioPlace) {
58 // Link the PlaceHolder to the Place, and vice versa
59 ioPlace._placeHolder = &ioPlaceHolder;
60
61 // Add the Place to the PlaceHolder internal map (of Place objects)
62 // const bool insertSucceeded =
63 ioPlaceHolder._placeList.
64 insert (PlaceList_T::value_type (ioPlace.describeShortKey(), &ioPlace));
65
66// if (insertSucceeded == false) {
67// OPENTREP_LOG_ERROR ("Insertion failed for "
68// << ioPlaceHolder.describeKey()
69// << " and " << ioPlace.describeShortKey());
70// assert (insertSucceeded == true);
71// }
72
73 // Add the Place to the PlaceHolder internal list (of Place objects)
74 ioPlaceHolder._placeOrderedList.push_back (&ioPlace);
75 }
76
77}
static FacPlaceHolder & instance()
static void initLinkWithPlace(PlaceHolder &, Place &)
static FacSupervisor & instance()
void registerBomFactory(FacBomAbstract *)
Class modelling a place/POR (point of reference).
Definition Place.hpp:29
std::string describeShortKey() const
Definition Place.hpp:1060