#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 Features 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 | GetNumPointSets () const |
Get the total number of PointSets in this PointSetList. | |
virtual int | GetNumPoints () const |
Get the total number of Features in this PointSetList. | |
virtual int | GetFeatureDim () const |
Get the dim of every Feature in this PointSetList. | |
virtual vector< int > | GetSetCardinalities () const |
Get the number of Features in each PointSet. | |
PointSet & | operator[] (int index) |
Returns a ref to the <index>th PointSet. | |
virtual const PointSet & | operator[] (int index) const |
Returns a const ref to the <index>th PointSet. | |
void | AddPointSet (const PointSet &point_set) |
Adds a copy of <point_set> to the end of the list. | |
const Feature & | GetFeature (int index) const |
Returns the <index>th Feature in the PointSetList. | |
pair< int, int > | GetFeatureIndices (int index) const |
Locate a Feature in a PointSet. | |
void | GetPointRefs (vector< PointRef > *out_refs) const |
Get PointRefs to every Feature 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 GetNumPointSets | ( | ) | const [virtual] |
int GetNumPoints | ( | ) | const [virtual] |
Get the total number of Features in this PointSetList.
This is the sum of GetNumFeatures() over all PointSets in in this PointSetList.
Implements PointSetList.
int GetFeatureDim | ( | ) | const [virtual] |
vector< int > GetSetCardinalities | ( | ) | const [virtual] |
Get the number of Features in each PointSet.
Returns a vector of size this.GetNumPointSets(), where the nth element is the number of Features in the nth PointSet in this PointSetList.
Implements PointSetList.
const PointSet & operator[] | ( | int | index | ) | const [virtual] |
void AddPointSet | ( | const PointSet & | point_set | ) |
Adds a copy of <point_set> to the end of the list.
const Feature & GetFeature | ( | int | index | ) | const [inherited] |
Returns the <index>th Feature in the PointSetList.
We can also think of a PointSetList as a long vector of Features if we ignore the PointSet boundaries, so you can reference individual features of a PointSetList through this.
pair< int, int > GetFeatureIndices | ( | int | index | ) | const [inherited] |
void GetPointRefs | ( | vector< PointRef > * | out_refs | ) | const [inherited] |
Get PointRefs to every Feature in this PointSetList.
Requires out_refs != NULL. Makes out_refs a vector of size GetNumPoints(), where the nth element is a PointRef pointing to the nth Feature (i.e., points to GetFeature(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.