00001
00002
00003
00004 #ifndef AITOOLS_INVERTEDINDEX_VALUE_HPP
00005 #define AITOOLS_INVERTEDINDEX_VALUE_HPP
00006
00007 #include "ByteBuffer.hpp"
00008 #include "Converter.hpp"
00009 #include <iostream>
00010
00011 namespace aitools {
00012 namespace invertedindex {
00013
00023 class Value {
00024
00025 protected:
00026
00030 static const size_t sizeof_int8_t = sizeof(int8_t);
00031
00035 static const size_t sizeof_size_t = sizeof(size_t);
00036
00040 static int tmp_int;
00041
00042 public:
00043
00047 Value() {};
00048
00052 virtual ~Value() {};
00053
00054 public:
00055
00059 virtual void clear() = 0;
00060
00064 virtual inline double score() const = 0;
00065
00069 virtual void parse(std::istream& is) = 0;
00070
00074 virtual void print(std::ostream& os) const = 0;
00075
00079 virtual void to_bytes(ByteBuffer& buffer) const = 0;
00080
00084 virtual void wrap(const char* data, size_t size) = 0;
00085
00089 void wrap(const ByteBuffer& buffer);
00090
00091 };
00092
00093 }
00094 }
00095
00096 namespace std {
00097
00098 istream&
00099 operator>>(istream& is, aitools::invertedindex::Value& value);
00100
00101 ostream&
00102 operator<<(ostream& os, const aitools::invertedindex::Value& value);
00103
00104 }
00105
00106 #endif // AITOOLS_INVERTEDINDEX_VALUE_HPP