Variable.h
89 lines
| 2.9 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r112 | #ifndef SCIQLOP_VARIABLE_H | ||
#define SCIQLOP_VARIABLE_H | ||||
Alexandre Leroux
|
r461 | #include "CoreGlobal.h" | ||
Alexandre Leroux
|
r654 | #include <Data/DataSeriesIterator.h> | ||
r512 | #include <Data/SqpRange.h> | |||
r226 | ||||
#include <QLoggingCategory> | ||||
Alexandre Leroux
|
r170 | #include <QObject> | ||
Alexandre Leroux
|
r308 | #include <Common/MetaTypes.h> | ||
r226 | #include <Common/spimpl.h> | |||
Q_DECLARE_LOGGING_CATEGORY(LOG_Variable) | ||||
Alexandre Leroux
|
r164 | class IDataSeries; | ||
Alexandre Leroux
|
r163 | class QString; | ||
Alexandre Leroux
|
r112 | |||
/** | ||||
Alexandre Leroux
|
r163 | * @brief The Variable class represents a variable in SciQlop. | ||
Alexandre Leroux
|
r112 | */ | ||
Alexandre Leroux
|
r461 | class SCIQLOP_CORE_EXPORT Variable : public QObject { | ||
r235 | ||||
Q_OBJECT | ||||
Alexandre Leroux
|
r163 | public: | ||
r756 | explicit Variable(const QString &name, const QVariantHash &metadata = {}); | |||
Alexandre Leroux
|
r163 | |||
Alexandre Leroux
|
r707 | /// Copy ctor | ||
explicit Variable(const Variable &other); | ||||
std::shared_ptr<Variable> clone() const; | ||||
Alexandre Leroux
|
r163 | QString name() const noexcept; | ||
Alexandre Leroux
|
r686 | void setName(const QString &name) noexcept; | ||
r532 | SqpRange range() const noexcept; | |||
void setRange(const SqpRange &range) noexcept; | ||||
SqpRange cacheRange() const noexcept; | ||||
void setCacheRange(const SqpRange &cacheRange) noexcept; | ||||
Alexandre Leroux
|
r164 | |||
Alexandre Leroux
|
r716 | /// @return the number of points hold by the variable. The number of points is updated each time | ||
/// the data series changes | ||||
int nbPoints() const noexcept; | ||||
Alexandre Leroux
|
r654 | /// Returns the real range of the variable, i.e. the min and max x-axis values of the data | ||
/// series between the range of the variable. The real range is updated each time the variable | ||||
/// range or the data series changed | ||||
/// @return the real range, invalid range if the data series is null or empty | ||||
/// @sa setDataSeries() | ||||
/// @sa setRange() | ||||
SqpRange realRange() const noexcept; | ||||
Alexandre Leroux
|
r182 | /// @return the data of the variable, nullptr if there is no data | ||
r543 | std::shared_ptr<IDataSeries> dataSeries() const noexcept; | |||
Alexandre Leroux
|
r182 | |||
Alexandre Leroux
|
r406 | QVariantHash metadata() const noexcept; | ||
r532 | bool contains(const SqpRange &range) const noexcept; | |||
bool intersect(const SqpRange &range) const noexcept; | ||||
bool isInside(const SqpRange &range) const noexcept; | ||||
bool cacheContains(const SqpRange &range) const noexcept; | ||||
bool cacheIntersect(const SqpRange &range) const noexcept; | ||||
bool cacheIsInside(const SqpRange &range) const noexcept; | ||||
r541 | QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &range) const noexcept; | |||
r570 | QVector<SqpRange> provideInCacheRangeList(const SqpRange &range) const noexcept; | |||
r538 | void mergeDataSeries(std::shared_ptr<IDataSeries> dataSeries) noexcept; | |||
r235 | ||||
r816 | static QVector<SqpRange> provideNotInCacheRangeList(const SqpRange &oldRange, | |||
const SqpRange &nextRange); | ||||
static QVector<SqpRange> provideInCacheRangeList(const SqpRange &oldRange, | ||||
const SqpRange &nextRange); | ||||
r235 | signals: | |||
r298 | void updated(); | |||
r235 | ||||
Alexandre Leroux
|
r163 | private: | ||
class VariablePrivate; | ||||
spimpl::unique_impl_ptr<VariablePrivate> impl; | ||||
Alexandre Leroux
|
r112 | }; | ||
Alexandre Leroux
|
r170 | // Required for using shared_ptr in signals/slots | ||
Alexandre Leroux
|
r308 | SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>) | ||
r538 | SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_VECTOR_REGISTRY, QVector<std::shared_ptr<Variable> >) | |||
Alexandre Leroux
|
r170 | |||
Alexandre Leroux
|
r112 | #endif // SCIQLOP_VARIABLE_H | ||