8#ifndef META_OCEAN_DEVICES_FACTORY_H
9#define META_OCEAN_DEVICES_FACTORY_H
30 friend struct std::default_delete<
Factory>;
85 inline const std::string&
name()
const;
This class implements a container for callback functions.
Definition Callback.h:3454
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:69
std::string name_
Device name.
Definition devices/Factory.h:63
unsigned int priority_
The device priority.
Definition devices/Factory.h:72
DeviceDescriptor()
Creates an empty device triple object.
Definition devices/Factory.h:220
Device::DeviceType type_
Device type.
Definition devices/Factory.h:66
static Factory * factory(const std::string &name, TemporaryScopedLock &scopedLock)
Returns a specified factory.
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.
bool registerDevice(const std::string &deviceName, const Device::DeviceType deviceType, const InstanceFunction &deviceInstanceFunction, const unsigned int priority=100u)
Registes a device at this factory.
std::string name_
The factory's name.
Definition devices/Factory.h:211
Factory(const Factory &factory)=delete
Disabled copy constructor.
DeviceDescriptors deviceDescriptors_
Vector holding all registered devices with name and type.
Definition devices/Factory.h:214
bool unregisterDevice(const std::string &deviceName)
Unregisters a previously registered device from 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 Strings devices(const Device::DeviceType type) const
Returns a list of available devices matching a specified major device type.
Factory & operator=(const Factory &factory)=delete
Disabled copy operator.
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:217
std::vector< DeviceDescriptor > DeviceDescriptors
Definition of a vector holding device descriptor objects.
Definition devices/Factory.h:78
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:235
friend class Manager
Definition devices/Factory.h:29
This class implements a recursive lock object.
Definition Lock.h:31
This class implements a recursive scoped lock object allowing to release the lock before the scoped o...
Definition Lock.h:266
std::vector< std::string > Strings
Definition of a vector holding strings.
Definition Base.h:162
ObjectRef< Device > DeviceRef
This class implements a device reference with an internal reference counter.
Definition DeviceRef.h:27
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15