UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tr_selector.hpp
1 /* tr_selector.hpp */
2 /* $Id$ */
3 #ifndef __tr_selector_hpp
4 #define __tr_selector_hpp
5 
6 #include <vector>
7 #include <string>
8 #include <iostream>
9 
10 #include <hds_db/base/tr_header.hpp>
11 
13 namespace hds
14 {
16  namespace db
17  {
20  {
23  TS_UNIQ = 2
24  };
25 
27  std::string toString(TrSelSortOp op);
28 
31  {
32  TS_EQ = 3,
33  TS_NEQ = 4,
34  TS_GT = 5,
35  TS_LT = 6
36  };
37 
39  std::string toString(TrSelMatchOp op);
40 
43  {
44  TS_RANGE = 7
45  };
46 
48  std::string toString(TrSelRangeOp op);
49 
50 
53  {
54  public:
55 
57  TrSelBaseRule();
58 
60  virtual ~TrSelBaseRule();
61 
63  virtual TrSelBaseRule* clone() const = 0;
64 
66  virtual int opType() const = 0;
67 
69  virtual TrHeaderAttrId hdrAttrId() const = 0;
70  };
71 
74  {
75  public:
76 
79  TrSelSortRule(TrSelSortOp op, TrHeaderAttrId hdr_attr_id);
80 
82  virtual ~TrSelSortRule();
83 
85  virtual TrSelBaseRule* clone() const;
86 
88  virtual int opType() const;
89 
91  TrHeaderAttrId hdrAttrId() const;
92 
93  protected:
94 
97 
99  TrHeaderAttrId m_hdr_attr_id;
100  };
101 
103  template <typename AttrT>
105  {
106  public:
107 
111  TrHeaderAttrId hdr_attr_id,
112  const AttrT &attr_val);
113 
117  TrHeaderAttrId hdr_attr_id,
118  std::vector<AttrT> &attr_vals);
119 
121  virtual ~TrSelMatchRule();
122 
124  virtual TrSelBaseRule* clone() const;
125 
127  virtual int opType() const;
128 
130  TrHeaderAttrId hdrAttrId() const;
131 
133  const std::vector<AttrT>& hdrAttrVals() const;
134 
135  protected:
136 
139 
142 
144  std::vector<AttrT> m_hdr_attr_vals;
145  };
146 
148  template <typename AttrT>
150  {
151  public:
152 
154  TrSelRangeRule(TrHeaderAttrId hdr_attr_id,
155  const AttrT &av1,
156  const AttrT &av2);
157 
159  virtual ~TrSelRangeRule();
160 
162  virtual TrSelBaseRule* clone() const;
163 
165  virtual int opType() const;
166 
168  TrHeaderAttrId hdrAttrId() const;
169 
171  const std::pair<AttrT, AttrT>& range() const;
172 
173  protected:
174 
177 
179  std::pair<AttrT, AttrT> m_range;
180  };
181 
184  {
185  public:
186 
188  TrSelector();
189 
191  TrSelector(const TrSelector &that);
192 
194  ~TrSelector();
195 
197  TrSelector& operator=(const TrSelector &that);
198 
199 
202 
203 
205  void clear();
206 
208  size_t rulesNum() const;
209 
211  const TrSelBaseRule* rule(size_t id) const;
212 
214  void info(std::ostream &stream = std::cout) const;
215 
216  protected:
217 
219  std::vector<TrSelBaseRule*> m_rules;
220  };
221  }; // db
222 }; // hds
223 
224 #include "tr_selector_inline.hpp"
225 
226 #endif /* tr_selector.hpp */
TrSelRangeRule(TrHeaderAttrId hdr_attr_id, const AttrT &av1, const AttrT &av2)
Definition: tr_selector_inline.hpp:57
virtual TrHeaderAttrId hdrAttrId() const =0
std::vector< TrSelBaseRule * > m_rules
Definition: tr_selector.hpp:219
Definition: tr_selector.hpp:35
TrHeaderAttrId hdrAttrId() const
Definition: tr_selector_inline.hpp:84
Definition: tr_selector.hpp:52
Definition: tr_selector.hpp:73
virtual ~TrSelRangeRule()
Definition: tr_selector_inline.hpp:66
TrSelRangeOp
Definition: tr_selector.hpp:42
TrSelector & operator<<(const TrSelBaseRule &r)
virtual TrSelBaseRule * clone() const
Definition: tr_selector_inline.hpp:31
std::string toString(OpenMode mode)
TrSelector & operator=(const TrSelector &that)
Definition: tr_selector.hpp:21
Definition: tr_selector.hpp:183
virtual TrSelBaseRule * clone() const
virtual ~TrSelMatchRule()
Definition: tr_selector_inline.hpp:25
Definition: tr_selector.hpp:22
TrSelMatchRule(TrSelMatchOp op, TrHeaderAttrId hdr_attr_id, const AttrT &attr_val)
Definition: tr_selector_inline.hpp:7
TrHeaderAttrId hdrAttrId() const
Definition: tr_selector_inline.hpp:43
TrHeaderAttrId
Definition: tr_header_context.hpp:16
Definition: tr_selector.hpp:104
virtual int opType() const =0
virtual int opType() const
Definition: tr_selector.hpp:23
TrSelMatchOp m_op
Definition: tr_selector.hpp:138
virtual TrSelBaseRule * clone() const
Definition: tr_selector_inline.hpp:72
const TrSelBaseRule * rule(size_t id) const
TrSelSortOp m_op
Definition: tr_selector.hpp:96
const std::pair< AttrT, AttrT > & range() const
Definition: tr_selector_inline.hpp:90
const std::vector< AttrT > & hdrAttrVals() const
Definition: tr_selector_inline.hpp:49
TrSelSortOp
Definition: tr_selector.hpp:19
Definition: tr_selector.hpp:32
Definition: tr_selector.hpp:44
TrSelMatchOp
Definition: tr_selector.hpp:30
TrHeaderAttrId m_hdr_attr_id
Definition: tr_selector.hpp:141
size_t rulesNum() const
TrHeaderAttrId hdrAttrId() const
TrSelSortRule(TrSelSortOp op, TrHeaderAttrId hdr_attr_id)
Definition: tr_selector.hpp:34
Definition: tr_selector.hpp:33
virtual int opType() const
Definition: tr_selector_inline.hpp:78
virtual int opType() const
Definition: tr_selector_inline.hpp:37
TrHeaderAttrId m_hdr_attr_id
Definition: tr_selector.hpp:176
void info(std::ostream &stream=std::cout) const
virtual TrSelBaseRule * clone() const =0
Definition: tr_selector.hpp:149