hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxResultData.hpp
Go to the documentation of this file.
1 
14 #ifndef SPHINX_RESULT_DATA_HPP
15 #define SPHINX_RESULT_DATA_HPP
16 
17 #include <iostream>
18 #include <vector>
19 #include <map>
20 #include <utility>
21 #include <stdint.h>
22 
23 #include "SphinxMatchInfo.hpp"
24 #include "SphinxRequestInfo.hpp"
25 
26 namespace HCE
27 {
28 namespace sphinx
29 {
30 //-----------------------------------------------------------------------------
32 
33 struct HexString
34 {
35  unsigned long long value;
36  unsigned long long length;
37 public:
38  HexString(unsigned long long value_, unsigned long long length_=HEX_STRING_LENGTH) : value(value_), length(length_) {}
39 
40  friend std::ostream& operator << (std::ostream& os, const HexString& rhs);
41 };
42 //-----------------------------------------------------------------------------
43 std::string toHexString(unsigned long long value, unsigned long long length=HEX_STRING_LENGTH);
44 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 {
48 public:
49  SphinxResultData(void);
50  explicit SphinxResultData(size_t matchesCount);
51  SphinxResultData(size_t matchesCount, size_t attributesCount);
52  ~SphinxResultData(void);
53 
54  void addMatchInfo(const SphinxMatchInfo& match);
55  void addMatchInfo(SphinxMatchInfo&& match);
56 
57  size_t getMatchInfoCount(void) const;
58  const SphinxMatchInfo& getMatchInfoItem(size_t index) const;
59  void setMatchInfoItem(size_t index, const SphinxMatchInfo& match);
60  void setMatchInfoItem(size_t index, SphinxMatchInfo&& match);
61 
62  void addRequestInfo(const SphinxRequestInfo& request);
63  void addRequestInfo(SphinxRequestInfo&& request);
64 
65  size_t getRequestInfoCount(void) const;
66  const SphinxRequestInfo& getRequestInfoItem(size_t index) const;
67  void setRequestInfoItem(size_t index, const SphinxRequestInfo& request);
68  void setRequestInfoItem(size_t index, SphinxRequestInfo&& request);
69 
70  void clear(void);
71  void reset(void);
72  void resize(size_t);
73  void resize(size_t , size_t);
74 
75  void clearRequestInfo(void);
76 
77  void dump(std::ostream& os) const;
78 private:
79  std::vector<SphinxResultDataItem<SphinxMatchInfo> > matchInfoList;
80  std::vector<SphinxResultDataItem<SphinxRequestInfo> > requestInfoList;
81 
82  friend std::ostream& operator << (std::ostream& os, const SphinxResultData& resultData);
83 };
84 //-----------------------------------------------------------------------------
85 //-----------------------------------------------------------------------------
86 } // namespace sphinx
87 } // namespace HCE
88 
89 #endif // SPHINX_RESULT_DATA_HPP