#include <mutable-point-set-list.h>
Inheritance diagram for MutablePointSetList:
This class adds AddPointSet to the interface, allowing one to (as the name suggests) add new PointSets. You may also modify PointSets or the Points they contain, and can replace PointSets in the list with other PointSets.
Public Member Functions | |
virtual | ~MutablePointSetList () |
void | ReadFromStream (istream &input_stream) |
Reads an entire data set from a stream. | |
void | ReadFromFile (const char *filename) |
Reads an entire data set from a file. | |
void | ReadSelectionFromStream (istream &input_stream, int start, int selection_size) |
Reads a segment of the data from a stream. | |
virtual int | point_set_size () const |
Get the total number of PointSets in this PointSetList. | |
virtual int | point_size () const |
Get the total number of Points in this PointSetList. | |
virtual int | point_dim () const |
Get the dim of every Point in this PointSetList. | |
const PointSet & | point_set (int index) const |
Returns a const ref to the <index>th PointSet. | |
PointSet * | mutable_point_set (int index) |
Returns a pointer to the <index>th PointSet. | |
PointSet * | add_point_set (const PointSet &point_set) |
Adds a copy of <point_set> to the end of the list. | |
PointSet * | add_point_set (int point_dim) |
Adds a new, empty PointSet to the end of the list. | |
virtual bool | GetSetCardinalities (vector< int > *destination) const |
Get the number of Points in each PointSet. | |
const PointSet & | operator[] (int index) |
Returns a const ref to the <index>th PointSet. | |
const Point & | point (int index) const |
Returns the <index>th Point in the PointSetList. | |
bool | GetPointIndices (int index, int *which_point_set, int *which_point) const |
Locate a Point in a PointSet. | |
void | GetPointRefs (vector< PointRef > *out_refs) const |
Get PointRefs to every Point in this PointSetList. | |
void | WriteToStream (ostream &output_stream) const |
Writes the entire PointSetList to a stream. | |
void | WriteHeaderToStream (ostream &output_stream) const |
Writes just the serialized header to a stream. | |
void | WritePointSetsToStream (ostream &output_stream) const |
Writes the point sets (without a header) sequentially to a stream. | |
void | WriteToFile (const char *output_file) const |
Writes the entire PointSetList to a file. |
~MutablePointSetList | ( | ) | [virtual] |
void ReadFromStream | ( | istream & | input_stream | ) |
Reads an entire data set from a stream.
Aborts if the input_stream cannot be read.
void ReadFromFile | ( | const char * | filename | ) |
Reads an entire data set from a file.
Aborts if the file cannot be read.
void ReadSelectionFromStream | ( | istream & | input_stream, | |
int | start, | |||
int | selection_size | |||
) |
Reads a segment of the data from a stream.
<start> specifies the index of the first PointSet to read in the stream of data. If <selection_size> is large enough so that this would want to read past the end of the file, ReadSelectionFromStream will just stop reading. Observe that you will need to adjust indices (i.e., if you choose to read Y PointSets starting from index X, then this[0] will be the 6th PointSet, as opposed to this[5]).
Aborts if the input_stream cannot be read.
int point_set_size | ( | ) | const [virtual] |
int point_size | ( | ) | const [virtual] |
Get the total number of Points in this PointSetList.
This is the sum of PointSet::size() over all PointSets in in this PointSetList.
Implements PointSetList.
int point_dim | ( | ) | const [virtual] |
Get the dim of every Point in this PointSetList.
Defined to be 0 if the PointSetList is empty.
Implements PointSetList.
const PointSet & point_set | ( | int | index | ) | const [virtual] |
Adds a copy of <point_set> to the end of the list.
Returns a pointer to the newly added point set.
PointSet * add_point_set | ( | int | point_dim | ) |
Adds a new, empty PointSet to the end of the list.
Returns a pointer to the newly added point set. If this PointSetList already has data in it, it will check to make sure that <point_dim> matches the dim of those points. If the current PointSetList is empty, it will add a new PointSet initialized with <point_dim> as the point dim.
bool GetSetCardinalities | ( | vector< int > * | destination | ) | const [virtual, inherited] |
Get the number of Points in each PointSet.
Fills <destination> with a vector of size this.point_set_size(), where the nth element is the number of Points in the nth PointSet in this PointSetList. It is cleared first, and must not be NULL.
Returns true on success and false otherwise, although currently there is no reason that this method will fail.
Reimplemented in OnDiskPointSetList.
const PointSet& operator[] | ( | int | index | ) | [inline, inherited] |
Returns a const ref to the <index>th PointSet.
const Point & point | ( | int | index | ) | const [inherited] |
Returns the <index>th Point in the PointSetList.
We can also think of a PointSetList as a long vector of Points if we ignore the PointSet boundaries, so you can reference individual points of a PointSetList through this.
bool GetPointIndices | ( | int | index, | |
int * | which_point_set, | |||
int * | which_point | |||
) | const [inherited] |
void GetPointRefs | ( | vector< PointRef > * | out_refs | ) | const [inherited] |
Get PointRefs to every Point in this PointSetList.
Requires out_refs != NULL. Makes out_refs a vector of size this->point_size(), where the nth element is a PointRef pointing to the nth Point (i.e., points to this->point(n)). If out_refs has something in it beforehand, it will be cleared prior to filling it.
void WriteToStream | ( | ostream & | output_stream | ) | const [inherited] |
Writes the entire PointSetList to a stream.
See the detailed description of PointSetList for the format.
void WriteHeaderToStream | ( | ostream & | output_stream | ) | const [inherited] |
Writes just the serialized header to a stream.
void WritePointSetsToStream | ( | ostream & | output_stream | ) | const [inherited] |
Writes the point sets (without a header) sequentially to a stream.
void WriteToFile | ( | const char * | output_file | ) | const [inherited] |
Writes the entire PointSetList to a file.
See detailed description of PointSetList for the format.