stmm-input-doc  0.17.0
Public Member Functions | List of all members
stmi::testing::FakeDevice< CAPA > Class Template Reference

Fake device template that implements one capability class. More...

Inheritance diagram for stmi::testing::FakeDevice< CAPA >:
Inheritance graph
[legend]

Public Member Functions

 FakeDevice (const shared_ptr< DeviceManager > &refDeviceManager, const std::string &sName, const shared_ptr< CAPA > &refCapability) noexcept
 Constructor. More...
 
std::string getName () const noexcept override
 
shared_ptr< DeviceManagergetDeviceManager () const noexcept override
 The device manager that manages the device. More...
 
shared_ptr< CapabilitygetCapability (const Capability::Class &oClass) const noexcept override
 Requests the instance of a capability class. More...
 
std::vector< Capability::ClassgetCapabilityClasses () const noexcept override
 The capability classes supported by this device. More...
 
shared_ptr< CapabilitygetCapability (int32_t nCapabilityId) const noexcept override
 Returns the capability with the given id, or null if not found. More...
 
std::vector< int32_t > getCapabilities () const noexcept override
 Returns the ids of all the device's capabilities. More...
 
- Public Member Functions inherited from stmi::Device
virtual ~Device () noexcept=default
 
int32_t getId () const noexcept
 The device id. More...
 
template<typename TCapa >
bool getCapability (shared_ptr< TCapa > &refCapa) const noexcept
 Request a registered capability from this device. More...
 

Additional Inherited Members

- Protected Member Functions inherited from stmi::Device
 Device () noexcept
 

Detailed Description

template<class CAPA>
class stmi::testing::FakeDevice< CAPA >

Fake device template that implements one capability class.

Constructor & Destructor Documentation

◆ FakeDevice()

template<class CAPA>
stmi::testing::FakeDevice< CAPA >::FakeDevice ( const shared_ptr< DeviceManager > &  refDeviceManager,
const std::string &  sName,
const shared_ptr< CAPA > &  refCapability 
)
inlinenoexcept

Constructor.

If the name is empty one is automatically created. Instances should be created with std::make_shared().

Parameters
refDeviceManagerThe device manager. Can be null.
sNameThe name of the device. Can be empty.
refCapabilityThe capability instance of the device. Cannot be null.

Member Function Documentation

◆ getCapabilities()

template<class CAPA>
std::vector<int32_t> stmi::testing::FakeDevice< CAPA >::getCapabilities ( ) const
inlineoverridevirtualnoexcept

Returns the ids of all the device's capabilities.

Returns
The set of capability ids.

Implements stmi::Device.

◆ getCapability() [1/2]

template<class CAPA>
shared_ptr<Capability> stmi::testing::FakeDevice< CAPA >::getCapability ( const Capability::Class oClass) const
inlineoverridevirtualnoexcept

Requests the instance of a capability class.

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

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

Implements stmi::Device.

◆ getCapability() [2/2]

template<class CAPA>
shared_ptr<Capability> stmi::testing::FakeDevice< CAPA >::getCapability ( int32_t  nCapabilityId) const
inlineoverridevirtualnoexcept

Returns the capability with the given id, or null if not found.

Implements stmi::Device.

◆ getCapabilityClasses()

template<class CAPA>
std::vector<Capability::Class> stmi::testing::FakeDevice< CAPA >::getCapabilityClasses ( ) const
inlineoverridevirtualnoexcept

The capability classes supported by this device.

Returns
The set of registered capability classes.

Implements stmi::Device.

◆ getDeviceManager()

template<class CAPA>
shared_ptr<DeviceManager> stmi::testing::FakeDevice< CAPA >::getDeviceManager ( ) const
inlineoverridevirtualnoexcept

The device manager that manages the device.

As a convention Device instances should hold a weak_ptr to their manager to avoid reference cycles.

Returns
The device manager or null if the device is no longer attached to its manager.

Implements stmi::Device.

◆ getName()

template<class CAPA>
std::string stmi::testing::FakeDevice< CAPA >::getName ( ) const
inlineoverridevirtualnoexcept
Returns
Name of the device. Not necessarily unique among devices.

Implements stmi::Device.