Ocean
|
This class implements a factory able to create instances of devices. More...
Data Structures | |
class | DeviceDescriptor |
This class stores information to describe and to creator a device. More... | |
Public Member Functions | |
const std::string & | name () const |
Returns the name of this factory. More... | |
Protected Types | |
typedef Callback< Device *, const std::string &, const Device::DeviceType & > | InstanceFunction |
Definition of a callback function creating a specific device. More... | |
typedef std::vector< DeviceDescriptor > | DeviceDescriptors |
Definition of a vector holding device descriptor objects. More... | |
Protected Member Functions | |
Factory (const Factory &factory)=delete | |
Disabled copy constructor. More... | |
Factory (const std::string &name) | |
Creates a new factory. More... | |
virtual | ~Factory () |
Destructs this factory. More... | |
virtual Strings | devices () const |
Returns a list of available devices. More... | |
virtual Strings | devices (const Device::DeviceType type) const |
Returns a list of available devices matching a specified major device type. More... | |
virtual Device::DeviceType | deviceType (const std::string &device) const |
Returns the type of a specified device. More... | |
virtual DeviceRef | device (const std::string &name, const bool useExclusive=false) const |
Creates a new device by its name or returns an existing one if an exclusive use is not necessary. More... | |
virtual DeviceRef | device (const Device::DeviceType type, const bool useExclusive=false) |
Creates a new device defined by a major and a minor device type or returns an existing one if an exclusive use is not necessary. More... | |
DeviceRef | adapterDevice (const Device::DeviceType type, const std::string &name) |
Returns a new adapter measurement device, which is exclusive always. More... | |
Factory & | operator= (const Factory &factory)=delete |
Disabled copy operator. More... | |
bool | registerDevice (const std::string &deviceName, const Device::DeviceType deviceType, const InstanceFunction &deviceInstanceFunction) |
Registes a device at this factory. More... | |
bool | unregisterDevice (const std::string &deviceName) |
Unregisters a previously registered device from this factory. More... | |
Static Protected Member Functions | |
static bool | registerFactory (std::unique_ptr< Factory > &&factory) |
Registers a factory at the manager. More... | |
static bool | unregisterFactory (const std::string &factory) |
Unregisters a factory at the manager. More... | |
static DeviceRef | createDevice (const DeviceDescriptor &deviceDescriptor, bool useExclusive) |
Creates a new device by a given device triple. More... | |
Private Attributes | |
std::string | name_ |
The factory's name. More... | |
DeviceDescriptors | deviceDescriptors_ |
Vector holding all registered devices with name and type. More... | |
Lock | lock_ |
Factory lock. More... | |
Friends | |
class | Manager |
struct | std::default_delete< Factory > |
This class implements a factory able to create instances of devices.
|
protected |
Definition of a vector holding device descriptor objects.
|
protected |
Definition of a callback function creating a specific device.
|
protecteddelete |
Disabled copy constructor.
factory | Object which would be copied |
|
explicitprotected |
Creates a new factory.
name | The name of the factory to create |
|
protectedvirtual |
Destructs this factory.
|
protected |
Returns a new adapter measurement device, which is exclusive always.
type | Type of the device to return |
name | Unique name of the resulting adapter device, this name will be assigned to the new adapter device |
|
staticprotected |
Creates a new device by a given device triple.
deviceDescriptor | The descriptor of the device to be created |
useExclusive | Determines whether the device will be used exclusively |
|
protectedvirtual |
Creates a new device defined by a major and a minor device type or returns an existing one if an exclusive use is not necessary.
type | Type of the device to return |
useExclusive | Determines whether the device will be used exclusively |
|
protectedvirtual |
Creates a new device by its name or returns an existing one if an exclusive use is not necessary.
name | The name of the device to create |
useExclusive | Determines whether the device will be used exclusively |
|
protectedvirtual |
Returns a list of available devices.
|
protectedvirtual |
Returns a list of available devices matching a specified major device type.
type | Type to return device names for |
|
protectedvirtual |
Returns the type of a specified device.
device | Name of the device to return the type for |
|
inline |
Returns the name of this factory.
Disabled copy operator.
factory | Object which would be copied |
|
protected |
Registes a device at this factory.
deviceName | Unique name of the device to register |
deviceType | Type of the device |
deviceInstanceFunction | Function creating an instance of the device |
|
staticprotected |
Registers a factory at the manager.
Each factory should be registered at most once.
factory | The factory to register |
|
protected |
Unregisters a previously registered device from this factory.
Beware: Ensure that the device is not used anymore before unregistering it.
deviceName | The name of the device to unregister, must be valid |
|
staticprotected |
Unregisters a factory at the manager.
Beware: All devices created by the factory must be released before,
otherwise the factory cannot be unregistered.
factory | Name of the factory to unregister |
|
friend |
|
friend |
|
private |
Vector holding all registered devices with name and type.
|
private |
The factory's name.