stmm-input-doc  0.17.0
Classes | Public Member Functions | Protected Member Functions | List of all members
stmi::StdDeviceManager Class Reference

Helper class for implementing a device manager with DeviceMgmtCapability. More...

Inheritance diagram for stmi::StdDeviceManager:
Inheritance graph
[legend]

Public Member Functions

std::vector< Capability::ClassgetCapabilityClasses () const noexcept override
 The registered capability classes of the device manager. More...
 
shared_ptr< CapabilitygetCapability (const Capability::Class &oClass) const noexcept override
 Requests the instance of a capability class. More...
 
shared_ptr< CapabilitygetCapability (int32_t nCapabilityId) const noexcept override
 Returns the device manager's capability with the given id, or null if not found. More...
 
- Public Member Functions inherited from stmi::BasicDeviceManager
shared_ptr< DevicegetDevice (int32_t nDeviceId) const noexcept override
 Returns the device with the given id, or null if not found. More...
 
std::vector< int32_t > getDevicesWithCapabilityClass (const Capability::Class &oCapabilityClass) const noexcept override
 Returns the ids of the devices that have the given capability class. More...
 
std::vector< int32_t > getDevices () const noexcept override
 Returns the ids of all the device manager's devices. More...
 
std::vector< Capability::ClassgetCapabilityClasses () const noexcept override
 The registered capability classes of the device manager. More...
 
std::vector< Capability::ClassgetDeviceCapabilityClasses () const noexcept override
 The registered capability classes of the device manager's devices. More...
 
std::vector< Event::ClassgetEventClasses () const noexcept override
 The registered event classes the device manager and all its devices can send. More...
 
bool isEventClassEnabled (const Event::Class &oEventClass) const noexcept override
 Tells whether an event class is enabled. More...
 
void enableEventClass (const Event::Class &oEventClass) noexcept override
 Enables an event class. More...
 
bool addAccessor (const shared_ptr< Accessor > &) noexcept override
 Default empty implementation. More...
 
bool removeAccessor (const shared_ptr< Accessor > &) noexcept override
 Default empty implementation. More...
 
bool hasAccessor (const shared_ptr< Accessor > &) noexcept override
 Default empty implementation. More...
 
bool addEventListener (const shared_ptr< EventListener > &refEventListener, const shared_ptr< CallIf > &refCallIf) noexcept override
 Adds an event listener with its callif condition to the device manager. More...
 
bool addEventListener (const shared_ptr< EventListener > &refEventListener) noexcept override
 Adds an event listener to the device manager. More...
 
bool removeEventListener (const shared_ptr< EventListener > &refEventListener, bool bFinalize) noexcept override
 Removes an event listener from the device manager. More...
 
bool removeEventListener (const shared_ptr< EventListener > &refEventListener) noexcept override
 Removes an event listener from the device manager. More...
 
- Public Member Functions inherited from stmi::ChildDeviceManager
shared_ptr< ParentDeviceManagergetParent () const noexcept
 Gets the parent of this child device manager. More...
 
shared_ptr< ParentDeviceManagergetParent () noexcept
 Gets the parent of this child device manager. More...
 
shared_ptr< ParentDeviceManagergetRoot () const noexcept
 Returns the root device manager. More...
 
shared_ptr< ParentDeviceManagergetRoot () noexcept
 Returns the root device manager. More...
 
bool isParent () const noexcept
 Tells whether this instance is also a ParentDeviceManager. More...
 
shared_ptr< ParentDeviceManagergetAsParent () const noexcept
 If a parent returns this object as a parent. More...
 
shared_ptr< ParentDeviceManagergetAsParent () noexcept
 If a parent returns this object as a parent. More...
 
- Public Member Functions inherited from stmi::DeviceManager
virtual ~DeviceManager () noexcept=default
 
template<typename TCapa >
bool getCapability (shared_ptr< TCapa > &refCapa) const noexcept
 Request a registered device manager capability. More...
 

Protected Member Functions

 StdDeviceManager (const std::vector< Capability::Class > &aDeviceCapabitityClasses, const std::vector< Event::Class > &aEventClasses, bool bEnableEventClasses, const std::vector< Event::Class > &aEnDisableEventClasses) noexcept
 Constructor. More...
 
void sendDeviceMgmtToListeners (const DeviceMgmtEvent::DEVICE_MGMT_TYPE &eMgmtType, const shared_ptr< Device > &refDevice) noexcept
 Sends a device mgmt event to the listeners. More...
 
void checkWeakPtr () const noexcept
 
shared_ptr< DeviceMgmtCapabilitygetDeviceMgmtCapability () noexcept
 
- Protected Member Functions inherited from stmi::BasicDeviceManager
 BasicDeviceManager (const std::vector< Capability::Class > &aCapabitityClasses, const std::vector< Capability::Class > &aDeviceCapabitityClasses, const std::vector< Event::Class > &aEventClasses, bool bEnableEventClasses, const std::vector< Event::Class > &aEnDisableEventClasses) noexcept
 Constructor. More...
 
bool addDevice (const shared_ptr< Device > &refDevice) noexcept
 Adding a device. More...
 
bool removeDevice (const shared_ptr< Device > &refDevice) noexcept
 Removing a device. More...
 
bool isWithinAListenerCallback () const noexcept
 Tells whether the caller is within a listener callback. More...
 
virtual void finalizeListener (ListenerData &oListenerData) noexcept=0
 Finalize listener. More...
 
shared_ptr< const std::list< ListenerData *> > getListeners () noexcept
 Returns the listeners data pointers. More...
 
int32_t getEventClassIndex (const Event::Class &oEventClass) const noexcept
 Returns the index of the event class in the array passed to the constructor. More...
 
void resetExtraDataOfAllListeners () noexcept
 Calls overloaded ListenerExtraData::reset() for each listener. More...
 
- Protected Member Functions inherited from stmi::ChildDeviceManager
 ChildDeviceManager () noexcept
 Constructor. More...
 
- Protected Member Functions inherited from stmi::DeviceManager
 DeviceManager () noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from stmi::DeviceManager
static int64_t getNowTimeMicroseconds () noexcept
 Current time from epoch in microseconds. More...
 
- Static Protected Member Functions inherited from stmi::BasicDeviceManager
static uint64_t getUniqueTimeStamp () noexcept
 Returns a unique time stamp. More...
 

Detailed Description

Helper class for implementing a device manager with DeviceMgmtCapability.

Constructor & Destructor Documentation

◆ StdDeviceManager()

stmi::StdDeviceManager::StdDeviceManager ( const std::vector< Capability::Class > &  aDeviceCapabitityClasses,
const std::vector< Event::Class > &  aEventClasses,
bool  bEnableEventClasses,
const std::vector< Event::Class > &  aEnDisableEventClasses 
)
protectednoexcept

Constructor.

If bEnableEventClasses is true then all event classes in aEnDisableEventClasses are enabled, all others disabled, if false then all event classes supported by this instance are enabled except those in aEnDisableEventClasses. StdDeviceManager doesn't allow disabling event classes once constructed, only enabling. Example: To enable all the event classes supported by this instance pass

bEnableEventClasses = false,  aEnDisableEventClasses = {}
Parameters
aDeviceCapabitityClassesVector of registered (device) capability classes supported by this manager.
aEventClassesVector of registered event classes supported by this manager.
bEnableEventClassesWhether to enable or disable all but aEnDisableEventClasses.
aEnDisableEventClassesThe event classes to be enabled or disabled according to bEnableEventClasses.

Member Function Documentation

◆ checkWeakPtr()

void stmi::StdDeviceManager::checkWeakPtr ( ) const
protectednoexcept

◆ getCapability() [1/2]

shared_ptr<Capability> stmi::StdDeviceManager::getCapability ( const Capability::Class oClass) const
overridevirtualnoexcept

Requests the instance of a capability class.

If the device manager doesn't have the capability null is returned.

Parameters
oClassThe requested registered device manager capability class.
Returns
The capability or null.

Implements stmi::DeviceManager.

◆ getCapability() [2/2]

shared_ptr<Capability> stmi::StdDeviceManager::getCapability ( int32_t  nCapabilityId) const
overridevirtualnoexcept

Returns the device manager's capability with the given id, or null if not found.

Implements stmi::DeviceManager.

◆ getCapabilityClasses()

std::vector<Capability::Class> stmi::StdDeviceManager::getCapabilityClasses ( ) const
overridevirtualnoexcept

The registered capability classes of the device manager.

Example: the vector {DeviceMgmtCapability::getClass()} is returned.

Returns
The set of registered device manager capability classes.

Implements stmi::DeviceManager.

◆ getDeviceMgmtCapability()

shared_ptr<DeviceMgmtCapability> stmi::StdDeviceManager::getDeviceMgmtCapability ( )
protectednoexcept

◆ sendDeviceMgmtToListeners()

void stmi::StdDeviceManager::sendDeviceMgmtToListeners ( const DeviceMgmtEvent::DEVICE_MGMT_TYPE eMgmtType,
const shared_ptr< Device > &  refDevice 
)
protectednoexcept

Sends a device mgmt event to the listeners.

The event is sent to a listener only if its callif permits it and the event class is enabled.

Parameters
eMgmtTypeThe type.
refDeviceThe device involved. Cannot be null.