Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00039
00040 #ifndef __SPHINXVALUE_H__
00041 #define __SPHINXVALUE_H__
00042
00043 #include <vector>
00044 #include <sphinxclient/error.h>
00045 #include <stdint.h>
00046
00047 namespace Sphinx
00048 {
00049
00053 enum ValueType_t {
00054 VALUETYPE_UINT32 = 0,
00055 VALUETYPE_FLOAT = 1,
00056 VALUETYPE_VECTOR = 2,
00057 VALUETYPE_UINT64 = 3,
00058 VALUETYPE_STRING = 4
00059 };
00060
00061 class ValueBase_t;
00062
00070 class Value_t {
00071 protected:
00072 ValueBase_t *value;
00073 void clear();
00074 void makeCopy(const Value_t&);
00075
00076 public:
00077 Value_t() : value(0) {}
00079 Value_t(uint32_t v);
00081 Value_t(float v);
00083 Value_t(const std::vector<Value_t> &v);
00085 Value_t(uint64_t v);
00087 Value_t(const std::string &v);
00088
00089 ~Value_t(){ clear(); }
00090
00092 Value_t(const Value_t &v){ makeCopy(v); }
00094 Value_t & operator = (const Value_t&);
00095
00098 inline bool isValid() const { return value; }
00099
00106 ValueType_t getValueType() const;
00107
00113 operator uint32_t () const throw (ValueTypeError_t);
00114
00120 operator const std::vector<Value_t>& () const throw (ValueTypeError_t);
00121
00127 operator float () const throw (ValueTypeError_t);
00128
00134 operator uint64_t () const throw (ValueTypeError_t);
00135
00141 operator const std::string & () const throw (ValueTypeError_t);
00142 };
00143
00144
00145 }
00146
00147 #endif