00001 // Copyright 2007, Massachusetts Institute of Technology. 00002 // The use of this code is permitted for research only. There is 00003 // absolutely no warranty for this software. 00004 // 00005 // Author: John Lee (jjl@mit.edu) 00006 // 00007 #ifndef HISTOGRAMS_BIN_H 00008 #define HISTOGRAMS_BIN_H 00009 00010 #include <iostream> 00011 #include "util/sparse-vector.h" 00012 #include "tree/sparse-tree-node.h" 00013 00014 namespace libpmk { 00016 00020 class Bin : public SparseTreeNode { 00021 public: 00022 Bin(); 00023 Bin(const LargeIndex& index); 00024 virtual ~Bin() { } 00025 00027 void set_size(double size) { size_ = size; } 00028 00030 double size() const { return size_; } 00031 00033 void set_count(double count) { count_ = count; } 00034 00036 double count() const { return count_; } 00037 00038 virtual void ReadData(istream& input_stream); 00039 virtual void WriteData(ostream& output_stream) const; 00040 00042 00046 virtual void Combine(const SparseTreeNode& other); 00047 00048 private: 00049 double size_; 00050 double count_; 00051 }; 00052 } // namespace libpmk 00053 #endif // HISTOGRAMS_BIN_H