OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
World.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // C
5 #include <assert.h>
6 // STL
7 #include <sstream>
8 // OpenTrep
9 #include <opentrep/bom/Place.hpp>
10 #include <opentrep/bom/World.hpp>
12 
13 namespace OPENTREP {
14 
15  // //////////////////////////////////////////////////////////////////////
16  World::World () {
17  }
18 
19  // //////////////////////////////////////////////////////////////////////
20  World::World (const World& iWorld) {
21  }
22 
23  // //////////////////////////////////////////////////////////////////////
24  World::~World () {
25  }
26 
27  // //////////////////////////////////////////////////////////////////////
28  std::string World::describeShortKey() const {
29  std::ostringstream oStr;
30  return oStr.str();
31  }
32 
33  // //////////////////////////////////////////////////////////////////////
34  std::string World::describeKey() const {
35  return describeShortKey();
36  }
37 
38  // //////////////////////////////////////////////////////////////////////
39  std::string World::toString() const {
40  return describeKey();
41  }
42 
43  // //////////////////////////////////////////////////////////////////////
44  void World::toStream (std::ostream& ioOut) const {
45  ioOut << toString();
46  }
47 
48  // //////////////////////////////////////////////////////////////////////
49  void World::fromStream (std::istream& ioIn) {
50  }
51 
52  // //////////////////////////////////////////////////////////////////////
53  std::string World::shortDisplay() const {
54  std::ostringstream oStr;
55  oStr << describeKey();
56  return oStr.str();
57  }
58 
59  // //////////////////////////////////////////////////////////////////////
60  std::string World::display() const {
61  std::ostringstream oStr;
62 
63  oStr << shortDisplay();
64 
65  for (PlaceOrderedList_T::const_iterator itPlace = _placeOrderedList.begin();
66  itPlace != _placeOrderedList.end(); ++itPlace) {
67  const Place* lPlace_ptr = *itPlace;
68  assert (lPlace_ptr != NULL);
69 
70  oStr << lPlace_ptr->display ();
71  }
72 
73  return oStr.str();
74  }
75 
76  // //////////////////////////////////////////////////////////////////////
79  BomAbstract* oBom_ptr = NULL;
80 
81  GenericBomList_T::const_iterator itBom = _genericBomList.find (iDocID);
82  if (itBom != _genericBomList.end()) {
83  const GenericBom_T& lGenericBom = itBom->second;
84  oBomType = lGenericBom.first;
85  oBom_ptr = lGenericBom.second;
86  }
87 
88  return GenericBom_T (oBomType, oBom_ptr);
89  }
90 
91 }
std::pair< BomType::EN_BomType, BomAbstract * > GenericBom_T
Definition: GenericBom.hpp:15
GenericBom_T getGenericBom(const XapianDocID_T &iDocID) const
Definition: World.cpp:77
std::string describeShortKey() const
Definition: World.cpp:28
std::string describeKey() const
Definition: World.cpp:34
Class modelling a place/POR (point of reference).
Definition: Place.hpp:28
void fromStream(std::istream &)
Definition: World.cpp:49
void toStream(std::ostream &) const
Definition: World.cpp:44
std::string display() const
Definition: Place.cpp:211
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:17
std::string display() const
Definition: World.cpp:60
std::string toString() const
Definition: World.cpp:39
std::string shortDisplay() const
Definition: World.cpp:53