CRegistry.h
Go to the documentation of this file.
1 #ifndef icomp_CRegistry_included
2 #define icomp_CRegistry_included
3 
4 
6 
7 #include <imod/TModelWrap.h>
8 
9 #include <icomp/IRegistry.h>
10 #include <icomp/CRegistryElement.h>
11 
12 
13 namespace icomp
14 {
15 
16 
20 class CRegistry: virtual public IRegistry
21 {
22 public:
23  // reimplemented (icomp::IRegistry)
24  virtual Ids GetElementIds() const;
25  virtual const ElementInfo* GetElementInfo(const QByteArray& elementId) const;
27  const QByteArray& elementId,
28  const icomp::CComponentAddress& address,
29  bool ensureElementCreated = true);
30  virtual bool RemoveElementInfo(const QByteArray& elementId);
31  virtual bool RenameElement(const QByteArray& oldElementId, const QByteArray& newElementId);
32  virtual Ids GetEmbeddedRegistryIds() const;
33  virtual IRegistry* GetEmbeddedRegistry(const QByteArray& registryId) const;
34  virtual IRegistry* InsertEmbeddedRegistry(const QByteArray& registryId);
35  virtual bool RemoveEmbeddedRegistry(const QByteArray& registryId);
36  virtual bool RenameEmbeddedRegistry(const QByteArray& oldRegistryId, const QByteArray& newRegistryId);
37  virtual const ExportedInterfacesMap& GetExportedInterfacesMap() const;
38  virtual const ExportedElementsMap& GetExportedElementsMap() const;
39  virtual void SetElementInterfaceExported(
40  const QByteArray& elementId,
41  const QByteArray& interfaceName,
42  bool state = true);
43  virtual void SetElementExported(
44  const QByteArray& exportId,
45  const QByteArray& elementId);
46  virtual const QString& GetDescription() const;
47  virtual void SetDescription(const QString& description);
48  virtual const QString& GetKeywords() const;
49  virtual void SetKeywords(const QString& keywords);
50 
51  // reimplemented (iser::ISerializable)
52  virtual bool Serialize(iser::IArchive& archive);
53  virtual quint32 GetMinimalVersion(int versionId) const;
54 
55 protected:
57 
62  const QByteArray& elementId,
63  const icomp::CComponentAddress& address) const;
64  virtual bool SerializeComponents(iser::IArchive& archive);
65  virtual bool SerializeEmbeddedRegistries(iser::IArchive& archive);
66  virtual bool SerializeExportedInterfaces(iser::IArchive& archive);
67  virtual bool SerializeExportedComponents(iser::IArchive& archive);
68 
70  typedef QMap<QByteArray, RegistryPtr> EmbeddedRegistriesMap;
72 
73 private:
74  typedef QMap<QByteArray, ElementInfo> ComponentsMap;
75 
76  ComponentsMap m_componentsMap;
77  ExportedInterfacesMap m_exportedInterfacesMap;
78  ExportedElementsMap m_exportedComponentsMap;
79 
80  QString m_description;
81  QString m_keywords;
82 };
83 
84 
85 } // namespace icomp
86 
87 
88 #endif // !icomp_CRegistry_included
89 
90 
virtual bool SerializeEmbeddedRegistries(iser::IArchive &archive)
virtual void SetDescription(const QString &description)
set human readable description of this registry.
Represents global address of component.
virtual void SetElementExported(const QByteArray &exportId, const QByteArray &elementId)
Set element to be exported.
QMap< QByteArray, RegistryPtr > EmbeddedRegistriesMap
Definition: CRegistry.h:70
QMap< QByteArray, QByteArray > ExportedInterfacesMap
Map assigning interface ID (undecorated) to component ID exporting this interface.
Definition: IRegistry.h:60
virtual void SetKeywords(const QString &keywords)
Set keywords for this registry used for search.
Standard implementation of registry.
Definition: CRegistry.h:20
virtual Ids GetEmbeddedRegistryIds() const
Get list of IDs of embedded registries.
virtual icomp::IRegistryElement * CreateRegistryElement(const QByteArray &elementId, const icomp::CComponentAddress &address) const
Called to create instance of registry element.
virtual bool SerializeComponents(iser::IArchive &archive)
virtual bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
virtual const QString & GetKeywords() const
Get keywords for this registry used for search.
Interface representing information stored in component registry.
Definition: IRegistry.h:30
virtual IRegistry * InsertEmbeddedRegistry(const QByteArray &registryId)
Insert embedded registry with specified ID.
virtual bool RemoveEmbeddedRegistry(const QByteArray &registryId)
Remove embedded registry with specified ID.
virtual ElementInfo * InsertElementInfo(const QByteArray &elementId, const icomp::CComponentAddress &address, bool ensureElementCreated=true)
Insert new attribute info object to collection of attributes.
virtual IRegistry * GetEmbeddedRegistry(const QByteArray &registryId) const
Get access to embedded registry using its ID.
Represent input/output persistence archive.
Definition: IArchive.h:30
virtual Ids GetElementIds() const
Get ID list of existing elements.
virtual bool SerializeExportedComponents(iser::IArchive &archive)
istd::TDelPtr< IRegistry > RegistryPtr
Definition: CRegistry.h:69
Represents element of registry describing component parameters.
Describe information stored with each element.
Definition: IRegistry.h:51
virtual bool RenameEmbeddedRegistry(const QByteArray &oldRegistryId, const QByteArray &newRegistryId)
Rename a embedded registry.
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition: TModelWrap.h:24
EmbeddedRegistriesMap m_embeddedRegistriesMap
Definition: CRegistry.h:71
virtual bool RemoveElementInfo(const QByteArray &elementId)
Removes attribute info structure from this collection.
QSet< QByteArray > Ids
Definition: IRegistry.h:33
virtual bool SerializeExportedInterfaces(iser::IArchive &archive)
QMap< QByteArray, QByteArray > ExportedElementsMap
Map assigning exported sub-component names to internal subcomponent ID's.
Definition: IRegistry.h:65
virtual quint32 GetMinimalVersion(int versionId) const
Get minimal needed version to correct storing of this data.
virtual bool RenameElement(const QByteArray &oldElementId, const QByteArray &newElementId)
Rename an registry element.
virtual const ExportedElementsMap & GetExportedElementsMap() const
Get access to map used to convert exported sub-elements to internal sub-element ID's.
virtual const ElementInfo * GetElementInfo(const QByteArray &elementId) const
Get access to stored attribute info structure.
virtual const QString & GetDescription() const
Get human readable description of this registry.
virtual const ExportedInterfacesMap & GetExportedInterfacesMap() const
Get access to information structure of exported interfaces.
imod::TModelWrap< istd::TChangeDelegator< CRegistryElement > > Element
Definition: CRegistry.h:56
Pointer wrapper providing automatic deleting pointed object during destruction.
Definition: TDelPtr.h:20
virtual void SetElementInterfaceExported(const QByteArray &elementId, const QByteArray &interfaceName, bool state=true)
Enable or disable exporting single or all interfaces of element.

© 2007-2017 Witold Gantzke and Kirill Lepskiy