ACF $AcfVersion:0$
CRegistry.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QMutex>
7
8// ACF includes
10#include <imod/TModelWrap.h>
11#include <icomp/IRegistry.h>
13
14
15namespace icomp
16{
17
18
41class CRegistry: virtual public IRegistry
42{
43public:
45
46 // reimplemented (icomp::IRegistry)
47 virtual Ids GetElementIds() const override;
48 virtual const ElementInfo* GetElementInfo(const QByteArray& elementId) const override;
50 const QByteArray& elementId,
51 const icomp::CComponentAddress& address,
52 bool ensureElementCreated = true) override;
53 virtual bool RemoveElementInfo(const QByteArray& elementId) override;
54 virtual bool RenameElement(const QByteArray& oldElementId, const QByteArray& newElementId) override;
55 virtual Ids GetEmbeddedRegistryIds() const override;
56 virtual IRegistry* GetEmbeddedRegistry(const QByteArray& registryId) const override;
57 virtual IRegistry* InsertEmbeddedRegistry(const QByteArray& registryId) override;
58 virtual bool RemoveEmbeddedRegistry(const QByteArray& registryId) override;
59 virtual bool RenameEmbeddedRegistry(const QByteArray& oldRegistryId, const QByteArray& newRegistryId) override;
60 virtual const ExportedInterfacesMap& GetExportedInterfacesMap() const override;
61 virtual const ExportedElementsMap& GetExportedElementsMap() const override;
63 const QByteArray& elementId,
64 const QByteArray& interfaceName,
65 bool state = true) override;
66 virtual void SetElementExported(
67 const QByteArray& exportId,
68 const QByteArray& elementId) override;
69 virtual const QString& GetDescription() const override;
70 virtual void SetDescription(const QString& description) override;
71 virtual const QString& GetKeywords() const override;
72 virtual void SetKeywords(const QString& keywords) override;
73
74 // reimplemented (iser::ISerializable)
75 virtual bool Serialize(iser::IArchive& archive) override;
76 virtual quint32 GetMinimalVersion(int versionId) const override;
77
78protected:
80
85 const QByteArray& elementId,
86 const icomp::CComponentAddress& address) const;
87 virtual bool SerializeComponents(iser::IArchive& archive);
91
93 typedef QMap<QByteArray, RegistryPtr> EmbeddedRegistriesMap;
95
96private:
97 typedef QMap<QByteArray, ElementInfo> ComponentsMap;
98
99 ComponentsMap m_componentsMap;
100 ExportedInterfacesMap m_exportedInterfacesMap;
101 ExportedElementsMap m_exportedComponentsMap;
102
103 QString m_description;
104 QString m_keywords;
105
106#if QT_VERSION >= 0x060000
107 mutable QRecursiveMutex m_mutex;
108#else
109 mutable QMutex m_mutex;
110#endif
111};
112
113
114} // namespace icomp
115
116
117
118
Represents global address of component.
Standard implementation of registry.
Definition CRegistry.h:42
EmbeddedRegistriesMap m_embeddedRegistriesMap
Definition CRegistry.h:94
virtual bool SerializeExportedInterfaces(iser::IArchive &archive)
virtual bool RenameElement(const QByteArray &oldElementId, const QByteArray &newElementId) override
Rename an registry element.
virtual IRegistry * InsertEmbeddedRegistry(const QByteArray &registryId) override
Insert embedded registry with specified ID.
virtual const ExportedInterfacesMap & GetExportedInterfacesMap() const override
Get access to information structure of exported interfaces.
virtual bool SerializeExportedComponents(iser::IArchive &archive)
virtual const ExportedElementsMap & GetExportedElementsMap() const override
Get access to map used to convert exported sub-elements to internal sub-element ID's.
virtual icomp::IRegistryElement * CreateRegistryElement(const QByteArray &elementId, const icomp::CComponentAddress &address) const
Called to create instance of registry element.
virtual bool RenameEmbeddedRegistry(const QByteArray &oldRegistryId, const QByteArray &newRegistryId) override
Rename a embedded registry.
virtual bool RemoveElementInfo(const QByteArray &elementId) override
Removes attribute info structure from this collection.
virtual ElementInfo * InsertElementInfo(const QByteArray &elementId, const icomp::CComponentAddress &address, bool ensureElementCreated=true) override
Insert new attribute info object to collection of attributes.
virtual bool RemoveEmbeddedRegistry(const QByteArray &registryId) override
Remove embedded registry with specified ID.
virtual void SetElementExported(const QByteArray &exportId, const QByteArray &elementId) override
Set element to be exported.
virtual void SetElementInterfaceExported(const QByteArray &elementId, const QByteArray &interfaceName, bool state=true) override
Enable or disable exporting single or all interfaces of element.
virtual void SetDescription(const QString &description) override
set human readable description of this registry.
virtual void SetKeywords(const QString &keywords) override
Set keywords for this registry used for search.
virtual Ids GetElementIds() const override
Get ID list of existing elements.
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual IRegistry * GetEmbeddedRegistry(const QByteArray &registryId) const override
Get access to embedded registry using its ID.
virtual const ElementInfo * GetElementInfo(const QByteArray &elementId) const override
Get access to stored attribute info structure.
virtual quint32 GetMinimalVersion(int versionId) const override
Get minimal needed version to correct storing of this data.
virtual bool SerializeEmbeddedRegistries(iser::IArchive &archive)
QMap< QByteArray, RegistryPtr > EmbeddedRegistriesMap
Definition CRegistry.h:93
virtual const QString & GetDescription() const override
Get human readable description of this registry.
virtual bool SerializeComponents(iser::IArchive &archive)
virtual const QString & GetKeywords() const override
Get keywords for this registry used for search.
istd::TDelPtr< IRegistry > RegistryPtr
Definition CRegistry.h:92
virtual Ids GetEmbeddedRegistryIds() const override
Get list of IDs of embedded registries.
imod::TModelWrap< istd::TChangeDelegator< CRegistryElement > > Element
Definition CRegistry.h:79
Represents element of registry describing component parameters.
Interface representing information stored in component registry.
Definition IRegistry.h:48
QSet< QByteArray > Ids
Definition IRegistry.h:50
QMap< QByteArray, QByteArray > ExportedInterfacesMap
Map assigning interface ID (undecorated) to component ID exporting this interface.
Definition IRegistry.h:77
QMap< QByteArray, QByteArray > ExportedElementsMap
Map assigning exported sub-component names to internal subcomponent ID's.
Definition IRegistry.h:82
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:24
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Pointer wrapper providing automatic deleting pointed object during destruction.
Definition TDelPtr.h:21
Package with interfaces and class used for components concept.
Describe information stored with each element.
Definition IRegistry.h:69