Gaia
|
A FrozenDataSet is a dataset that has been flagged as immutable. More...
#include <frozendataset.h>
Public Member Functions | |
FrozenDataSet (int npoints, int dimension) | |
void | load (const QString &filename) |
Load a dataset from disk. | |
void | save (const QString &filename) const |
Save this dataset to disk. | |
int | size () const |
Return the number of points contained in this dataset. | |
int | dimension () const |
Return the number of dimensions of this dataset. | |
QStringList | pointNames () const |
const QString & | pointName (int i) const |
Return the name of the point with the given index. | |
int | pointIndex (const QString &name) const |
Return the index of the point with the given name. More... | |
FrozenPoint | point (const QString &name) const |
QPair< int, int > | descriptorLocation (const QString &descriptorName) const |
Return the column indices of beginning and end fo the region spanning the descriptor. More... | |
QStringList | descriptorNames () const |
void | fromDataSet (const DataSet &dataset) |
Note: this method is not made static as a named-constructor, because then we would have to return the FrozenDataSet by value which would be very inefficient. More... | |
void | setReferenceDataSet (DataSet *dataset=0) |
Set the reference dataset, ie: the one used for fetching the values when doing filtered queries. More... | |
const DataSet * | referenceDataSet () const |
Return the reference dataset. More... | |
void | addView (FrozenView *view) |
void | removeView (FrozenView *view) |
Static Public Member Functions | |
static void | checkValidFrozenDataSet (const DataSet &dataset) |
Checks whether the given dataset would make a valid FrozenDataSet. More... | |
Protected Attributes | |
QVector< QString > | _names |
This variable records the names of the points. More... | |
QMap< QString, QPair< int, int > > | _layout |
DataSet * | _referenceDataSet |
A FrozenDataSet is a dataset that has been flagged as immutable.
No more fields can be added, nor can any field be removed from it (hence the name frozen). There are also conditions that need to be filled before creating a FrozenDataSet, such as the fact that it only accepts real-type fixed-length descriptors at the moment. It has however a few other advantages over a normal dataset, namely that the memory used for it is contiguous (and thus much faster to iterate over, such as in the case of nn-queries).
|
static |
Checks whether the given dataset would make a valid FrozenDataSet.
If anything prevents if from being so, this method throws a GaiaException explaining why, otherwise it just returns silently.
References gaia2::PointLayout::descriptorLocation(), gaia2::PointLayout::descriptorNames(), gaia2::DataSet::layout(), and gaia2::Region::lengthType().
QPair< int, int > FrozenDataSet::descriptorLocation | ( | const QString & | descriptorName | ) | const |
Return the column indices of beginning and end fo the region spanning the descriptor.
NOTE: contrary to a normal dataset's layout, here you always have to give the fully-qualified name.
void FrozenDataSet::fromDataSet | ( | const DataSet & | dataset | ) |
Note: this method is not made static as a named-constructor, because then we would have to return the FrozenDataSet by value which would be very inefficient.
There could be 2 solutions to this, none of which seems really worth investing the time in it (curiosity would of course want me to do it, but oh well... :-) )
References gaia2::PointLayout::descriptorLocation(), gaia2::PointLayout::descriptorNames(), gaia2::Region::dimension(), gaia2::DataSet::layout(), gaia2::DataSet::name(), and gaia2::Region::segment().
int FrozenDataSet::pointIndex | ( | const QString & | name | ) | const |
Return the index of the point with the given name.
GaiaException | if no such point exists |
const DataSet * FrozenDataSet::referenceDataSet | ( | ) | const |
Return the reference dataset.
If no reference dataset has been previously set, then this method will throw an exception.
void FrozenDataSet::setReferenceDataSet | ( | DataSet * | dataset = 0 | ) |
Set the reference dataset, ie: the one used for fetching the values when doing filtered queries.
Passing it a null pointer (or no argument) will mark this dataset has having no reference dataset.
References gaia2::DataSet::name().
|
protected |
This variable records the names of the points.
It should always be the same size as the number of rows contained in this FrozenDataSet.