ScaleOut Native C++ API Library  5.1
 All Classes Functions Variables Enumerations Enumerator Friends
value_operand.h
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <stdint.h>
6 #include <boost/shared_ptr.hpp>
7 
8 #include "soss_client/filter.h"
9 #include "soss_client/query_expression.h"
10 #include "soss_client/comparison_expression_operand.h"
11 #include "soss_client/internal/index_value_writer.h"
12 
13 namespace sosscli {
14 
15 namespace internal { class ValueHolder; }
16 class ReferenceOperand;
17 
20 {
21 
22 public:
23  ValueOperand(std::string const & value);
24  ValueOperand(char const * value);
25  ValueOperand(uint8_t const * value, size_t length);
26  ValueOperand(std::vector<uint8_t> const & value);
27  ValueOperand(std::vector<uint8_t> const & value, int type_code);
28 
29  ValueOperand(int32_t value);
30  ValueOperand(uint32_t value);
31  ValueOperand(int64_t value);
32  ValueOperand(uint64_t value);
33  ValueOperand(double value);
34  ValueOperand(float value);
35  ValueOperand(bool value);
36 
37  Filter operator ==(ReferenceOperand const & field_ref);
38  Filter operator !=(ReferenceOperand const & field_ref);
39  Filter operator >(ReferenceOperand const & field_ref);
40  Filter operator >=(ReferenceOperand const & field_ref);
41  Filter operator <(ReferenceOperand const & field_ref);
42  Filter operator <=(ReferenceOperand const & field_ref);
43 
44  int type_code() const;
45 
46  // todo: need to widen value to same width as any reference... But need to do
47  // that when we size things as well as when we push them out.
48 
49  int write_value(sosscli::internal::IndexValueWriter & writer) const;
50  void allocate_value(sosscli::internal::IndexValueWriter & writer) const;
51 
52  // ... or maybe ... (performs widening). but need equivalent when sizing.
53  // or, if we know the typecode already do we need to call into here to find
54  // out what size it will become?
55  int write_value_as(sosscli::internal::IndexValueWriter & writer, int type_code);
56 
57  virtual void accept(QueryExpression::Visitor & v) const;
58 
59  friend std::ostream & operator << (std::ostream & o, ValueOperand const & p);
60 private:
61  boost::shared_ptr<sosscli::internal::ValueHolder> value_p_;
62 };
63 }