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
SphinxResultDataItem.hpp
Go to the documentation of this file.
1 
14 #ifndef SPHINX_RESULT_DATA_ITEM_HPP
15 #define SPHINX_RESULT_DATA_ITEM_HPP
16 
17 #include <utility>
18 #include <iostream>
19 
20 namespace HCE
21 {
22 namespace sphinx
23 {
24 //-----------------------------------------------------------------------------
25 template <typename Elem>
27 {
28 public:
29  SphinxResultDataItem(void) : elem(), _IsEmpty(false) {}
30  explicit SphinxResultDataItem(const Elem& elem_);
31  explicit SphinxResultDataItem(Elem&& elem_);
35 
38 
39  void setItem(const Elem& elem_);
40  void setItem(Elem&& elem_);
41  const Elem& getItem(void) const {return elem;}
42  Elem& getItem(void) {return elem;}
43 
44  void isEmpty(bool isEmpty_) {_IsEmpty=isEmpty_;}
45  bool isEmpty(void) const {return _IsEmpty;}
46 protected:
47  Elem elem;
48  bool _IsEmpty;
49 };
50 //-----------------------------------------------------------------------------
51 //-----------------------------------------------------------------------------
52 template <typename Elem> SphinxResultDataItem<Elem>::SphinxResultDataItem(const Elem& elem_)
53  : elem(elem_), _IsEmpty(false)
54 {
55 }
56 //-----------------------------------------------------------------------------
57 template <typename Elem> SphinxResultDataItem<Elem>::SphinxResultDataItem(Elem&& elem_)
58  : elem(std::move(elem_)), _IsEmpty(false)
59 {
60 }
61 //-----------------------------------------------------------------------------
63  : elem(), _IsEmpty(false)
64 {
65  (*this) = rhs;
66 }
67 //-----------------------------------------------------------------------------
69  : elem(), _IsEmpty(false)
70 {
71  (*this) = std::forward<SphinxResultDataItem<Elem> >(rhs);
72 }
73 //-----------------------------------------------------------------------------
75 {
76  if (this!=&rhs)
77  {
78  elem = rhs.getItem();
79  _IsEmpty = rhs.isEmpty();
80  }
81  return *this;
82 }
83 //-----------------------------------------------------------------------------
85 {
86  if (this!=&rhs)
87  {
88  elem = std::move(rhs.getItem());
89  _IsEmpty = std::move(rhs.isEmpty());
90  }
91  return *this;
92 }
93 //-----------------------------------------------------------------------------
94 template <typename Elem> void SphinxResultDataItem<Elem>::setItem(const Elem& elem_)
95 {
96  elem=elem_;
97  _IsEmpty = false;
98 }
99 //-----------------------------------------------------------------------------
100 template <typename Elem> void SphinxResultDataItem<Elem>::setItem(Elem&& elem_)
101 {
102  elem=std::move(elem_);
103  _IsEmpty = false;
104 }
105 //-----------------------------------------------------------------------------
106 //-----------------------------------------------------------------------------
107 } // namespace sphinx
108 } // namespace HCE
109 
110 #endif // SPHINX_RESULT_DATA_ITEM_HPP