VariableController.h
116 lines
| 3.8 KiB
| text/x-c
|
CLexer
|
r111 | #ifndef SCIQLOP_VARIABLECONTROLLER_H | ||
#define SCIQLOP_VARIABLECONTROLLER_H | ||||
|
r461 | #include "CoreGlobal.h" | ||
r539 | #include <Data/AcquisitionDataPacket.h> | |||
r512 | #include <Data/SqpRange.h> | |||
r235 | ||||
|
r111 | #include <QLoggingCategory> | ||
#include <QObject> | ||||
#include <Common/spimpl.h> | ||||
|
r166 | class IDataProvider; | ||
r304 | class QItemSelectionModel; | |||
r193 | class TimeController; | |||
|
r113 | class Variable; | ||
|
r152 | class VariableModel; | ||
|
r111 | Q_DECLARE_LOGGING_CATEGORY(LOG_VariableController) | ||
r539 | ||||
/** | ||||
* Possible types of zoom operation | ||||
*/ | ||||
enum class AcquisitionZoomType { ZoomOut, ZoomIn, PanRight, PanLeft, Unknown }; | ||||
|
r111 | /** | ||
* @brief The VariableController class aims to handle the variables in SciQlop. | ||||
*/ | ||||
|
r461 | class SCIQLOP_CORE_EXPORT VariableController : public QObject { | ||
|
r111 | Q_OBJECT | ||
public: | ||||
explicit VariableController(QObject *parent = 0); | ||||
virtual ~VariableController(); | ||||
|
r166 | VariableModel *variableModel() noexcept; | ||
r304 | QItemSelectionModel *variableSelectionModel() noexcept; | |||
|
r166 | |||
r193 | void setTimeController(TimeController *timeController) noexcept; | |||
|
r329 | /** | ||
* Deletes from the controller the variable passed in parameter. | ||||
* | ||||
|
r330 | * Delete a variable includes: | ||
|
r336 | * - the deletion of the various references to the variable in SciQlop | ||
|
r332 | * - the deletion of the model variable | ||
|
r330 | * - the deletion of the provider associated with the variable | ||
|
r331 | * - removing the cache associated with the variable | ||
|
r329 | * | ||
* @param variable the variable to delete from the controller. | ||||
*/ | ||||
void deleteVariable(std::shared_ptr<Variable> variable) noexcept; | ||||
/** | ||||
* Deletes from the controller the variables passed in parameter. | ||||
* @param variables the variables to delete from the controller. | ||||
* @sa deleteVariable() | ||||
*/ | ||||
void deleteVariables(const QVector<std::shared_ptr<Variable> > &variables) noexcept; | ||||
r235 | ||||
r422 | /** | |||
* @brief abort the variable retrieve data progression | ||||
*/ | ||||
void abortProgress(std::shared_ptr<Variable> variable); | ||||
r539 | static AcquisitionZoomType getZoomType(const SqpRange &range, const SqpRange &oldRange); | |||
|
r166 | signals: | ||
|
r336 | /// Signal emitted when a variable is about to be deleted from the controller | ||
void variableAboutToBeDeleted(std::shared_ptr<Variable> variable); | ||||
|
r166 | |||
r437 | /// Signal emitted when a data acquisition is requested on a range for a variable | |||
r512 | void rangeChanged(std::shared_ptr<Variable> variable, const SqpRange &range); | |||
r437 | ||||
|
r166 | public slots: | ||
r539 | /// Request the data loading of the variable whithin range | |||
void onRequestDataLoading(QVector<std::shared_ptr<Variable> > variables, const SqpRange &range, | ||||
const SqpRange &oldRange, bool synchronise); | ||||
|
r113 | /** | ||
|
r166 | * Creates a new variable and adds it to the model | ||
|
r113 | * @param name the name of the new variable | ||
|
r410 | * @param metadata the metadata of the new variable | ||
|
r166 | * @param provider the data provider for the new variable | ||
|
r113 | */ | ||
|
r410 | void createVariable(const QString &name, const QVariantHash &metadata, | ||
std::shared_ptr<IDataProvider> provider) noexcept; | ||||
|
r113 | |||
r304 | /// Update the temporal parameters of every selected variable to dateTime | |||
r512 | void onDateTimeOnSelection(const SqpRange &dateTime); | |||
r304 | ||||
r401 | ||||
r539 | void onDataProvided(QUuid vIdentifier, const SqpRange &rangeRequested, | |||
const SqpRange &cacheRangeRequested, | ||||
QVector<AcquisitionDataPacket> dataAcquired); | ||||
r401 | void onVariableRetrieveDataInProgress(QUuid identifier, double progress); | |||
r539 | /// Cancel the current request for the variable | |||
r422 | void onAbortProgressRequested(std::shared_ptr<Variable> variable); | |||
r539 | /// synchronization group methods | |||
void onAddSynchronizationGroupId(QUuid synchronizationGroupId); | ||||
void onRemoveSynchronizationGroupId(QUuid synchronizationGroupId); | ||||
|
r111 | void initialize(); | ||
void finalize(); | ||||
private: | ||||
void waitForFinish(); | ||||
class VariableControllerPrivate; | ||||
spimpl::unique_impl_ptr<VariableControllerPrivate> impl; | ||||
}; | ||||
#endif // SCIQLOP_VARIABLECONTROLLER_H | ||||