8 #ifndef META_OCEAN_DEVICES_FACTORY_H
9 #define META_OCEAN_DEVICES_FACTORY_H
30 friend struct std::default_delete<
Factory>;
81 inline const std::string& name()
const;
95 explicit Factory(
const std::string& name);
128 virtual DeviceRef device(
const std::string& name,
const bool useExclusive =
false)
const;
208 type_(
Device::DEVICE_INVALID)
216 instanceFunction_(instanceFunction)
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
This class is the base class for all devices of any type.
Definition: devices/Device.h:28
This class stores information to describe and to creator a device.
Definition: devices/Factory.h:43
InstanceFunction instanceFunction_
Device instance function.
Definition: devices/Factory.h:68
std::string name_
Device name.
Definition: devices/Factory.h:62
DeviceDescriptor()
Creates an empty device triple object.
Definition: devices/Factory.h:207
Device::DeviceType type_
Device type.
Definition: devices/Factory.h:65
This class implements a factory able to create instances of devices.
Definition: devices/Factory.h:28
bool registerDevice(const std::string &deviceName, const Device::DeviceType deviceType, const InstanceFunction &deviceInstanceFunction)
Registes a device at this factory.
Callback< Device *, const std::string &, const Device::DeviceType & > InstanceFunction
Definition of a callback function creating a specific device.
Definition: devices/Factory.h:37
virtual Device::DeviceType deviceType(const std::string &device) const
Returns the type of a specified device.
virtual Strings devices() const
Returns a list of available devices.
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.
virtual ~Factory()
Destructs this factory.
std::vector< DeviceDescriptor > DeviceDescriptors
Definition of a vector holding device descriptor objects.
Definition: devices/Factory.h:74
std::string name_
The factory's name.
Definition: devices/Factory.h:198
Factory(const Factory &factory)=delete
Disabled copy constructor.
DeviceDescriptors deviceDescriptors_
Vector holding all registered devices with name and type.
Definition: devices/Factory.h:201
bool unregisterDevice(const std::string &deviceName)
Unregisters a previously registered device from this factory.
virtual Strings devices(const Device::DeviceType type) const
Returns a list of available devices matching a specified major device type.
Factory(const std::string &name)
Creates a new factory.
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 excl...
Lock lock_
Factory lock.
Definition: devices/Factory.h:204
DeviceRef adapterDevice(const Device::DeviceType type, const std::string &name)
Returns a new adapter measurement device, which is exclusive always.
static bool registerFactory(std::unique_ptr< Factory > &&factory)
Registers a factory at the manager.
static bool unregisterFactory(const std::string &factory)
Unregisters a factory at the manager.
static DeviceRef createDevice(const DeviceDescriptor &deviceDescriptor, bool useExclusive)
Creates a new device by a given device triple.
const std::string & name() const
Returns the name of this factory.
Definition: devices/Factory.h:221
Factory & operator=(const Factory &factory)=delete
Disabled copy operator.
This class implements as singleton-based manager which allows to access all available devices.
Definition: devices/Manager.h:32
This class implements a recursive lock object.
Definition: Lock.h:31
std::vector< std::string > Strings
Definition of a vector holding strings.
Definition: Base.h:162
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15