OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
VersionGraphCfg.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
10
11namespace ot {
12
14 public:
16 VersionGraphCfg(const VersionGraphCfg& _other) = delete;
17 virtual ~VersionGraphCfg();
18
19 VersionGraphCfg& operator = (const VersionGraphCfg& _other) = delete;
20 VersionGraphCfg& operator = (VersionGraphCfg&& _other) noexcept;
21
25 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
26
30 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
31
33 void setActiveVersionName(const std::string& _version) { m_activeVersionName = _version; };
34
37 const std::string& getActiveVersionName(void) const { return m_activeVersionName; };
38
40 void setActiveBranchVersionName(const std::string& _version) { m_activeBranchVersionName = _version; };
41
46 const std::string& getActiveBranchVersionName(void) const { return m_activeBranchVersionName; };
47
48 void setRootVersion(const std::string& _name, const std::string& _label = std::string(), const std::string& _description = std::string());
49
52 void setRootVersion(VersionGraphVersionCfg* _version);
53
56 VersionGraphVersionCfg* getRootVersion(void) { return m_rootVersion; };
57
60 const VersionGraphVersionCfg* getRootVersion(void) const { return m_rootVersion; };
61
63 VersionGraphVersionCfg* findVersion(const std::string& _version);
64
66 const VersionGraphVersionCfg* findVersion(const std::string& _version) const;
67
69 bool versionStartingWithNameExists(const std::string& _prefix);
70
72 void removeVersion(const std::string& _version);
73
75 void clear(void);
76
77 private:
78 void addVersionAndChildsToArray(const VersionGraphVersionCfg* _version, JsonArray& _versionsArray, JsonAllocator& _allocator) const;
79
80 std::string m_activeVersionName;
81 std::string m_activeBranchVersionName;
82 VersionGraphVersionCfg* m_rootVersion;
83 };
84
85}
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
JSON Array value.
Definition JSON.h:116
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
Definition VersionGraphCfg.h:13
const std::string & getActiveBranchVersionName(void) const
Returns the active branch version name. The active branch version is the currently active branch....
Definition VersionGraphCfg.h:46
VersionGraphCfg(const VersionGraphCfg &_other)=delete
void setActiveVersionName(const std::string &_version)
Definition VersionGraphCfg.h:33
const VersionGraphVersionCfg * getRootVersion(void) const
Returns the root version. The VersionGraphCfg keeps ownership of the version.
Definition VersionGraphCfg.h:60
const std::string & getActiveVersionName(void) const
Returns the active version name. The active version is the currently active model version.
Definition VersionGraphCfg.h:37
VersionGraphVersionCfg * getRootVersion(void)
Returns the root version. The VersionGraphCfg keeps ownership of the version.
Definition VersionGraphCfg.h:56
void setActiveBranchVersionName(const std::string &_version)
Definition VersionGraphCfg.h:40
Definition VersionGraphVersionCfg.h:22
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30