20 #ifndef GAIA_DATASET_H 21 #define GAIA_DATASET_H 24 #include <QReadWriteLock> 26 #include "pointlayout.h" 27 #include "transformation.h" 33 class DistanceFunction;
36 template <
typename DataSetType,
typename Po
intType,
typename SearchPo
intType,
typename DistanceType>
54 PointArray(
int n = 0,
bool ownsMemory =
true) : QVector<Point*>(n, 0), _ownsMemory(ownsMemory) {}
55 PointArray(
bool ownsMemory) : _ownsMemory(ownsMemory) {}
106 const QString&
name()
const {
return _name; }
111 void setName(
const QString& name) { _name = name; }
118 const Point* point(
const QString&
id)
const;
121 Point* point(
const QString&
id);
126 bool contains(
const QString&
id)
const;
131 QStringList pointNames()
const;
148 void checkAllPointsShareSameLayout(
const QVector<Point*>* points = 0)
const;
168 void forgetHistory();
178 void simplifyHistory();
191 void setReferenceDataSet(
DataSet* dataset = 0,
bool checkOriginalLayout =
true);
199 const DataSet* referenceDataSet()
const;
210 void addPoint(
const Point* point);
220 void addPoints(
const QVector<Point*>& points);
230 void appendDataSet(
const DataSet* dataset);
237 void removePoint(
const QString&
id);
246 void removePoints(
const QList<QString>& ids);
255 void addView(View* view);
260 void removeView(View* view);
269 static DataSet* mergeFiles(
const QMap<QString, QString>& sigfiles,
270 const QStringList& descsSelect = QStringList() <<
"*",
271 const QStringList& descsExclude = QStringList(),
272 int start = 0,
int end = 10000000,
288 void load(
const QString& filename,
int start = 0,
int end = -1);
297 void loadNthPart(
const QString& filename,
int idx = 0,
int total = 1);
302 void save(
const QString& filename)
const;
307 void fromBase64(
const std::string& data);
312 void fromBase64(
const QByteArray& data);
317 std::string toBase64()
const;
372 int binarySearch(
const QString&
id,
int start,
int end)
const;
379 int pointIndex(
const QString&
id)
const;
386 int load(QDataStream& in,
int start = 0,
int end = -1,
bool readAllPointsFromStream =
false);
388 void setLayoutIfEmpty(
const Point* point);
390 void invalidateViews();
394 void setHistoryNoCheck(
const TransfoChain& history) { _history = history; }
398 bool consistentLinks()
const;
400 void forceUnlinkReferringDataSets();
414 void checkUniqueIDs();
424 void checkUniqueIDsFrom(
const QVector<Point*>& v);
455 void addPoints(
const QVector<Point*>& points,
458 bool checkUnique =
true,
459 bool takeOwnership =
false,
460 bool relaySignal =
true);
462 void removePoints(
const QList<QString>& ids,
bool relaySignal);
464 void sortPoints(
int pivotIdx = -1);
486 friend QDataStream& operator<<(QDataStream& out,
const DataSet& dataset);
487 friend QDataStream& operator>>(QDataStream& in,
DataSet& dataset);
494 #endif // GAIA_DATASET_H const TransfoChain & history() const
Return the history of this dataset (the list of all transformations that have been applied)...
Definition: dataset.h:153
A PointArray is a simple subclass of a QVector<Point*> that owns the memory to the points (hence will...
Definition: dataset.h:48
This class represents a dataset and all related information.
Definition: dataset.h:91
const PointLayout & layout() const
Return the layout of this dataset.
Definition: dataset.h:136
const Point * samplePoint() const
Returns any single point from the PointArray.
Definition: dataset.cpp:61
This class describes the layout of a point.
Definition: pointlayout.h:60
int binarySearch(const Container< T > &v, T value)
Iterative function for binary search (more efficient than recursive one).
Definition: gaiamath.h:270
TransfoChain _history
This represents the history of transformations that have been applied to this dataset, and also contains all the parameters to allow mapping a point from the original dataset space into the space this dataset is in.
Definition: dataset.h:337
void setName(const QString &name)
Set the name for this dataset.
Definition: dataset.h:111
const QString & name() const
Return the name of this dataset.
Definition: dataset.h:106
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
void clear()
Delete the points this array contains (if it owns them), then resize the array to 0...
Definition: dataset.cpp:45
DataSet * mergeDataSets(const DataSet *ds1, const DataSet *ds2)
Merges two datasets together, provided that their layout don't overlap, and return the resulting data...
Definition: utils.cpp:421
QReadWriteLock lock
A lock available for users to take, if the dataset is to be used in a multi-threaded context...
Definition: dataset.h:101
The Applier abstract base class.
Definition: applier.h:44
QString _name
Represents the name of the dataset, which should be a short way to describe its function or where it ...
Definition: dataset.h:328
The View class contains a specific view on a dataset.
Definition: dataset.h:37
int totalSegments() const
Returns the total number of segments in this PointArray (the sum of the number of segments for each p...
Definition: dataset.cpp:53
PointLayout _layout
This represents the common layout of all points contained in this dataset and provides functions for ...
Definition: dataset.h:345
QList< View * > _linkedViews
This list contains all Views linked to this DataSet, ie: the Views using points from this dataset to ...
Definition: dataset.h:365
Definition: transformation.h:106
QList< DataSet * > _linkedDataSets
This list contains all datasets linked to this one, like when a dataset is referencing another one fo...
Definition: dataset.h:357