DUDS
Distributed Update of Data from Something
duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT > Class Template Reference

Represents a sensor on a specific Device; allows access to measurements without needing to use a Device object. More...

#include <Sensor.hpp>

Inheritance diagram for duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >:
Collaboration diagram for duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >:

Classes

struct  Token
 

Public Types

typedef std::shared_ptr< const MeasurementConstMeasurementSptr
 A shared pointer type to the const measurement type used by this sensor. More...
 
typedef GenericDevice< SVT, SQT, TVT, TQT > Device
 The device type used by this sensor. More...
 
typedef std::shared_ptr< DeviceDeviceSptr
 A shared pointer type to the device type used by this sensor. More...
 
typedef std::weak_ptr< DeviceDeviceWptr
 A weak pointer type to the device type used by this sensor. More...
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 The measurement type provided by the sensors of the parent device. More...
 
typedef std::shared_ptr< MeasurementMeasurementSptr
 A shared pointer type to the measurement type used by this sensor. More...
 

Public Member Functions

DeviceSptr device () const
 Returns a shared pointer to the owning device. More...
 
unsigned int index () const
 Returns the sensor's device specific index. More...
 
ConstMeasurementSptrmeasurement () const
 Returns the current measurement object. More...
 
- Public Member Functions inherited from duds::Something
virtual ~Something ()=0
 
std::string getName () const
 Returns the name for the current locale. More...
 
const general::LanguageTaggedStringMapnames () const
 Returns the set of names for all locales and languages. More...
 
bool operator!= (const Something &s) const
 Something objects are compared using the someId member. More...
 
bool operator< (const Something &s) const
 Something objects are compared using the someId member. More...
 
bool operator<= (const Something &s) const
 Something objects are compared using the someId member. More...
 
bool operator== (const Something &s) const
 Something objects are compared using the someId member. More...
 
bool operator> (const Something &s) const
 Something objects are compared using the someId member. More...
 
bool operator>= (const Something &s) const
 Something objects are compared using the someId member. More...
 
template<class DerivedClass >
std::shared_ptr< DerivedClass > sharedPtr () const
 Returns a shared pointer to this object for a derived class. More...
 
const boost::uuids::uuid & uuid () const
 Returns the object's unique identifier. More...
 

Static Public Member Functions

static std::shared_ptr< GenericSensor< SVT, SQT, TVT, TQT > > make (Device *pdev)
 Make a sensor without setting the UUID. More...
 
static std::shared_ptr< GenericSensor< SVT, SQT, TVT, TQT > > make (Device *pdev, const boost::uuids::uuid &id, unsigned int i)
 Make a new sensor. More...
 

Protected Member Functions

 GenericSensor (Device *pdev, Token)
 Make a sensor without setting the UUID. More...
 
 GenericSensor (Device *pdev, const boost::uuids::uuid &id, unsigned int i, Token)
 Make a new sensor. More...
 
- Protected Member Functions inherited from duds::Something
 Something ()=default
 Simple constructor. More...
 
 Something (const boost::uuids::uuid &id)
 Creates Something with the given UUID. More...
 
void setUuid (const boost::uuids::uuid &id)
 Sets the UUID that is associated with this object. More...
 

Private Attributes

Devicedev
 The owning device object. More...
 
unsigned int idx
 The sensor index within the owning Device. More...
 
ConstMeasurementSptr meas
 The current measurement object. More...
 

Friends

class GenericDevice< SVT, SQT, TVT, TQT >
 

Additional Inherited Members

- Protected Attributes inherited from duds::Something
general::LanguageTaggedStringMap ltnames
 A name for this item intended for user presentation. More...
 

Detailed Description

template<class SVT, class SQT, class TVT, class TQT>
class duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >

Represents a sensor on a specific Device; allows access to measurements without needing to use a Device object.

Template Parameters
SVTSample value type
SQTSample quality type
TVTTime value type
TQTTime quality type
Author
Jeff Jackowski

Definition at line 39 of file Sensor.hpp.

Member Typedef Documentation

◆ ConstMeasurementSptr

template<class SVT , class SQT , class TVT , class TQT >
typedef std::shared_ptr<const Measurement> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::ConstMeasurementSptr

A shared pointer type to the const measurement type used by this sensor.

Definition at line 65 of file Sensor.hpp.

◆ Device

template<class SVT , class SQT , class TVT , class TQT >
typedef GenericDevice<SVT, SQT, TVT, TQT> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::Device

The device type used by this sensor.

Definition at line 45 of file Sensor.hpp.

◆ DeviceSptr

template<class SVT , class SQT , class TVT , class TQT >
typedef std::shared_ptr<Device> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::DeviceSptr

A shared pointer type to the device type used by this sensor.

Definition at line 49 of file Sensor.hpp.

◆ DeviceWptr

template<class SVT , class SQT , class TVT , class TQT >
typedef std::weak_ptr<Device> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::DeviceWptr

A weak pointer type to the device type used by this sensor.

Definition at line 53 of file Sensor.hpp.

◆ Measurement

template<class SVT , class SQT , class TVT , class TQT >
typedef duds::data::GenericMeasurement<SVT, SQT, TVT, TQT> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::Measurement

The measurement type provided by the sensors of the parent device.

Definition at line 57 of file Sensor.hpp.

◆ MeasurementSptr

template<class SVT , class SQT , class TVT , class TQT >
typedef std::shared_ptr<Measurement> duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::MeasurementSptr

A shared pointer type to the measurement type used by this sensor.

Definition at line 61 of file Sensor.hpp.

Constructor & Destructor Documentation

◆ GenericSensor() [1/2]

template<class SVT , class SQT , class TVT , class TQT >
duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::GenericSensor ( Device pdev,
Token   
)
inlineprotected

Make a sensor without setting the UUID.

Parameters
pdevThe owning device.

Definition at line 92 of file Sensor.hpp.

◆ GenericSensor() [2/2]

template<class SVT , class SQT , class TVT , class TQT >
duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::GenericSensor ( Device pdev,
const boost::uuids::uuid &  id,
unsigned int  i,
Token   
)
inlineprotected

Make a new sensor.

Parameters
pdevThe owning device.
idThe UUID for this sensor.
iThe sensor's device specific index.

Definition at line 100 of file Sensor.hpp.

Member Function Documentation

◆ device()

template<class SVT , class SQT , class TVT , class TQT >
DeviceSptr duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::device ( ) const
inline

Returns a shared pointer to the owning device.

Returns
A shared pointer to the device. If the device object has been destroyed, this will be an empty shared pointer. This object does not contain a shared pointer to the device.

Definition at line 144 of file Sensor.hpp.

◆ index()

template<class SVT , class SQT , class TVT , class TQT >
unsigned int duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::index ( ) const
inline

Returns the sensor's device specific index.

Definition at line 135 of file Sensor.hpp.

◆ make() [1/2]

template<class SVT , class SQT , class TVT , class TQT >
static std::shared_ptr< GenericSensor <SVT, SQT, TVT, TQT> > duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::make ( Device pdev)
inlinestatic

Make a sensor without setting the UUID.

Parameters
pdevThe owning device.

Definition at line 110 of file Sensor.hpp.

Referenced by duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >::GenericClock().

◆ make() [2/2]

template<class SVT , class SQT , class TVT , class TQT >
static std::shared_ptr< GenericSensor <SVT, SQT, TVT, TQT> > duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::make ( Device pdev,
const boost::uuids::uuid &  id,
unsigned int  i 
)
inlinestatic

Make a new sensor.

Parameters
pdevThe owning device.
idThe UUID for this sensor.
iThe sensor's device specific index.

Definition at line 123 of file Sensor.hpp.

◆ measurement()

template<class SVT , class SQT , class TVT , class TQT >
ConstMeasurementSptr& duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::measurement ( ) const
inline

Returns the current measurement object.

The measurement object will be replaced when the device is sampled, so repeated calls to this function can return different objects.

Definition at line 156 of file Sensor.hpp.

Friends And Related Function Documentation

◆ GenericDevice< SVT, SQT, TVT, TQT >

template<class SVT , class SQT , class TVT , class TQT >
friend class GenericDevice< SVT, SQT, TVT, TQT >
friend

Definition at line 40 of file Sensor.hpp.

Member Data Documentation

◆ dev

template<class SVT , class SQT , class TVT , class TQT >
Device* duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::dev
private

The owning device object.

When the device is destructed, it will set this to nullptr.

Definition at line 71 of file Sensor.hpp.

Referenced by duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::device().

◆ idx

template<class SVT , class SQT , class TVT , class TQT >
unsigned int duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::idx
private

The sensor index within the owning Device.

Should this object be used without a Device, set this to -1.

Note
This value must not change after this object is placed within a Device.
Todo:
Remove above note if this value will remain private.

Definition at line 83 of file Sensor.hpp.

Referenced by duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::index().

◆ meas

template<class SVT , class SQT , class TVT , class TQT >
ConstMeasurementSptr duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::meas
private

The current measurement object.

Definition at line 75 of file Sensor.hpp.

Referenced by duds::hardware::devices::GenericSensor< SVT, SQT, TVT, TQT >::measurement().


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