hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxRequestInfo.cpp
Go to the documentation of this file.
1 #include "SphinxRequestInfo.hpp"
2 
3 namespace HCE
4 {
5 namespace sphinx
6 {
7 //-----------------------------------------------------------------------------
9 : word(""), hits(0), docs(0)
10 {
11  (*this) = rhs;
12 }
13 //-----------------------------------------------------------------------------
15 : word(""), hits(0), docs(0)
16 {
17  (*this) = std::forward<WordInfo>(rhs);
18 }
19 //-----------------------------------------------------------------------------
21 {
22  if (this != &rhs)
23  {
24  word = rhs.word;
25  hits = rhs.hits;
26  docs = rhs.docs;
27  }
28  return *this;
29 }
30 //-----------------------------------------------------------------------------
32 {
33  if (this != &rhs)
34  {
35  word = std::move(rhs.word);
36  hits = std::move(rhs.hits);
37  docs = std::move(rhs.docs);
38  }
39  return *this;
40 }
41 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 : nodeName(""), query(""), queryId(0), maxResultsNumber(0), orderBy(0), total(0), totalFound(0), timeMsec(0), words()
45 {
46 }
47 //-----------------------------------------------------------------------------
49 : nodeName(""), query(""), queryId(0), maxResultsNumber(0), orderBy(0), total(0), totalFound(0), timeMsec(0), words(wordsCount)
50 {
51 }
52 //-----------------------------------------------------------------------------
54 : nodeName(""), query(""), queryId(0), maxResultsNumber(0), orderBy(0), total(0), totalFound(0), timeMsec(0), words(rhs.getWords().size())
55 {
56  (*this) = rhs;
57 }
58 //-----------------------------------------------------------------------------
60 : nodeName(""), query(""), queryId(0), maxResultsNumber(0), orderBy(0), total(0), totalFound(0), timeMsec(0), words(rhs.getWords().size())
61 {
62  (*this) = std::forward<SphinxRequestInfo>(rhs);
63 }
64 //-----------------------------------------------------------------------------
66 {
67  if (this != &rhs)
68  {
69  nodeName = rhs.getNodeName();
70  query = rhs.getQuery();
71  queryId = rhs.getQueryId();
72  maxResultsNumber = rhs.getMaxResultsNumber();
73  orderBy = rhs.getOrderBy();
74  total = rhs.getTotal();
75  totalFound = rhs.getTotalFound();
76  timeMsec = rhs.getTimeMsec();
77  words = rhs.getWords();
78  }
79  return *this;
80 }
81 //-----------------------------------------------------------------------------
83 {
84  if (this != &rhs)
85  {
86  nodeName = std::move(rhs.getNodeName());
87  query = std::move(rhs.getQuery());
88  queryId = std::move(rhs.getQueryId());
89  maxResultsNumber = std::move(rhs.getMaxResultsNumber());
90  orderBy = std::move(rhs.getOrderBy());
91  total = std::move(rhs.getTotal());
92  totalFound = std::move(rhs.getTotalFound());
93  timeMsec = std::move(rhs.getTimeMsec());
94  words = std::move(rhs.getWords());
95  }
96  return *this;
97 }
98 //-----------------------------------------------------------------------------
100 {
101  words.push_back(SphinxResultDataItem<WordInfo>(wordInfo));
102 }
103 //-----------------------------------------------------------------------------
105 {
106  words.push_back(SphinxResultDataItem<WordInfo>(std::forward<WordInfo>(wordInfo)));
107 }
108 //-----------------------------------------------------------------------------
109 void SphinxRequestInfo::addWordInfo(const std::string& word, unsigned int hits, unsigned int docs)
110 {
111  addWordInfo(std::forward<WordInfo>(WordInfo(word, hits, docs)));
112 }
113 //-----------------------------------------------------------------------------
115 {
116  size_t count = words.size();
117  for (size_t i=0;i<count;++i)
118  {
119  if (words[i].isEmpty())
120  {
121  count = i;
122  break;
123  }
124  }
125  return count;
126 }
127 //-----------------------------------------------------------------------------
129 {
130  return words[index].getItem();
131 }
132 //-----------------------------------------------------------------------------
133 // cppcheck-suppress unusedFunction
135 {
136  words[index].setItem(word);
137 }
138 //-----------------------------------------------------------------------------
140 {
141  words[index].setItem(std::move(word));
142 }
143 //-----------------------------------------------------------------------------
145 {
146  nodeName.clear();
147  query.clear();
148  queryId = 0;
149  maxResultsNumber = 0;
150  orderBy = 0;
151  total = 0;
152  totalFound = 0;
153  timeMsec = 0;
154  words.clear();
155 }
156 //-----------------------------------------------------------------------------
158 {
159  nodeName.clear();
160  query.clear();
161  queryId = 0;
162  maxResultsNumber = 0;
163  orderBy = 0;
164  total = 0;
165  totalFound = 0;
166  timeMsec = 0;
167  const size_t count = words.size();
168  for (size_t i=0;i<count;++i)
169  words[i].isEmpty(true);
170 }
171 //-----------------------------------------------------------------------------
173 {
174  words.resize(sz);
175 }
176 //-----------------------------------------------------------------------------
177 //-----------------------------------------------------------------------------
178 } // namespace sphinx
179 } // namespace HCE