#include <point-set.h>
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.
Public Member Functions | |
PointSet (int feature_dim) | |
Creates an initially empty set (such that GetNumFeatures() == 0). | |
int | GetNumFeatures () const |
int | GetFeatureDim () const |
Feature | GetFeature (int index) const |
Returns a copy of the feature at <index>. | |
Feature & | operator[] (int index) |
Returns a reference to the feature at <index>. | |
const Feature & | operator[] (int index) const |
Returns a const reference to the feature at <index>. | |
void | AddFeature (const Feature &feature) |
Adds a copy of the feature to the end of the list. | |
void | RemoveFeature (int index) |
Removes the feature at <index>. | |
void | SetFeature (int index, const Feature &feature) |
Replaces the Feature at <index> with a copy of <feature>. | |
void | WriteToStream (ostream &output_stream) const |
Writes the point set to a stream. | |
void | ReadFromStream (istream &input_stream) |
Reads the point set from a stream. |
PointSet | ( | int | feature_dim | ) |
Creates an initially empty set (such that GetNumFeatures() == 0).
int GetNumFeatures | ( | ) | const |
int GetFeatureDim | ( | ) | const |
Feature GetFeature | ( | int | index | ) | const |
Returns a copy of the feature at <index>.
Feature & operator[] | ( | int | index | ) |
Returns a reference to the feature at <index>.
const Feature & operator[] | ( | int | index | ) | const |
Returns a const reference to the feature at <index>.
void AddFeature | ( | const Feature & | feature | ) |
Adds a copy of the feature to the end of the list.
void RemoveFeature | ( | int | index | ) |
Removes the feature at <index>.
void SetFeature | ( | int | index, | |
const Feature & | feature | |||
) |
Replaces the Feature at <index> with a copy of <feature>.
void WriteToStream | ( | ostream & | output_stream | ) | const |
Writes the point set to a stream.
The format is as follows:
void ReadFromStream | ( | istream & | input_stream | ) |
Reads the point set from a stream.
This function will clear any Features present currently. It will also assume that the incoming PointSet has the proper feature dim (observe that a serialized PointSet doesn't actually record feature dim-- that is up to PointSetList to remember).