AbstractDataManager
// The core and its managers are located in this header
#include "CoreInterface.h"
// Use this global function to access the data manager
mv::data()->...
Related
Data models
Qualified name: mv::AbstractDataManager
-
class AbstractDataManager : public mv::AbstractManager
Abstract data manager.
Base abstract data manager class for managing datasets.
- Author
Thomas Kroes and Julian Thijssen
Public Functions
-
inline explicit AbstractDataManager(QObject *parent)
Construct manager with pointer to
parentobject.- Parameters:
parent – Pointer to parent object
-
virtual QStringList getRawDataNames() const = 0
Get raw data names @retun Raw data names list.
-
virtual std::uint64_t getRawDataSize(const QString &rawDataName) const = 0
Get raw data size by
rawDataName.- Parameters:
rawDataName – Name of the raw data
- Returns:
Size of the raw data in bytes
-
inline std::uint64_t getOverallRawDataSize() const
Get overall raw data size.
- Returns:
Overall raw data size in bytes
-
virtual QString getRawDataType(const QString &rawDataName) const = 0
Get raw data type string by
rawDataName.- Parameters:
rawDataName – Name of the raw data
- Returns:
Raw data type string
-
virtual Dataset<DatasetImpl> createDataset(const QString &kind, const QString &guiName, const Dataset<DatasetImpl> &parentDataset = Dataset<DatasetImpl>(), const QString &id = "", bool notify = true) = 0
Creates dataset of
kindwithguiNameto the manager and returns the created dataset.- Parameters:
kind – Kind of data plugin
guiName – Name of the added dataset in the GUI
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will add to the root of the data hierarchy if not valid)
id – Globally unique dataset identifier (use only for deserialization)
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the create dataset
-
virtual Dataset<DatasetImpl> createDatasetWithoutSelection(const QString &kind, const QString &guiName, const Dataset<DatasetImpl> &parentDataset = Dataset<DatasetImpl>(), const QString &id = "", bool notify = true) = 0
Creates dataset without selection of
kindwithguiNameto the manager and returns the created dataset (this is only used fore serialization purposes)- Parameters:
kind – Kind of data plugin
guiName – Name of the added dataset in the GUI
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will add to the root of the data hierarchy if not valid)
id – Globally unique dataset identifier (use only for deserialization)
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the create dataset
-
template<class DatasetType>
inline Dataset<DatasetType> createDataset(const QString &kind, const QString &dataSetGuiName, const Dataset<DatasetImpl> &parentDataset = Dataset<DatasetImpl>(), const QString &id = "", bool notify = true) Creates dataset of
kindwithguiNameto the manager and returns the created dataset asDatasetType.- Parameters:
kind – Kind of data plugin
guiName – Name of the added dataset in the GUI
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will add to the root of the data hierarchy if not valid)
id – Globally unique dataset identifier (use only for deserialization)
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the added dataset
-
virtual void removeDataset(Dataset<DatasetImpl> dataset) = 0
Remove
datasetfrom the manager.- Parameters:
dataset – Smart pointer to dataset to remove
-
virtual void removeDatasets(Datasets datasets) = 0
Remove
datasetsfrom the manager.- Parameters:
datasets – Smart pointer to datasets to remove
-
virtual void removeDatasets(const QString &rawDataName) = 0
Remove datasets that reference
rawDataNamefrom the manager.- Param :
-
virtual Dataset<DatasetImpl> createDerivedDataset(const QString &guiName, const Dataset<DatasetImpl> &sourceDataset, const Dataset<DatasetImpl> &parentDataset = Dataset<DatasetImpl>(), bool notify = true) = 0
Creates derived dataset from \666p sourceDataset with
guiNameand returns the created derived dataset.- Parameters:
guiName – GUI name for the new dataset from the core
sourceDataset – Smart pointer to the source dataset from which this dataset will be derived
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will attach to source dataset in hierarchy if not valid)
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the created derived dataset
-
template<typename DatasetType>
inline Dataset<DatasetType> createDerivedDataset(const QString &guiName, const Dataset<DatasetImpl> &sourceDataset, const Dataset<DatasetImpl> &parentDataset = Dataset<DatasetImpl>(), bool notify = true) Creates derived dataset from
sourceDatasetwithguiNameand returns the created derived dataset asDatasetType.- Parameters:
guiName – GUI name for the new dataset from the core
sourceDataset – Smart pointer to the source dataset from which this dataset will be derived
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will attach to source dataset in hierarchy if not valid)
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the created derived dataset of
DatasetType
-
virtual Dataset<DatasetImpl> createSubsetFromSelection(const Dataset<DatasetImpl> &selection, const Dataset<DatasetImpl> &sourceDataset, const QString &guiName, const Dataset<DatasetImpl> &parentDataset, const bool &visible = true, bool notify = true) = 0
Creates a copy of
selectionwith thesourceDataset, adds it to the manager and returns the created subset.- Parameters:
selection – Smart pointer to the selection set
sourceDataset – Smart pointer to the source dataset
guiName – GUI name of the subset
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will attach to source dataset in hierarchy if not valid)
visible – Whether the new dataset is visible in the data hierarchy
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the created subset
-
template<typename DatasetType>
inline Dataset<DatasetType> createSubsetFromSelection(const Dataset<DatasetImpl> &selection, const Dataset<DatasetImpl> &sourceDataset, const QString &guiName, const Dataset<DatasetImpl> &parentDataset, const bool &visible = true, bool notify = true) Creates a copy of
selectionwith thesourceDataset, adds it to the manager and returns the created subset asDatasetType.- Parameters:
selection – Smart pointer to the selection set
sourceDataset – Smart pointer to the source dataset
guiName – GUI name of the subset
parentDataset – Smart pointer to the parent dataset in the data hierarchy (will attach to source dataset in hierarchy if not valid)
visible – Whether the new dataset is visible in the data hierarchy
notify – Whether to notify the core that a dataset is added
- Returns:
Smart pointer to the created subset of
DatasetType
-
virtual Dataset<DatasetImpl> getDataset(const QString &datasetId) = 0
Get dataset by
datasetId.- Parameters:
datasetId – Globally unique identifier of the dataset
- Returns:
Smart pointer to the dataset
-
template<typename DatasetType>
inline Dataset<DatasetType> getDataset(const QString &datasetId) Get dataset by
datasetIdasDatasetType.- Parameters:
datasetId – Globally unique identifier of the dataset
- Returns:
Smart pointer to the dataset of
DatasetType
-
virtual Datasets getAllDatasets(const std::vector<DataType> &dataTypes = std::vector<DataType>()) const = 0
Get all datasets for
dataTypes.- Parameters:
dataTypes – Data types filter (if empty returns all types)
- Returns:
Smart pointers to datasets
-
virtual Dataset<DatasetImpl> getSelection(const QString &rawDataName) = 0
Get selection dataset by
rawDataName.- Parameters:
rawDataName – Name of the raw data
- Returns:
Smart pointer to the selection dataset
-
template<typename DatasetType>
inline Dataset<DatasetType> getSelection(const QString &rawDataName) Get a selection of
DatasetTypebyrawDataName.- Parameters:
rawdataName – Name of the raw data
- Returns:
Smart pointer to the selection dataset
-
virtual Datasets getAllSelections() = 0
Get all selection datasets.
- Returns:
Smart pointers to selection datasets
-
virtual Dataset<DatasetImpl> groupDatasets(const Datasets &datasets, const QString &guiName = "") = 0
Groups
datasetsinto one dataset and returns the group dataset.- Parameters:
datasets – Two or more datasets to group
guiName – Name of the created dataset in the GUI (if empty, the user will be prompted for a name)
- Returns:
Smart pointer to created group dataset
-
virtual gui::ToggleAction *getSelectionGroupingAction() = 0
Get selection grouping setEnabled action.
- Returns:
Pointer to selection grouping toggle action (only valid if there is a current project)
-
virtual const DatasetsListModel &getDatasetsListModel() const = 0
Get datasets list model.
- Returns:
Reference to datasets list model
-
virtual void linkFilterModelToDatasetsListModel(QSortFilterProxyModel *filterModel) = 0
Link
filterModelto the datasets list model.- Parameters:
filterModel – Pointer to filter model
-
void rawDataAdded(plugin::RawData *rawData)
Signals that
rawDatais added to the data manager.- Parameters:
rawData – Pointer to raw data that was added
-
void rawDataAboutToBeRemoved(plugin::RawData *rawData)
Signals that
rawDatais about to be removed from the data manager.- Parameters:
rawData – Pointer to raw data that is about to be removed
-
void rawDataRemoved(const QString &rawDataId)
Signals that raw data with
rawDataIdis removed from the data manager.- Parameters:
rawData – Pointer to raw data that was added
-
void datasetAdded(Dataset<DatasetImpl> dataset, Dataset<DatasetImpl> parentDataset, bool visible = true)
Signals that
datasetis added to the data manager.- Parameters:
dataset – Dataset that was added
parentDataset – Parent dataset (if any)
visible – Whether
datasetshould be visible or not
-
void datasetAboutToBeRemoved(Dataset<DatasetImpl> dataset)
Signals that
datasetis about to be removed from the data manager.- Parameters:
dataset – Dataset which is about to be removed
-
void datasetRemoved(const QString &datasetId)
Signals that dataset with
datasetIdis removed from the data manager.- Parameters:
datasetId – GUID of the removed dataset
-
void selectionAdded(Dataset<DatasetImpl> selection)
Signals that
selectiondataset is added to the data manager.- Parameters:
selection – Selection dataset that was added
-
void selectionAboutToBeRemoved(Dataset<DatasetImpl> selection)
Signals that
selectiondataset is about to be removed from the data manager.- Parameters:
selection – Selection dataset that is about to be removed
-
void selectionRemoved(const QString &selectionId)
Signals that selection dataset with
selectionIdis removed from the data manager.- Parameters:
selectionId – GUID of the removed selection dataset
Protected Functions
-
virtual void addRawData(plugin::RawData *rawData) = 0
Add
rawDatato the manager (plugin manager remains the owner)- Parameters:
rawData – Pointer to the raw data to add
-
virtual void removeRawData(const QString &rawDataName) = 0
Remove raw data with
rawDataNamefrom the manager if there are no more (selection) datasets referencing it.- Parameters:
rawDataName – Name of the raw data to remove
-
virtual plugin::RawData *getRawData(const QString &rawDataName) = 0
Get raw data by
rawDataName.- Parameters:
rawDataName – Name of the raw data
- Returns:
Pointer to raw data if found, nullptr otherwise
-
template<typename RawDataType>
inline RawDataType *getRawData(const QString &rawDataName) Get raw data by
rawDataName.- Parameters:
rawDataName – Name of the raw data
- Returns:
Pointer of
RawDataTypeto raw data if found, nullptr otherwise
-
virtual void addDataset(Dataset<DatasetImpl> dataset, Dataset<DatasetImpl> parentDataset, bool notify = true) = 0
Adds
datasetto the manager.- Parameters:
dataset – Dataset to added
parentDataset – Parent dataset (if any)
notify – Whether to notify the core that a dataset is added
-
virtual void addSelection(const QString &rawDataName, Dataset<DatasetImpl> selection) = 0
Add
selectiononrawDataNameto the manager.- Parameters:
rawDataName – Name of the raw data
selection – Smart pointer to selection dataset
-
virtual void removeSelection(const QString &rawDataName) = 0
Removes selection of which the raw data name matches
rawDataName.- Parameters:
rawDataName – Name of the raw data