hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SphinxFilters.hpp
Go to the documentation of this file.
1 
14 #ifndef SPHINX_FILTERS_HPP
15 #define SPHINX_FILTERS_HPP
16 
17 #include <iostream>
18 
19 #include "JsonSerializable.hpp"
20 
21 namespace HCE
22 {
23 namespace sphinx
24 {
25 //-----------------------------------------------------------------------------
27 {
28 public:
29  enum class FilterType
30  {
31  ftSimple=0,
32  ftRangeInteger=1,
33  ftRangeFloat=2,
34  ftSimpleMulti=3
35  };
36  enum class ExcludeType
37  {
38  etFalse=0,
39  etTrue=1
40  };
41 public:
42  SphinxFilter(void);
43  virtual ~SphinxFilter(void) {};
44 
45  void setFilterType(SphinxFilter::FilterType filterType_) {filterType=filterType_;}
47 
48  void setAttributeName(const std::string& attributeName_) {attributeName=attributeName_;}
49  std::string getAttributeName(void) const {return attributeName;}
50 
51  void addAttributeValue(const std::string& value);
52  void setAttributeValues(std::vector<std::string>& attributeValues_) {attributeValues=attributeValues_;}
53  std::vector<std::string>& getAttributeValues(void) {return attributeValues;}
54 
55  void setExcludeValue(SphinxFilter::ExcludeType excludeValue_) {excludeValue=excludeValue_;}
57 
58  SphinxFilter& operator=(const SphinxFilter& sphinxFilter);
59 protected:
61  std::string attributeName;
62  std::vector<std::string> attributeValues;
64 
65  friend std::ostream& operator << (std::ostream& os, const SphinxFilter& filters);
66 };
67 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
70 {
71 public:
72  SphinxFiltersArray(const std::string& json="");
73  virtual ~SphinxFiltersArray(void) {};
74 
75  void clear(void);
76 
77  bool serialize(std::string& json);
78  bool unserialize(const std::string& json);
79 
80  void addFilter(Poco::SharedPtr<SphinxFilter> pFilter);
81  std::vector<Poco::SharedPtr<SphinxFilter> >& getFilters(void) {return vecFilters;}
82 
83  SphinxFiltersArray& operator=(const SphinxFiltersArray& filtersArray);
84 private:
85  std::vector<Poco::SharedPtr<SphinxFilter> > vecFilters;
86 
87  friend std::ostream& operator << (std::ostream& os, const SphinxFiltersArray& filtersArray);
88  typedef IJsonSerializable inherited;
89 };
90 //-----------------------------------------------------------------------------
91 //-----------------------------------------------------------------------------
92 } /* namespace sphinx */
93 } /* namespace HCE */
94 #endif // SPHINX_FILTERS_HPP