OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ResultCollectionExtender.h
Go to the documentation of this file.
1#pragma once
2
4#include "MetadataCampaign.h"
5#include "MetadataQuantity.h"
6#include "MetadataParameter.h"
7#include "MetadataSeries.h"
8#include "MetadataEntry.h"
9#include "QuantityContainer.h"
10#include "ResultImportLogger.h"
11
12#include "DatasetDescription.h"
14#include <string>
15
16class ClassFactory;
17
18class __declspec(dllexport) ResultCollectionExtender : public ResultCollectionMetadataAccess
19{
20public:
21 ResultCollectionExtender(const std::string& _collectionName, ot::components::ModelComponent& _modelComponent, ClassFactory* _classFactory, const std::string& _ownerServiceName);
22 ResultCollectionExtender(const ResultCollectionExtender& _other) = delete;
23 ResultCollectionExtender& operator=(const ResultCollectionExtender& _other) = delete;
24 ~ResultCollectionExtender() = default;
25
26 void setSaveModel(bool _saveModel) { m_saveModel = _saveModel; }
27
28 ot::UID buildSeriesMetadata(std::list<DatasetDescription>& _datasetDescriptions, const std::string& _seriesName, std::list<std::shared_ptr<MetadataEntry>>& _seriesMetadata);
29 ot::UID buildSeriesMetadata(std::list<DatasetDescription>& _datasetDescriptions, const std::string& _seriesName, std::list<std::shared_ptr<MetadataEntry>>&& _seriesMetadata);
30
31 bool campaignMetadataWithSameNameExists(std::shared_ptr<MetadataEntry> _metadata);
32 bool campaignMetadataWithSameValueExists(std::shared_ptr<MetadataEntry> _metadata);
33
35 void processDataPoints(DatasetDescription* dataDescription, uint64_t seriesMetadataIndex);
36
41 void addCampaignMetadata(std::shared_ptr<MetadataEntry> _metadata);
42
43 void storeCampaignChanges();
44 bool removeSeries(ot::UID _uid);
45
46 ResultImportLogger& getLogger() { return m_logger; }
47
48protected:
49 inline bool invariant() { return true; }
50
51 ResultCollectionExtender() {};
52 bool m_requiresUpdateMetadataCampaign = false;
53 std::list<const MetadataSeries*> m_seriesMetadataForStorage;
54
55 std::map<std::string,uint32_t> m_parameterBuckets;
56 const std::string m_ownerServiceName;
57
58 ResultImportLogger m_logger;
59
60 ot::UIDList addCampaignContextDataToParameters(DatasetDescription& _dataDescription);
61 void addCampaignContextDataToQuantities(DatasetDescription& _dataDescription, ot::UIDList& _dependingParameter);
62 ot::UID createNewSeries(std::list< DatasetDescription>& _dataDescription, const std::string& _seriesName, std::list<std::shared_ptr<MetadataEntry>>& _seriesMetadata);
63 void addMetadataToSeries(std::list< DatasetDescription>& _dataDescription, MetadataSeries& _newSeries);
64
65 std::map<std::string, std::list<MetadataQuantity*>> m_quantitiesUpForStorageByName;
66 std::map<std::string, std::list<MetadataParameter*>> m_parameterUpForStorageByName;
67
68 virtual const uint64_t findNextFreeSeriesIndex();
69 virtual const uint64_t findNextFreeQuantityIndex();
70 virtual const uint64_t findNextFreeParameterIndex();
71
72 bool quantityIsCorrectlySet(MetadataQuantity& _quantity);
73 bool parameterIsCorrectlySet(MetadataParameter& _parameter);
74
75 bool m_saveModel = true;
76};
77
78
Definition ModelComponent.h:42
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27
std::list< UID > UIDList
Unique identifier list.
Definition CoreTypes.h:31