0.08.01
C++ Open Travel Request Parsing Library
Toggle main menu visibility
Loading...
Searching...
No Matches
FacPlace.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
// OpenTrep
7
#include <
opentrep/bom/Place.hpp
>
8
#include <
opentrep/factory/FacSupervisor.hpp
>
9
#include <
opentrep/factory/FacPlace.hpp
>
10
11
namespace
OPENTREP
{
12
13
FacPlace
* FacPlace::_instance = NULL;
14
15
// //////////////////////////////////////////////////////////////////////
16
FacPlace::FacPlace() {
17
}
18
19
// //////////////////////////////////////////////////////////////////////
20
FacPlace::FacPlace (
const
FacPlace
&) {
21
}
22
23
// //////////////////////////////////////////////////////////////////////
24
FacPlace::~FacPlace
() {
25
_instance = NULL;
26
}
27
28
// //////////////////////////////////////////////////////////////////////
29
FacPlace&
FacPlace::instance
() {
30
31
if
(_instance == NULL) {
32
_instance =
new
FacPlace();
33
assert (_instance != NULL);
34
35
FacSupervisor::instance
().
registerBomFactory
(_instance);
36
}
37
return
*_instance;
38
}
39
40
// //////////////////////////////////////////////////////////////////////
41
Place
&
FacPlace::create
() {
42
Place
* oPlace_ptr = NULL;
43
44
oPlace_ptr =
new
Place
();
45
assert (oPlace_ptr != NULL);
46
47
// The new object is added to the Bom pool
48
_pool
.push_back (oPlace_ptr);
49
50
return
*oPlace_ptr;
51
}
52
53
// //////////////////////////////////////////////////////////////////////
54
Place
&
FacPlace::create
(
const
LocationKey
& iLocationKey) {
55
Place
* oPlace_ptr = NULL;
56
57
oPlace_ptr =
new
Place
(iLocationKey);
58
assert (oPlace_ptr != NULL);
59
60
// The new object is added to the Bom pool
61
_pool
.push_back (oPlace_ptr);
62
63
return
*oPlace_ptr;
64
}
65
66
// //////////////////////////////////////////////////////////////////////
67
Place
&
FacPlace::create
(
const
Location
& iLocation) {
68
Place
* oPlace_ptr = NULL;
69
70
oPlace_ptr =
new
Place
(iLocation);
71
assert (oPlace_ptr != NULL);
72
73
// The new object is added to the Bom pool
74
_pool
.push_back (oPlace_ptr);
75
76
return
*oPlace_ptr;
77
}
78
79
// //////////////////////////////////////////////////////////////////////
80
Place
&
FacPlace::clone
(
const
Place
& iPlace) {
81
Place
* oPlace_ptr = NULL;
82
83
oPlace_ptr =
new
Place
(iPlace);
84
assert (oPlace_ptr != NULL);
85
86
// The new object is added to the Bom pool
87
_pool
.push_back (oPlace_ptr);
88
89
return
*oPlace_ptr;
90
}
91
92
// //////////////////////////////////////////////////////////////////////
93
void
FacPlace::initLinkWithExtraPlace
(
Place
& ioMainPlace,
94
Place
& ioExtraPlace) {
95
// Link the main Place to the extra Place, and vice versa
96
ioExtraPlace._mainPlace = &ioMainPlace;
97
98
// Add the extra Place to the main Place internal map (of extra
99
// Place objects)
100
ioMainPlace._extraPlaceList.push_back (&ioExtraPlace);
101
}
102
103
// //////////////////////////////////////////////////////////////////////
104
void
FacPlace::initLinkWithAlternatePlace
(
Place
& ioMainPlace,
105
Place
& ioAlternatePlace) {
106
// Link the main Place to the alternate Place, and vice versa
107
ioAlternatePlace._mainPlace = &ioMainPlace;
108
109
// Add the alternate Place to the main Place internal map (of
110
// alternate Place objects)
111
ioMainPlace._alternatePlaceList.push_back (&ioAlternatePlace);
112
}
113
114
}
FacPlace.hpp
FacSupervisor.hpp
Place.hpp
OPENTREP::FacBomAbstract::_pool
BomPool_T _pool
Definition
FacBomAbstract.hpp:53
OPENTREP::FacPlace
Definition
FacPlace.hpp:20
OPENTREP::FacPlace::create
Place & create()
Definition
FacPlace.cpp:41
OPENTREP::FacPlace::initLinkWithAlternatePlace
static void initLinkWithAlternatePlace(Place &, Place &)
Definition
FacPlace.cpp:104
OPENTREP::FacPlace::~FacPlace
virtual ~FacPlace()
Definition
FacPlace.cpp:24
OPENTREP::FacPlace::instance
static FacPlace & instance()
Definition
FacPlace.cpp:29
OPENTREP::FacPlace::initLinkWithExtraPlace
static void initLinkWithExtraPlace(Place &, Place &)
Definition
FacPlace.cpp:93
OPENTREP::FacPlace::clone
Place & clone(const Place &)
Definition
FacPlace.cpp:80
OPENTREP::FacSupervisor::instance
static FacSupervisor & instance()
Definition
FacSupervisor.cpp:21
OPENTREP::FacSupervisor::registerBomFactory
void registerBomFactory(FacBomAbstract *)
Definition
FacSupervisor.cpp:31
OPENTREP::Place
Class modelling a place/POR (point of reference).
Definition
Place.hpp:29
OPENTREP
Definition
BasChronometer.cpp:10
OPENTREP::LocationKey
Class modelling the primary key of a location/POR (point of reference).
Definition
LocationKey.hpp:29
OPENTREP::Location
Structure modelling a (geographical) location.
Definition
Location.hpp:25
Generated on
for OpenTREP by
1.17.0