|
ImagingTools Core SDK
|
Base implementation class for composite device instances. More...
#include <CCompositeDeviceInstanceBase.h>
Public Types | |
| typedef CDeviceInstanceBase | BaseClass |
| Base class type alias. | |
Public Types inherited from imtdev::IDeviceInstance | |
| enum | IdentifierTypes { IT_SERIAL } |
| Types of device identifiers. More... | |
| enum | VersionIds { VI_FIRMWARE_VERSION_MAJOR = iser::IVersionInfo::UserVersionId , VI_FIRMWARE_VERSION_MINOR , VI_FIRMWARE_VERSION_PATCH , VI_HARDWARE_VERSION_MAJOR , VI_HARDWARE_VERSION_MINOR , VI_HARDWARE_VERSION_PATCH } |
| Version information identifiers. More... | |
Public Member Functions | |
| CCompositeDeviceInstanceBase () | |
| Constructor. | |
| ~CCompositeDeviceInstanceBase () | |
| Destructor. | |
| virtual QByteArray | AddSubDevice (const QByteArray &deviceTypeId, const QString &name, const QString &description=QString(), const istd::IChangeable *defaultValuePtr=nullptr, const QByteArray &proposedId=QByteArray()) override |
| Add new sub-device. | |
| virtual bool | RemoveSubDevice (const QByteArray &id) override |
| Remove sub-device. | |
| virtual const ICompositeDeviceSpecification * | GetCompositeDeviceSpecification () const override |
| Get composite device specification. | |
| virtual QSet< QByteArray > | GetSupportedSubDeviceTypeIds () const override |
| Get supported sub-device type IDs. | |
| virtual const imtbase::ICollectionInfo & | GetSubDeviceList () const override |
| Get sub-device list. | |
| virtual const IDeviceInstance * | GetSubDeviceInstance (const QByteArray &subDeviceId) const override |
| Get specific sub-device instance. | |
| virtual int | GetSupportedOperations () const override |
| Get supported operations. | |
| virtual bool | CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override |
| Copy from another composite device. | |
| virtual bool | ResetData (CompatibilityMode mode=CM_WITHOUT_REFS) override |
| Reset composite device data. | |
Public Member Functions inherited from imtdev::CDeviceInstanceBase | |
| CDeviceInstanceBase () | |
| Constructor. | |
| ~CDeviceInstanceBase () | |
| Destructor. | |
| virtual bool | SetIdentifier (IdentifierTypes idType, const QByteArray &id) override |
| Set device identifier. | |
| virtual bool | SetVersion (int versionId, quint32 version, const QString &description) override |
| Set version information component. | |
| virtual iattr::IAttributesManager * | GetAttributesManager () override |
| Get attributes manager for modification. | |
| virtual QByteArray | GetIdentifier (int idType) const override |
| Get device identifier. | |
| virtual const iser::IVersionInfo & | GetVersion () const override |
| Get version information. | |
| virtual const iattr::IAttributesProvider * | GetAttributes () const override |
| Get attributes provider (read-only) | |
Public Member Functions inherited from imtdev::IDeviceInstance | |
| virtual const IDeviceSpecification & | GetDeviceSpecification () const =0 |
| Get device static info associated with device instance. | |
Protected Member Functions | |
| virtual IDeviceInstance * | CreateDeviceInstance (const QByteArray &deviceTypeId) const |
| Create device instance (factory method) | |
Protected Member Functions inherited from imtdev::CDeviceInstanceBase | |
| virtual bool | EnsureAttributesCreated () const |
| Ensure attributes provider is created. | |
Additional Inherited Members | |
Protected Attributes inherited from imtdev::CDeviceInstanceBase | |
| imod::CModelUpdateBridge | m_updateBridge |
| Bridge for change notifications (mutable for change tracking in const methods) | |
| std::unique_ptr< iattr::IAttributesProvider > | m_attributesPtr |
| Lazy-created attributes (mutable to allow creation in const GetAttributes()) | |
Base implementation class for composite device instances.
CCompositeDeviceInstanceBase extends CDeviceInstanceBase to support hierarchical device structures with sub-devices. It provides complete implementation of IEditableCompositeDeviceInstance, enabling dynamic creation and management of device trees.
This class implements the Composite Pattern, allowing devices to contain other devices in a parent-child relationship. Sub-devices can themselves be composite, enabling multi-level hierarchies.
Definition at line 102 of file CCompositeDeviceInstanceBase.h.
| imtdev::CCompositeDeviceInstanceBase::CCompositeDeviceInstanceBase | ( | ) |
Constructor.
Initializes the composite device instance with empty sub-device list. Inherits base device instance initialization from CDeviceInstanceBase.
| imtdev::CCompositeDeviceInstanceBase::~CCompositeDeviceInstanceBase | ( | ) |
Destructor.
Cleans up all sub-devices and releases resources.
|
overridevirtual |
Add new sub-device.
Creates and adds a new sub-device instance with the specified type and properties. The device type must be supported by the composite device specification. Calls virtual CreateDeviceInstance() to create the instance, then stores it.
| deviceTypeId | Type identifier of the sub-device to create |
| name | Human-readable name for the sub-device |
| description | Optional description |
| defaultValuePtr | Optional default configuration (unused in base implementation) |
| proposedId | Optional proposed ID; if empty, auto-generated |
Implements imtdev::IEditableCompositeDeviceInstance.
|
overridevirtual |
Copy from another composite device.
Copies all data including sub-devices from another composite device instance. Performs deep copy of the entire device tree.
| object | Source object to copy from |
| mode | Compatibility mode for copying |
Reimplemented from imtdev::CDeviceInstanceBase.
|
protectedvirtual |
Create device instance (factory method)
Virtual factory method for creating sub-device instances based on device type ID. Derived classes must override this to provide actual device instance creation.
| deviceTypeId | Type identifier of the device to create |
|
overridevirtual |
Get composite device specification.
Base implementation returns nullptr. Derived classes should override to provide actual composite device specification.
Implements imtdev::ICompositeDeviceInstance.
|
overridevirtual |
Get specific sub-device instance.
Retrieves the device instance for a sub-device with the given ID.
| subDeviceId | Unique identifier of the sub-device |
Implements imtdev::ICompositeDeviceInstance.
|
overridevirtual |
Get sub-device list.
Returns the collection containing all sub-devices in this composite.
Implements imtdev::ICompositeDeviceInstance.
|
overridevirtual |
Get supported operations.
Returns flags indicating supported operations (copy, reset, etc.). Includes base class operations plus composite-specific operations.
Reimplemented from imtdev::CDeviceInstanceBase.
|
overridevirtual |
Get supported sub-device type IDs.
Returns the set of device type IDs that can be added as sub-devices. Base implementation queries the composite device specification.
Implements imtdev::ICompositeDeviceInstance.
|
overridevirtual |
Remove sub-device.
Removes an existing sub-device from the composite. Triggers change notification.
| id | Unique identifier of the sub-device to remove |
Implements imtdev::IEditableCompositeDeviceInstance.
|
overridevirtual |
Reset composite device data.
Clears all data including removing all sub-devices.
| mode | Compatibility mode for reset |
Reimplemented from imtdev::CDeviceInstanceBase.