Ocean
Ocean::Devices::Device Class Referenceabstract

This class is the base class for all devices of any type. More...

Inheritance diagram for Ocean::Devices::Device:

Data Structures

class  DeviceType
 Definition of a class holding the major and minor device type. More...
 

Public Types

enum  MajorType : uint32_t { DEVICE_INVALID = 0u , DEVICE_MEASUREMENT = (1u << 0u) , DEVICE_SENSOR = (1u << 1u) | DEVICE_MEASUREMENT , DEVICE_TRACKER = (1u << 2u) | DEVICE_MEASUREMENT }
 Definition of all major device types. More...
 
enum  MinorType : uint32_t { MINOR_INVALID = 0u }
 Base definition of a minor type. More...
 

Public Member Functions

const std::string & name () const
 Returns the name of this device. More...
 
virtual const std::string & library () const =0
 Returns the name of the owner library. More...
 
virtual bool isStarted () const
 Returns whether this device is active. More...
 
bool isValid () const
 Returns whether this device is valid. More...
 
bool isExclusive () const
 Returns whether this device can be use exclusively. More...
 
virtual bool start ()
 Starts the device. More...
 
virtual bool pause ()
 Pauses the device. More...
 
virtual bool stop ()
 Stops the device. More...
 
virtual bool setParameter (const std::string &parameter, const Value &value)
 Sets an abstract parameter of this device. More...
 
virtual bool parameter (const std::string &parameter, Value &value)
 Returns an abstract parameter of this device. More...
 
DeviceType type () const
 Returns the major and minor type of this device. More...
 

Static Public Member Functions

static std::string translateMajorType (const MajorType majorType)
 Translates the major devices type to a readable string. More...
 
static MajorType translateMajorType (const std::string &majorType)
 Translates the major devices type from a readable string to a value. More...
 

Protected Types

typedef unsigned int SubscriptionId
 Definition of a subscription id for event callbacks. More...
 

Protected Member Functions

 Device (const Device &device)=delete
 Disabled copy constructor. More...
 
 Device (const std::string &name, const DeviceType type)
 Creates a new device by is name. More...
 
virtual ~Device ()
 Destructs a device. More...
 
Deviceoperator= (const Device &device)=delete
 Disabled copy operator. More...
 

Static Protected Member Functions

static constexpr SubscriptionId invalidSubscriptionId ()
 Returns an invalid subscription id. More...
 

Protected Attributes

std::string deviceName
 Name of this device. More...
 
DeviceType deviceType
 Major and minor type of this device. More...
 
bool deviceIsValid
 Flag determining whether this device is valid. More...
 
Lock deviceLock
 Device lock. More...
 

Friends

class Factory
 
class Ocean::ObjectRef< Device >
 

Detailed Description

This class is the base class for all devices of any type.

Member Typedef Documentation

◆ SubscriptionId

typedef unsigned int Ocean::Devices::Device::SubscriptionId
protected

Definition of a subscription id for event callbacks.

Member Enumeration Documentation

◆ MajorType

Definition of all major device types.

Enumerator
DEVICE_INVALID 

Invalid major type.

DEVICE_MEASUREMENT 

Measurement device.

DEVICE_SENSOR 

Sensor device.

DEVICE_TRACKER 

Tracker device.

◆ MinorType

Base definition of a minor type.

Enumerator
MINOR_INVALID 

Invalid minor type.

Constructor & Destructor Documentation

◆ Device() [1/2]

Ocean::Devices::Device::Device ( const Device device)
protecteddelete

Disabled copy constructor.

Parameters
deviceObject which would be copied

◆ Device() [2/2]

Ocean::Devices::Device::Device ( const std::string &  name,
const DeviceType  type 
)
protected

Creates a new device by is name.

Parameters
nameThe name of the device
typeMajor and minor device type of the device

◆ ~Device()

virtual Ocean::Devices::Device::~Device ( )
protectedvirtual

Destructs a device.

Member Function Documentation

◆ invalidSubscriptionId()

constexpr Device::SubscriptionId Ocean::Devices::Device::invalidSubscriptionId ( )
staticconstexprprotected

Returns an invalid subscription id.

Returns
Id of an invalid subscription

◆ isExclusive()

bool Ocean::Devices::Device::isExclusive ( ) const

Returns whether this device can be use exclusively.

Returns
True, if so

◆ isStarted()

◆ isValid()

bool Ocean::Devices::Device::isValid ( ) const
inline

Returns whether this device is valid.

Returns
True, if so

◆ library()

◆ name()

const std::string & Ocean::Devices::Device::name ( ) const
inline

Returns the name of this device.

Returns
Device name

◆ operator=()

Device& Ocean::Devices::Device::operator= ( const Device device)
protecteddelete

Disabled copy operator.

Parameters
deviceObject which would be copied
Returns
Reference to this object

◆ parameter()

virtual bool Ocean::Devices::Device::parameter ( const std::string &  parameter,
Value value 
)
virtual

Returns an abstract parameter of this device.

Parameters
parameterName of the parameter to return the value for
valueResulting value
Returns
True, if succeeded

Reimplemented in Ocean::Devices::Pattern::PatternTracker6DOF.

◆ pause()

◆ setParameter()

virtual bool Ocean::Devices::Device::setParameter ( const std::string &  parameter,
const Value value 
)
virtual

Sets an abstract parameter of this device.

Parameters
parameterName of the parameter to set
valueAbstract value to be set
Returns
True, if the value has been accepted

Reimplemented in Ocean::Devices::Pattern::PatternTracker6DOF.

◆ start()

◆ stop()

◆ translateMajorType() [1/2]

static std::string Ocean::Devices::Device::translateMajorType ( const MajorType  majorType)
static

Translates the major devices type to a readable string.

Parameters
majorTypeThe major device type to translate
Returns
The readable string, empty if the device type is unknown

◆ translateMajorType() [2/2]

static MajorType Ocean::Devices::Device::translateMajorType ( const std::string &  majorType)
static

Translates the major devices type from a readable string to a value.

Parameters
majorTypeThe major device type to translate
Returns
The translated value

◆ type()

Device::DeviceType Ocean::Devices::Device::type ( ) const
inline

Returns the major and minor type of this device.

Returns
Device type

Friends And Related Function Documentation

◆ Factory

friend class Factory
friend

◆ Ocean::ObjectRef< Device >

friend class Ocean::ObjectRef< Device >
friend

Field Documentation

◆ deviceIsValid

bool Ocean::Devices::Device::deviceIsValid
protected

Flag determining whether this device is valid.

◆ deviceLock

Lock Ocean::Devices::Device::deviceLock
mutableprotected

Device lock.

◆ deviceName

std::string Ocean::Devices::Device::deviceName
protected

Name of this device.

◆ deviceType

DeviceType Ocean::Devices::Device::deviceType
protected

Major and minor type of this device.


The documentation for this class was generated from the following file: