OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultHolder.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_BOM_RESULTHOLDER_HPP
2 #define __OPENTREP_BOM_RESULTHOLDER_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // OpenTrep
11 
12 // Forward declarations
13 namespace Xapian {
14  class Database;
15 }
16 
17 namespace OPENTREP {
18 
19  // Forward declarations
20  class ResultCombination;
21  struct StringSet;
22 
26  class ResultHolder : public BomAbstract {
27  friend class FacResultCombination;
28  friend class FacResultHolder;
29  public:
30  // ////////////////////// Getters /////////////////////
34  const TravelQuery_T& getQueryString() const {
35  return _queryString;
36  }
37 
41  const ResultList_T& getResultList() const {
42  return _resultList;
43  }
44 
49  return _combinedWeight;
50  }
51 
56 
57 
58  public:
59  // ////////////////////// Setters /////////////////////
63  void setCombinedWeight (const Percentage_T& iPercentage) {
64  _combinedWeight = iPercentage;
65  }
66 
67 
68  public:
69  // /////////// Business methods ///////////
73  void displayXapianPercentages() const;
74 
78  void calculateEnvelopeWeights() const;
79 
84  void calculateCodeMatches() const;
85 
89  void calculatePageRanks() const;
90 
94  void calculateHeuristicWeights() const;
95 
100 
101 
102  public:
103  // /////////// Display support methods /////////
109  void toStream (std::ostream&) const;
110 
116  void fromStream (std::istream&);
117 
121  std::string toString() const;
122 
127  std::string describeKey() const;
128 
133  std::string describeShortKey() const;
134 
135 
136  private:
137  // ////////////// Constructors and Destructors /////////////
141  ResultHolder (const TravelQuery_T&, const Xapian::Database&);
145  ResultHolder();
149  ResultHolder (const ResultHolder&);
153  ~ResultHolder();
157  void init();
158 
159 
160  private:
161  // /////////////// Attributes ////////////////
165  ResultCombination* _resultCombination;
166 
170  const TravelQuery_T _queryString;
171 
175  const Xapian::Database& _database;
176 
180  ResultList_T _resultList;
181 
185  Percentage_T _combinedWeight;
186  };
187 
188 }
189 #endif // __OPENTREP_BOM_RESULTHOLDER_HPP
const ResultList_T & getResultList() const
void setCombinedWeight(const Percentage_T &iPercentage)
double Percentage_T
void fromStream(std::istream &)
void calculateCodeMatches() const
const Percentage_T & getCombinedWeight() const
void calculateHeuristicWeights() const
void calculatePageRanks() const
std::string describeShortKey() const
Class wrapping functions on a list of Result objects.
std::string describeKey() const
std::list< Result * > ResultList_T
Definition: ResultList.hpp:13
void calculateEnvelopeWeights() const
void displayXapianPercentages() const
Class wrapping functions on a list of ResultHolder objects.
std::string toString() const
Base class for the Business Object Model (BOM) layer.
Definition: BomAbstract.hpp:17
const TravelQuery_T & getQueryString() const
StringSet getCorrectedStringSet() const
Class holding a set of strings, e.g., {"rio", "de", "janeiro"}.
Definition: StringSet.hpp:19
std::string TravelQuery_T
void toStream(std::ostream &) const