OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PlaceHolder.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // C
5 #include <cassert>
6 #include <sstream>
7 // OpenTREP
8 #include <opentrep/bom/Place.hpp>
11 
12 namespace OPENTREP {
13 
14  // //////////////////////////////////////////////////////////////////////
15  PlaceHolder::PlaceHolder () {
16  init();
17  }
18 
19  // //////////////////////////////////////////////////////////////////////
20  PlaceHolder::~PlaceHolder () {
21  }
22 
23  // //////////////////////////////////////////////////////////////////////
24  void PlaceHolder::init () {
25  _placeList.clear();
26  _placeOrderedList.clear();
27  }
28 
29  // //////////////////////////////////////////////////////////////////////
30  std::string PlaceHolder::describeShortKey() const {
31  std::ostringstream oStr;
32  return oStr.str();
33  }
34 
35  // //////////////////////////////////////////////////////////////////////
36  std::string PlaceHolder::describeKey() const {
37  return describeShortKey();
38  }
39 
40  // //////////////////////////////////////////////////////////////////////
41  std::string PlaceHolder::toString() const {
42  std::ostringstream oStr;
43  oStr << describeShortKey() << std::endl;
44 
45  for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
46  itPlace != _placeOrderedList.end(); ++itPlace) {
47  const Place* lPlace_ptr = *itPlace;
48  assert (lPlace_ptr != NULL);
49 
50  oStr << lPlace_ptr->toString() << std::endl;
51  }
52 
53  return oStr.str();
54  }
55 
56  // //////////////////////////////////////////////////////////////////////
57  std::string PlaceHolder::toShortString() const {
58  std::ostringstream oStr;
59  oStr << describeShortKey() << std::endl;
60 
61  for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
62  itPlace != _placeOrderedList.end(); ++itPlace) {
63  const Place* lPlace_ptr = *itPlace;
64  assert (lPlace_ptr != NULL);
65 
66  oStr << lPlace_ptr->toShortString() << std::endl;
67  }
68 
69  return oStr.str();
70  }
71 
72  // //////////////////////////////////////////////////////////////////////
73  void PlaceHolder::toStream (std::ostream& ioOut) const {
74  ioOut << toString();
75  }
76 
77  // //////////////////////////////////////////////////////////////////////
78  void PlaceHolder::fromStream (std::istream& ioIn) {
79  }
80 
81  // //////////////////////////////////////////////////////////////////////
82  void PlaceHolder::createLocations (LocationList_T& ioLocationList) const {
83 
84  for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
85  itPlace != _placeOrderedList.end(); ++itPlace) {
86  Place* lPlace_ptr = *itPlace;
87  assert (lPlace_ptr != NULL);
88 
89  const Location& lLocation = lPlace_ptr->completeLocation();
90  ioLocationList.push_back (lLocation);
91  }
92  }
93 
94 
95 }
std::string toShortString() const
Definition: PlaceHolder.cpp:57
void createLocations(LocationList_T &) const
Definition: PlaceHolder.cpp:82
Structure modelling a (geographical) location.
Definition: Location.hpp:24
std::string toString() const
Definition: PlaceHolder.cpp:41
const Location & completeLocation()
Definition: Place.cpp:699
Class modelling a place/POR (point of reference).
Definition: Place.hpp:28
std::list< Location > LocationList_T
void fromStream(std::istream &ioIn)
Definition: PlaceHolder.cpp:78
std::string toString() const
Definition: Place.cpp:83
std::string toShortString() const
Definition: Place.cpp:124
std::string describeKey() const
Definition: PlaceHolder.cpp:36
std::string describeShortKey() const
Definition: PlaceHolder.cpp:30
void toStream(std::ostream &ioOut) const
Definition: PlaceHolder.cpp:73