PointSet Class Reference

#include <point-set.h>

List of all members.


Detailed Description

A data structure representing a list of Points.

All features in the set must have the same dimension, and this is determined when the PointSet is constructed. Points may be added, removed, and replaced by index. When points are inserted, PointSet will automatically check to make sure that the points all have the same dimension.

This is called a PointSet just to maintain name compatibility with previous versions, even though it is actually an array.


Public Member Functions

 PointSet (int point_dim)
 Creates an initially empty set (such that size() == 0).
 ~PointSet ()
 PointSet (const PointSet &other)
void CopyFrom (const PointSet &other)
int size () const
int point_dim () const
void set_point_dim (int new_dim)
 Set the point dim. Only works when size() == 0.
const Pointpoint (int index) const
 Returns a const reference to the point at <index>.
Pointmutable_point (int index) const
const Pointoperator[] (int index) const
Pointadd_point (const Point &point)
 Adds a copy of the point to the end of the list.
Pointadd_point ()
 Adds a new, empty (all zeroes) Point and returns a pointer to it.
void remove_point (int index)
 Removes the point at <index>.
void clear ()
 Deletes all of the points.
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.


Constructor & Destructor Documentation

PointSet ( int  point_dim  ) 

Creates an initially empty set (such that size() == 0).

~PointSet (  ) 

PointSet ( const PointSet other  ) 


Member Function Documentation

void CopyFrom ( const PointSet other  ) 

int size (  )  const [inline]

int point_dim (  )  const [inline]

void set_point_dim ( int  new_dim  ) 

Set the point dim. Only works when size() == 0.

const Point & point ( int  index  )  const

Returns a const reference to the point at <index>.

Point * mutable_point ( int  index  )  const

const Point& operator[] ( int  index  )  const [inline]

Point * add_point ( const Point point  ) 

Adds a copy of the point to the end of the list.

Returns a pointer to the Point that was just added.

Point * add_point (  ) 

Adds a new, empty (all zeroes) Point and returns a pointer to it.

void remove_point ( int  index  ) 

Removes the point at <index>.

void clear (  ) 

Deletes all of the points.

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).


The documentation for this class was generated from the following files:
Generated on Fri Sep 21 11:39:05 2007 for libpmk2 by  doxygen 1.5.1