Variable.h
93 lines
| 3.1 KiB
| text/x-c
|
CLexer
|
r112 | #ifndef SCIQLOP_VARIABLE_H | ||
#define SCIQLOP_VARIABLE_H | ||||
|
r461 | #include "CoreGlobal.h" | ||
|
r654 | #include <Data/DataSeriesIterator.h> | ||
|
r1250 | #include <Data/DataSeriesType.h> | ||
r512 | #include <Data/SqpRange.h> | |||
r226 | ||||
#include <QLoggingCategory> | ||||
|
r170 | #include <QObject> | ||
|
r308 | #include <Common/MetaTypes.h> | ||
r226 | #include <Common/spimpl.h> | |||
Q_DECLARE_LOGGING_CATEGORY(LOG_Variable) | ||||
|
r164 | class IDataSeries; | ||
|
r163 | class QString; | ||
|
r112 | |||
/** | ||||
|
r163 | * @brief The Variable class represents a variable in SciQlop. | ||
|
r112 | */ | ||
|
r461 | class SCIQLOP_CORE_EXPORT Variable : public QObject { | ||
r235 | ||||
Q_OBJECT | ||||
|
r163 | public: | ||
r756 | explicit Variable(const QString &name, const QVariantHash &metadata = {}); | |||
|
r163 | |||
|
r707 | /// Copy ctor | ||
explicit Variable(const Variable &other); | ||||
std::shared_ptr<Variable> clone() const; | ||||
|
r163 | QString name() const noexcept; | ||
|
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; | ||||
|
r164 | |||
|
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; | ||||
|
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; | ||||
|
r182 | /// @return the data of the variable, nullptr if there is no data | ||
r543 | std::shared_ptr<IDataSeries> dataSeries() const noexcept; | |||
|
r182 | |||
|
r1250 | /// @return the type of data that the variable holds | ||
DataSeriesType type() const noexcept; | ||||
|
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 | ||||
|
r163 | private: | ||
class VariablePrivate; | ||||
spimpl::unique_impl_ptr<VariablePrivate> impl; | ||||
|
r112 | }; | ||
|
r170 | // Required for using shared_ptr in signals/slots | ||
|
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> >) | |||
|
r170 | |||
|
r112 | #endif // SCIQLOP_VARIABLE_H | ||