point.h

Go to the documentation of this file.
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 POINT_SET_POINT_H
00008 #define POINT_SET_POINT_H
00009 
00010 #include <iostream>
00011 #include <vector>
00012 
00013 using namespace std;
00014 
00015 namespace libpmk {
00016 
00018 
00022 class Point {
00023 public:
00025   Point(int dim);
00026 
00027   Point(const Point& other);
00028   virtual ~Point() { }
00029 
00030   // Sets this point to be a copy of <other>.
00031   virtual void CopyFrom(const Point& other);
00032 
00034   int size() const { return features_.size(); }
00035 
00037   int point_dim() const { return size(); }
00038 
00040   float feature(int index) const;
00041 
00043   void set_feature(int index, float value);
00044 
00045   float weight() const { return weight_; }
00046   void set_weight(float new_weight) { weight_ = new_weight; }
00047 
00049   float& operator[](int index);
00050 
00052   float operator[](int index) const;
00053 
00055 
00064   virtual void WriteToStream(ostream& output_stream) const;
00065 
00067   virtual void ReadFromStream(istream& input_stream);
00068 
00069 protected:
00070   float weight_;
00071   vector<float> features_;
00072 };
00073 }  // namespace libpmk
00074 
00075 #endif  // POINT_SET_POINT_H

Generated on Fri Sep 21 11:39:04 2007 for libpmk2 by  doxygen 1.5.1