00001
00002
00003
00004 #ifndef AITOOLS_INVERTEDINDEX_QUANTILE_HPP
00005 #define AITOOLS_INVERTEDINDEX_QUANTILE_HPP
00006
00007 #include <stdint.h>
00008 #include <istream>
00009 #include <ostream>
00010
00011 namespace aitools {
00012 namespace invertedindex {
00013
00024 class Quantile {
00025
00026 public:
00027
00028 enum Order
00029 {
00030 P10, P20, P30, P40, P50, P60, P70, P80, P90, P91,
00031 P92, P93, P94, P95, P96, P97, P98, P99, P100, COUNT
00032 };
00033
00034 public:
00035
00036 static const size_t size = COUNT * sizeof(uint32_t);
00037
00038 public:
00039
00040 Quantile();
00041
00042 Quantile(const Quantile& quantile);
00043
00044 ~Quantile();
00045
00046 public:
00047
00048 void clear();
00049
00050 uint32_t& at(Order order);
00051
00052 Quantile& operator=(const Quantile& quantile);
00053
00054 Quantile& operator+=(const Quantile& quantile);
00055
00056 void parse(std::istream& is);
00057
00058 void print(std::ostream& os) const;
00059
00060 uint32_t* values();
00061
00062 const uint32_t* values() const;
00063
00064 uint32_t get(Order order) const;
00065
00066 private:
00067
00068 uint32_t values_[COUNT];
00069
00070 };
00071
00072 }
00073 }
00074
00075 namespace std {
00076
00077 istream&
00078 operator>>(istream& is, aitools::invertedindex::Quantile& quantile);
00079
00080 ostream&
00081 operator<<(ostream& os, const aitools::invertedindex::Quantile& quantile);
00082
00083 ostream&
00084 operator<<(ostream& os, aitools::invertedindex::Quantile::Order order);
00085
00086 }
00087
00088 #endif // AITOOLS_INVERTEDINDEX_QUANTILE_HPP