www.pudn.com > libpmk.rar > point-set.h, change:2007-05-27,size:1634b

// Copyright 2007, Massachusetts Institute of Technology.
// The use of this code is permitted for research only. There is
// absolutely no warranty for this software.
// Author: John Lee (jjl@mit.edu)

#include <vector>
#include "point_set/feature.h"

using namespace std;

namespace libpmk {
/// A data structure representing a list of Feature vectors.
 * All features in the set must have the same dimension, and this is
 * determined when the PointSet is constructed. Features may be added,
 * removed, and replaced by index. Bounds checking is done
 * automatically, as is checking that any new Features added to the
 * PointSet have the same dimension.
class PointSet
   /// Creates an initially empty set (such that GetNumFeatures() == 0).
   PointSet(int feature_dim);
   int GetNumFeatures() const;
   int GetFeatureDim() const;

   /// Returns a copy of the feature at <index>.
   Feature GetFeature(int index) const;

   /// Returns a reference to the feature at <index>.
   Feature& operator[](int index);

   /// Returns a const reference to the feature at <index>.
   const Feature& operator[](int index) const;

   /// Adds a copy of the feature to the end of the list.
   void AddFeature(const Feature& feature);

   /// Removes the feature at <index>.
   void RemoveFeature(int index);

   /// Replaces the Feature at <index> with a copy of <feature>.
   void SetFeature(int index, const Feature& feature);

   int feature_dim_;
   vector<Feature> features_;
}  // namespace libpmk