OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
EntityProperties.h
Go to the documentation of this file.
1#pragma once
2#pragma warning(disable : 4251)
3
4#include <string>
5#include <map>
6
8
10
11class EntityBase;
12
13namespace ot { class PropertyGroup; };
14
15class __declspec(dllexport) EntityProperties
16{
17public:
18 EntityProperties() : m_needsUpdate(false) {};
19 EntityProperties(const EntityProperties &other);
20 virtual ~EntityProperties();
21
22 void merge(EntityProperties& other);
23
25 bool createProperty(EntityPropertiesBase *property, const std::string &group, bool addToFront = false);
26 bool updateProperty(EntityPropertiesBase *property, const std::string &group);
27 bool deleteProperty(const std::string &_name, const std::string& _groupName = "");
28 bool propertyExists(const std::string &_name, const std::string& _groupName = "");
29
30 EntityPropertiesBase *getProperty(const std::string &_name, const std::string& _groupName = "");
31
32 void setNeedsUpdate(void) { m_needsUpdate = true; };
33 bool anyPropertyNeedsUpdate(void) const { return m_needsUpdate; };
34 void checkWhetherUpdateNecessary(void);
35 void forceResetUpdateForAllProperties();
36
37 void addToConfiguration(EntityBase *root, bool visibleOnly, ot::PropertyGridCfg& _config);
38 void buildFromConfiguration(const ot::PropertyGridCfg& _config, EntityBase* root);
39 void buildFromConfiguration(const ot::PropertyGroup* _groupConfig, EntityBase* root);
40
41 std::string createJSON(EntityBase* root, bool visibleOnly);
42 void buildFromJSON(const std::string& prop, EntityBase* root);
43
44 void checkMatchingProperties(EntityProperties &other);
45 void readFromProperties(const EntityProperties &other, EntityBase *root);
46
47 EntityProperties& operator=(const EntityProperties &other);
48
49 void setAllPropertiesReadOnly(void);
50 void setAllPropertiesNonProtected(void);
51
52 std::list<EntityPropertiesBase*> getListOfAllProperties(void);
53 std::list<EntityPropertiesBase *> getListOfPropertiesWhichNeedUpdate(void);
54 std::list<EntityPropertiesDouble *> getListOfNumericalProperties(void);
55 size_t getNumberOfProperties(void) const { return m_properties.size(); }
56
57 std::list<std::string> getListOfPropertiesForGroup(const std::string &group) const;
58
59 static std::string createKey(const std::string& _name, const std::string& _group);
60 bool isKey(const std::string _accesser) const;
61 std::string extractNameFromKey(const std::string& _key) const;
62
63private:
64 void deleteAllProperties(void);
65
66 bool m_needsUpdate;
67 std::map<std::string, EntityPropertiesBase *> m_properties;
68 std::list<EntityPropertiesBase *> m_propertiesList; // The storage in the list is redundant, but allows to keep the order of the properties
69};
Definition PropertyGridCfg.h:21
Definition PropertyGroup.h:23
Definition Connector.h:8