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

The clock driver for C++ clocks that meet the requirements of the TrivialClock concept. More...

#include <CppClock.hpp>

Inheritance diagram for duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >:
Collaboration diagram for duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >:

Classes

struct  Token
 

Public Types

typedef CLK Clock
 The clock class. More...
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 
- Public Types inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >
typedef std::shared_ptr< GenericClock< SVT, SQT, TVT, TQT > > ClockSptr
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 The measurement type provided by the instruments of this device. More...
 
- Public Types inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT >
typedef clocks::GenericClock< SVT, SQT, TVT, TQT > Clock
 The clock driver type used by the instruments of this device for time stamps. More...
 
typedef std::shared_ptr< ClockClockSptr
 A shared pointer type to the clock type used by this device. More...
 
typedef std::shared_ptr< const MeasurementConstMeasurementSptr
 A shared pointer type to the const measurement type used by this device. More...
 
typedef std::shared_ptr< const SensorConstSensorSptr
 A shared pointer type to the const sensor type used by this device. More...
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 The measurement type provided by the instruments of this device. More...
 
typedef std::shared_ptr< MeasurementMeasurementSptr
 A shared pointer type to the measurement type used by this device. More...
 
typedef GenericSensor< SVT, SQT, TVT, TQT > Sensor
 The sensor type used by this device. More...
 
typedef std::shared_ptr< SensorSensorSptr
 A shared pointer type to the sensor type used by this device. More...
 
typedef std::weak_ptr< SensorSensorWptr
 A weak pointer type to the sensor type used by this device. More...
 

Public Member Functions

virtual void sample ()
 Samples the time from this clock stores it in the measured field of the Measurement object of the device's first sensor. More...
 
virtual void sample (const ClockSptr &clock)
 Samples the time from this clock and the given clock, then stores the measurement. More...
 
virtual void sampleTime (typename Measurement::TimeSample &time)
 Samples the time from the clock device without storing the result in the clock's sensor object. More...
 
virtual bool unambiguous () const noexcept
 Returns true if the clock properly reports the time during a leap second. More...
 
- Public Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >
 operator ClockSptr () const
 
Measurement::TimeSample sampleTime ()
 Samples the time from the clock device without storing the result in the clock's sensor object. More...
 
- Public Member Functions inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT >
 ~GenericDevice ()
 Modifies member Sensor objects so they no longer have a pointer back to this object, and waits for calls those objects may be making to sharedPtr() to complete. More...
 
ConstMeasurementSptr currentMeasurement (unsigned int sIdx=0) const
 Returns the measurement object for the sensor at the given device specific index. More...
 
unsigned int numSensors () const
 Returns the number of sensors provided by this device. More...
 
virtual void sample (const ClockSptr &clock)=0
 Samples the device and updates its sensor objects, and provides a timestamp from the given clock device. More...
 
const SensorSptrsensor (unsigned int sIdx=0) const
 Returns the sensor object at the given device specific index. More...
 
std::shared_ptr< GenericDevice< SVT, SQT, TVT, TQT > > sharedPtr ()
 Returns a shared pointer to this device object; will be empty if this object's destructor is running. 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< GenericCppClock< CLK, SVT, SQT, TVT, TQT > > make ()
 Makes a new clock device object. More...
 

Private Member Functions

 GenericCppClock (Token)
 Constructs a new clock device with its UUID. More...
 

Additional Inherited Members

- Protected Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >
 GenericClock ()=delete
 
 GenericClock (const boost::uuids::uuid &id)
 
- Protected Member Functions inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT >
 GenericDevice ()=default
 Derived classes should create Sensor objects and place them in sens either in the constructor or an initialization function. More...
 
 GenericDevice (const boost::uuids::uuid &id)
 Derived classes should create Sensor objects and place them in sens either in the constructor or an initialization function. More...
 
void setMeasurement (const ConstMeasurementSptr &store, int sIdx=0) const
 Updates the current measurement of a member sensor. More...
 
void setMeasurement (ConstMeasurementSptr &&store, int sIdx=0) const
 Updates the current measurement of a member 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...
 
- Static Protected Member Functions inherited from duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >
template<class Ratio , class Src , class Dest >
static void convert (Dest &dest, const Src &src)
 General template to convert time in one format to another. More...
 
template<class Ratio , class Src >
static void convert (duds::time::interstellar::FemtoTime &dest, const Src &src)
 Template specialization to convert time in one format to FemtoTime. More...
 
template<class Ratio , class Src >
static void convert (duds::time::interstellar::NanoTime &dest, const Src &src)
 Template specialization to convert time in one format to NanoTime. More...
 
template<class Ratio , class Src >
static void convert (duds::data::GenericValue &dest, const Src &src)
 Template specialization to convert time in one format to FemtoTime in a GenericValue. More...
 
template<class Ratio , class IST , class Src >
static void convertIST (IST &dest, const Src &src)
 Template to convert time in one format to one of the types defined in duds::time::interstellar. More...
 
template<class Ratio , class IST >
static void convertIST (IST &dest, const duds::data::int128_t &src)
 More specialized template to convert time stored in a 128-bit integer to one of the types defined in duds::time::interstellar. More...
 
- Protected Attributes inherited from duds::hardware::devices::GenericDevice< SVT, SQT, TVT, TQT >
std::vector< SensorSptrsens
 Contains Sensor objects to represent all the kinds of data this device can collect. More...
 
- Protected Attributes inherited from duds::Something
general::LanguageTaggedStringMap ltnames
 A name for this item intended for user presentation. More...
 

Detailed Description

template<class CLK, class SVT, class SQT, class TVT, class TQT>
class duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >

The clock driver for C++ clocks that meet the requirements of the TrivialClock concept.

This concept only provides the time. It does not provide any information on the quality of the time, so this driver also only provides the time. The resulting time should be considered no better than a wild guess.

Template Parameters
CLKThe clock class; it must be a TrivialClock.
SVTSample value type.
SQTSample quality type.
TVTTime value type.
TQTTime quality type.
Author
Jeff Jackowski

Definition at line 45 of file CppClock.hpp.

Member Typedef Documentation

◆ Clock

template<class CLK , class SVT , class SQT , class TVT , class TQT >
typedef CLK duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::Clock

The clock class.

Definition at line 52 of file CppClock.hpp.

◆ Measurement

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

Definition at line 48 of file CppClock.hpp.

Constructor & Destructor Documentation

◆ GenericCppClock()

template<class CLK , class SVT , class SQT , class TVT , class TQT >
duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::GenericCppClock ( Token  )
inlineprivate

Constructs a new clock device with its UUID.

Definition at line 62 of file CppClock.hpp.

Member Function Documentation

◆ make()

template<class CLK , class SVT , class SQT , class TVT , class TQT >
static std::shared_ptr< GenericCppClock <CLK, SVT, SQT, TVT, TQT> > duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::make ( )
inlinestatic

Makes a new clock device object.

Definition at line 67 of file CppClock.hpp.

◆ sample() [1/2]

template<class CLK , class SVT , class SQT , class TVT , class TQT >
virtual void duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::sample ( )
inlinevirtual

Samples the time from this clock stores it in the measured field of the Measurement object of the device's first sensor.

The timestamp field will be clear.

Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.

Definition at line 78 of file CppClock.hpp.

◆ sample() [2/2]

template<class CLK , class SVT , class SQT , class TVT , class TQT >
virtual void duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::sample ( const ClockSptr clock)
inlinevirtual

Samples the time from this clock and the given clock, then stores the measurement.

The sample from this clock will be in the measured field of the Measurement object, while the sample from the given clock will be in the timestamp field.

Parameters
clockThe clock that will be sampled for the timestamp in the resulting measurement. If it is this clock, the clock must only be sampled once and the same time must be in both the measured and timestamp fields of the Measurement object. Different types may be used to hold the time in those fields so they might not evaluate as equal.

Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.

Definition at line 91 of file CppClock.hpp.

◆ sampleTime()

template<class CLK , class SVT , class SQT , class TVT , class TQT >
virtual void duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::sampleTime ( typename Measurement::TimeSample time)
inlinevirtual

Samples the time from the clock device without storing the result in the clock's sensor object.

Parameters
timeThe place to put the sampled time.

Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.

Definition at line 72 of file CppClock.hpp.

◆ unambiguous()

template<class CLK , class SVT , class SQT , class TVT , class TQT >
virtual bool duds::hardware::devices::clocks::GenericCppClock< CLK, SVT, SQT, TVT, TQT >::unambiguous ( ) const
inlinevirtualnoexcept

Returns true if the clock properly reports the time during a leap second.

Should the clock replay the second 59 for the leap second, then two seconds appear the same making the time ambiguous. If the clock reports 60 for the second field during a leap second, increments normally, or otherwise makes the leap second distinct, then it is unambiguous.

Ideally, ambiguous clocks should also indicate the problem in the reported quality values. For example, if a clock replays the previous second during the leap second, the accracy value should increase by a second starting one second before the leap second and continuing until after the leap second.

Implements duds::hardware::devices::clocks::GenericClock< SVT, SQT, TVT, TQT >.

Definition at line 119 of file CppClock.hpp.


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