ICF 3.1.1.10
Technical documentation of ICF Libraries
CRegistry.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
10
11#include <imod/TModelWrap.h>
12
13#include <icomp/IRegistry.h>
15
16
17namespace icomp
18{
19
20
24class CRegistry: virtual public IRegistry
25{
26public:
27 // reimplemented (icomp::IRegistry)
28 Ids GetElementIds() const override;
29 const ElementInfo* GetElementInfo(const QByteArray& elementId) const override;
31 const QByteArray& elementId,
32 const CComponentAddress& address,
33 bool ensureElementCreated = true) override;
34 bool RemoveElementInfo(const QByteArray& elementId) override;
35 bool RenameElement(const QByteArray& oldElementId, const QByteArray& newElementId) override;
36 Ids GetEmbeddedRegistryIds() const override;
37 IRegistry* GetEmbeddedRegistry(const QByteArray& registryId) const override;
38 IRegistry* InsertEmbeddedRegistry(const QByteArray& registryId) override;
39 bool RemoveEmbeddedRegistry(const QByteArray& registryId) override;
40 bool RenameEmbeddedRegistry(const QByteArray& oldRegistryId, const QByteArray& newRegistryId) override;
44 const QByteArray& elementId,
45 const QByteArray& interfaceName,
46 bool state = true) override;
48 const QByteArray& exportId,
49 const QByteArray& elementId) override;
50 const QString& GetDescription() const override;
51 void SetDescription(const QString& description) override;
52 const QString& GetKeywords() const override;
53 void SetKeywords(const QString& keywords) override;
54
55 // reimplemented (iser::ISerializable)
56 bool Serialize(iser::IArchive& archive) override;
57
58protected:
60
64 virtual std::unique_ptr<IRegistryElement> CreateRegistryElement(
65 const QByteArray& elementId,
66 const CComponentAddress& address) const;
67 virtual bool SerializeComponents(iser::IArchive& archive);
71
72 typedef std::unique_ptr<IRegistry> RegistryPtr;
73 typedef std::map<QByteArray, RegistryPtr> EmbeddedRegistriesMap;
75
76private:
77 typedef std::map<QByteArray, ElementInfo> ComponentsMap;
78
79 ComponentsMap m_componentsMap;
80 ExportedInterfacesMap m_exportedInterfacesMap;
81 ExportedElementsMap m_exportedComponentsMap;
82
83 QString m_description;
84 QString m_keywords;
85};
86
87
88} // namespace icomp
89
90
Represents global address of component.
Standard implementation of registry.
Definition CRegistry.h:25
void SetElementInterfaceExported(const QByteArray &elementId, const QByteArray &interfaceName, bool state=true) override
Enable or disable exporting single or all interfaces of element.
void SetElementExported(const QByteArray &exportId, const QByteArray &elementId) override
Set element to be exported.
const ElementInfo * GetElementInfo(const QByteArray &elementId) const override
Get access to stored attribute info structure.
EmbeddedRegistriesMap m_embeddedRegistriesMap
Definition CRegistry.h:74
bool RenameEmbeddedRegistry(const QByteArray &oldRegistryId, const QByteArray &newRegistryId) override
Rename a embedded registry.
virtual bool SerializeExportedInterfaces(iser::IArchive &archive)
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual bool SerializeExportedComponents(iser::IArchive &archive)
const ExportedInterfacesMap & GetExportedInterfacesMap() const override
Get access to information structure of exported interfaces.
const QString & GetKeywords() const override
Get keywords for this registry used for search.
Ids GetElementIds() const override
Get ID list of existing elements.
const ExportedElementsMap & GetExportedElementsMap() const override
Get access to map used to convert exported sub-elements to internal sub-element ID's.
std::map< QByteArray, RegistryPtr > EmbeddedRegistriesMap
Definition CRegistry.h:73
void SetDescription(const QString &description) override
set human readable description of this registry.
std::unique_ptr< IRegistry > RegistryPtr
Definition CRegistry.h:72
IRegistry * InsertEmbeddedRegistry(const QByteArray &registryId) override
Insert embedded registry with specified ID.
void SetKeywords(const QString &keywords) override
Set keywords for this registry used for search.
bool RenameElement(const QByteArray &oldElementId, const QByteArray &newElementId) override
Rename an registry element.
virtual std::unique_ptr< IRegistryElement > CreateRegistryElement(const QByteArray &elementId, const CComponentAddress &address) const
Called to create instance of registry element.
IRegistry * GetEmbeddedRegistry(const QByteArray &registryId) const override
Get access to embedded registry using its ID.
const QString & GetDescription() const override
Get human readable description of this registry.
imod::TModelWrap< istd::TChangeDelegator< CRegistryElement > > Element
Definition CRegistry.h:59
ElementInfo * InsertElementInfo(const QByteArray &elementId, const CComponentAddress &address, bool ensureElementCreated=true) override
Insert new attribute info object to collection of attributes.
bool RemoveElementInfo(const QByteArray &elementId) override
Removes attribute info structure from this collection.
virtual bool SerializeEmbeddedRegistries(iser::IArchive &archive)
virtual bool SerializeComponents(iser::IArchive &archive)
Ids GetEmbeddedRegistryIds() const override
Get list of IDs of embedded registries.
bool RemoveEmbeddedRegistry(const QByteArray &registryId) override
Remove embedded registry with specified ID.
Interface representing information stored in component registry.
Definition IRegistry.h:30
QSet< QByteArray > Ids
Definition IRegistry.h:32
std::map< QByteArray, QByteArray > ExportedElementsMap
Map assigning exported sub-component names to internal subcomponent ID's.
Definition IRegistry.h:64
std::map< QByteArray, QByteArray > ExportedInterfacesMap
Map assigning interface ID (undecorated) to component ID exporting this interface.
Definition IRegistry.h:59
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
Represent input/output persistence archive.
Definition IArchive.h:34
Package with interfaces and class used for components concept.
Describe information stored with each element.
Definition IRegistry.h:51

© Witold Gantzke and Kirill Lepskiy