##// END OF EJS Templates
Bypassed cache and merge mechanism, this seems to be broken...
Bypassed cache and merge mechanism, this seems to be broken Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r44:79fb0ced05d7
r44:79fb0ced05d7
Show More
Variable.h
117 lines | 3.5 KiB | text/x-c | CLexer
First init from SciQLop Core module...
r0 #ifndef SCIQLOP_VARIABLE_H
#define SCIQLOP_VARIABLE_H
Added missing headers...
r23 #include <optional>
Made Variable data update atomic ease thread safety and avoid mixing...
r16 #include <QLoggingCategory>
#include <QObject>
#include <QUuid>
#include <QReadWriteLock>
Removed bad dependency between VC and VariableModel, moved mime stuff...
r27 #include <QDataStream>
First init from SciQLop Core module...
r0
Made Variable data update atomic ease thread safety and avoid mixing...
r16 #include "CoreGlobal.h"
First init from SciQLop Core module...
r0 #include <Data/DataSeriesIterator.h>
#include <Data/DataSeriesType.h>
#include <Data/DateTimeRange.h>
Basic serial variable creation and update...
r2 #include <Common/deprecate.h>
First init from SciQLop Core module...
r0 #include <Common/MetaTypes.h>
#include <Common/spimpl.h>
Q_DECLARE_LOGGING_CATEGORY(LOG_Variable)
class IDataSeries;
class QString;
/**
* @brief The Variable class represents a variable in SciQlop.
*/
class SCIQLOP_CORE_EXPORT Variable : public QObject {
Q_OBJECT
public:
explicit Variable(const QString &name, const QVariantHash &metadata = {});
/// Copy ctor
explicit Variable(const Variable &other);
std::shared_ptr<Variable> clone() const;
QString name() const noexcept;
void setName(const QString &name) noexcept;
DateTimeRange range() const noexcept;
Many fixes plus implemented var synchronization...
r9 void setRange(const DateTimeRange &range, bool notify=false) noexcept;
First init from SciQLop Core module...
r0 DateTimeRange cacheRange() const noexcept;
void setCacheRange(const DateTimeRange &cacheRange) noexcept;
/// @return the number of points hold by the variable. The number of points is updated each time
/// the data series changes
VariableController2 tests refactoring...
r3 unsigned int nbPoints() const noexcept;
First init from SciQLop Core module...
r0
/// 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()
Some refactoring on Variable class...
r15 std::optional<DateTimeRange> realRange() const noexcept;
First init from SciQLop Core module...
r0
/// @return the data of the variable, nullptr if there is no data
std::shared_ptr<IDataSeries> dataSeries() const noexcept;
/// @return the type of data that the variable holds
DataSeriesType type() const noexcept;
QVariantHash metadata() const noexcept;
Basic asynchronous variable update, still a lot to do...
r17
void updateData(const std::vector<IDataSeries*>& dataSeries,
const DateTimeRange& newRange, const DateTimeRange& newCacheRange,
bool notify=true);
Bypassed cache and merge mechanism, this seems to be broken...
r44 void setData(const std::vector<IDataSeries*>& dataSeries,
const DateTimeRange& newRange, const DateTimeRange& newCacheRange,
bool notify=true);
Removed bad dependency between VC and VariableModel, moved mime stuff...
r27 static QByteArray mimeData(const std::vector<std::shared_ptr<Variable> > &variables)
{
auto encodedData = QByteArray{};
QDataStream stream{&encodedData, QIODevice::WriteOnly};
for (auto &var : variables) {
stream << var->ID().toByteArray();
}
return encodedData;
}
static std::vector<QUuid> variablesIDs(QByteArray mimeData)
{
std::vector<QUuid> variables;
QDataStream stream{mimeData};
QVariantList ids;
stream >> ids;
for (const auto& id : ids) {
variables.emplace_back (id.toByteArray());
}
return variables;
}
Basic asynchronous variable update, still a lot to do...
r17 operator QUuid() {return _uuid;}
Basic serial variable creation and update...
r2 QUuid ID(){return _uuid;}
First init from SciQLop Core module...
r0 signals:
Variable update signal forwards variable ID...
r32 void updated(QUuid ID);
private:
class VariablePrivate;
First init from SciQLop Core module...
r0 spimpl::unique_impl_ptr<VariablePrivate> impl;
Basic serial variable creation and update...
r2 QUuid _uuid;
Made Variable data update atomic ease thread safety and avoid mixing...
r16 QReadWriteLock m_lock;
First init from SciQLop Core module...
r0 };
// Required for using shared_ptr in signals/slots
SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_REGISTRY, std::shared_ptr<Variable>)
SCIQLOP_REGISTER_META_TYPE(VARIABLE_PTR_VECTOR_REGISTRY, QVector<std::shared_ptr<Variable> >)
#endif // SCIQLOP_VARIABLE_H