A Factory for the devices.
More...
#include <devicefactory.h>
A Factory for the devices.
Definition at line 75 of file devicefactory.h.
◆ DeviceTypeId
Provides the device type ID as unsigned int.
Definition at line 82 of file devicefactory.h.
◆ MasterConstructFunc
A function prototype that provides the device factory and communicator.
Definition at line 85 of file devicefactory.h.
◆ StandaloneConstructFunc
A function prototype that provides the communicator.
Definition at line 88 of file devicefactory.h.
◆ DeviceFactory()
DeviceFactory::DeviceFactory |
( |
| ) |
|
◆ ~DeviceFactory()
virtual DeviceFactory::~DeviceFactory |
( |
| ) |
|
|
inlinevirtual |
◆ constructDevice()
Constructs a master device of a specified deviceTypeId with a specified communicator. The created device takes ownership of the Communicator.
- Parameters
-
[in] | deviceTypeId | the unique identifier for this device type |
[in] | comm | The communicator to used for this device |
- Returns
- the newly created device or null when the device was not created.
Definition at line 127 of file devicefactory.cpp.
◆ createMasterDevice()
XsDevice * DeviceFactory::createMasterDevice |
( |
Communicator * |
communicator, |
|
|
bool |
doInitialize = true |
|
) |
| |
|
virtual |
Creates and initializes a master device with a specified communicator. The type of the new device is retrieved from the device id if the communicator. After construction the device will be initialized.
- Parameters
-
[in] | communicator | The communicator, the function always takes ownership of this pointer |
[in] | doInitialize | If false, the device will not be initialized |
- Returns
- the newly created device or null when the device was not created or could not be initialized
- Note
- the initializeDevice method should be overridden in derived classes.
-
when a created device can not be initialized, it will be deleted again along with the supplied communicator
Definition at line 160 of file devicefactory.cpp.
◆ deviceToTypeId()
◆ initializeDevice() [1/2]
bool DeviceFactory::initializeDevice |
( |
XsDevice & |
device | ) |
const |
Initializes a device (if not already initialized)
- Parameters
-
[in] | device | The device to initialize |
- Returns
- true when the device is properly initialized or already initialized, false if initialization failed
Definition at line 239 of file devicefactory.cpp.
◆ initializeDevice() [2/2]
bool DeviceFactory::initializeDevice |
( |
XsDevice * |
dev | ) |
const |
|
protectedvirtual |
Initializes a device. Calls initialize(m_loadedScenarioFile) on the device.
- Parameters
-
[in] | dev | The device to initialize. |
- Returns
- true if initialization is successful.
Definition at line 228 of file devicefactory.cpp.
◆ registerDevices()
void DeviceFactory::registerDevices |
( |
| ) |
|
|
virtual |
◆ registerMasterDeviceType()
Registers a master device type. After registration, the factory is able to cerate an instance of the specified type using the deviceTypeId. A master device is not (yet) owned by an object.
- Parameters
-
[in] | deviceTypeId | the unique identifier for this device type |
[in] | constructFunc | the function used to create an instance of the required type |
- Returns
- true when registration was successful
Definition at line 98 of file devicefactory.cpp.
◆ registerStandaloneDeviceType()
Registers a standalone device type. After registration, the factory is able to cerate an instance of the specified type using the deviceTypeId. A master device is not (yet) owned by an object.
- Parameters
-
[in] | deviceTypeId | the unique identifier for this device type |
[in] | constructFunc | the function used to create an instance of the required type |
- Returns
- true when registration was successful
Definition at line 113 of file devicefactory.cpp.
◆ removeExistingDevice()
void DeviceFactory::removeExistingDevice |
( |
XsDeviceId const & |
deviceId | ) |
|
|
virtual |
Tell our device manager to remove any devices matching deviceId.
Definition at line 218 of file devicefactory.cpp.
◆ m_masterConstructors
◆ m_standaloneConstructors
The documentation for this class was generated from the following files: