HCE project C++ developers source code library  1.1.1
HCE project developer library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxResultDataMemoryManager.cpp
Go to the documentation of this file.
2 
3 namespace HCE
4 {
5 namespace sphinx
6 {
7 //-----------------------------------------------------------------------------
9 : resultData(resultData_), matchesCount(0), attributesCount(0)
10 {
11 }
12 //-----------------------------------------------------------------------------
14 {
15 }
16 //-----------------------------------------------------------------------------
18 {
19  matchInfo.reset();
20 }
21 //-----------------------------------------------------------------------------
23 {
24  matchInfo.setDocId(docId);
25 }
26 //-----------------------------------------------------------------------------
28 {
29  matchInfo.setWeight(weight);
30 }
31 //-----------------------------------------------------------------------------
33 {
34  size_t index = matchInfo.getAttributesCount();
35  if (index < attributesCount)
36  matchInfo.setAttrItem(index, std::forward<AttrInfo>(attrInfo));
37  return (index < attributesCount);
38 }
39 //-----------------------------------------------------------------------------
41 {
42  size_t index = resultData.getMatchInfoCount();
43  if (index < matchesCount)
44  {
45  resultData.setMatchInfoItem(index, std::forward<SphinxMatchInfo>(matchInfo));
46  matchInfo.reset();
47  }
48  return (index < matchesCount);
49 }
50 //-----------------------------------------------------------------------------
52 {
53  matchInfo.reset();
54  resultData.reset();
55 }
56 //-----------------------------------------------------------------------------
57 void SphinxResultDataMemoryManager::resize(size_t matchesCount_, size_t attributesCount_)
58 {
59  matchInfo.resize(attributesCount_);
60  resultData.resize(matchesCount_, attributesCount_);
61  matchesCount = matchesCount_;
62  attributesCount = attributesCount_;
63 }
64 //-----------------------------------------------------------------------------
65 //-----------------------------------------------------------------------------
66 } // namespace sphinx
67 } // namespace HCE