OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FacPlaceHolder.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // C
5 #include <cassert>
6 // OPENTREP
8 #include <opentrep/bom/Place.hpp>
12 
13 namespace 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  // //////////////////////////////////////////////////////////////////////
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 FacSupervisor & instance()
std::string describeShortKey() const
Definition: Place.hpp:1009
void registerBomFactory(FacBomAbstract *)
Class modelling a place/POR (point of reference).
Definition: Place.hpp:28
static FacPlaceHolder & instance()
static void initLinkWithPlace(PlaceHolder &, Place &)