15 namespace duds {
namespace hardware {
namespace devices {
namespace clocks {
21 0x7f, 0x3a, 0x9f, 0x9a,
25 0xd2, 0xea, 0x2a, 0x48, 0x51, 0xb2
44 template<
class CLK,
class SVT,
class SQT,
class TVT,
class TQT>
67 static std::shared_ptr< GenericCppClock <CLK, SVT, SQT, TVT, TQT> >
make() {
68 return std::make_shared< GenericCppClock <CLK, SVT, SQT, TVT, TQT> >(
74 duds::data::unspecified<TQT>();
75 time.
resolution = (TQT)Clock::period::num / (TQT)Clock::period::den;
76 time.
value = Clock::now();
79 std::shared_ptr<Measurement> m =
80 std::make_shared<Measurement>();
81 m->measured.accuracy = m->measured.precision = m->measured.estError =
82 duds::data::unspecified<SQT>();
83 m->measured.resolution = (SQT)Clock::period::num / (SQT)Clock::period::den;
84 typename Clock::time_point ctp = Clock::now();
85 m->measured.value = ctp;
92 std::shared_ptr<Measurement> m =
93 std::make_shared<Measurement>();
94 m->measured.accuracy = m->measured.precision = m->measured.estError =
95 duds::data::unspecified<SQT>();
96 m->measured.resolution = (SQT)Clock::period::num / (SQT)Clock::period::den;
97 typename Clock::time_point ctp = Clock::now();
98 m->measured.value = ctp;
100 if (
this == clock.get()) {
102 m->timestamp.value = ctp;
105 m->timestamp.accuracy = m->timestamp.precision =
106 m->timestamp.estError = duds::data::unspecified<TQT>();
107 m->timestamp.resolution = (TQT)Clock::period::num /
108 (TQT)Clock::period::den;
111 clock->sampleTime(m->timestamp);
114 m->timestamp.clear();
140 #endif // #ifndef CPPCLOCK_HPP boost::variant< std::string, duds::general::LanguageTaggedString, std::array< std::int32_t, 4 >, std::array< std::int64_t, 2 >, duds::data::int128_w, std::array< float, 4 >, std::array< double, 2 >, double, duds::data::Quantity, boost::recursive_wrapper< duds::data::QuantityNddArray >, duds::time::interstellar::Femtoseconds, duds::time::interstellar::Nanoseconds, duds::time::interstellar::FemtoTime, duds::time::interstellar::NanoTime, boost::uuids::uuid, boost::recursive_wrapper< duds::data::GenericValueTable >, std::shared_ptr< std::vector< char > >> GenericValue
A general value of a type can be serialized for transmission over a network and can be used with a re...
The clock driver for C++ clocks that meet the requirements of the TrivialClock concept.
Provides Interstellar Time in Nanoseconds.
virtual void sampleTime(typename Measurement::TimeSample &time)
Samples the time from the clock device without storing the result in the clock's sensor object...
virtual bool unambiguous() const noexcept
Returns true if the clock properly reports the time during a leap second.
std::shared_ptr< CppClock > CppClockSptr
QT estError
The estimated error of the observation.
GenericCppClock< duds::time::interstellar::NanoClock, duds::data::GenericValue, double, duds::time::interstellar::NanoTime, float > CppClock
General use C++ clock driver type.
static std::shared_ptr< GenericCppClock< CLK, SVT, SQT, TVT, TQT > > make()
Makes a new clock device object.
GenericCppClock(Token)
Constructs a new clock device with its UUID.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
constexpr boost::uuids::uuid CppClockDeviceId
The UUID for the C++ clock device.
CLK Clock
The clock class.
QT resolution
The expected resolution of the instrument under the conditions in which the sample was taken...
VT value
The value sampled from the insturment.
Represents something with one or more sensors that are sampled through the same hardware.
std::shared_ptr< GenericClock< SVT, SQT, TVT, TQT > > ClockSptr
The foundation to a clock driver.
QT accuracy
The expected accuracy of the instrument under the conditions in which the sample was taken...
Stores a sample of something along with a timestamp stored as a sample from a clock.
virtual void sample()
Samples the time from this clock stores it in the measured field of the Measurement object of the dev...
duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
virtual void sample(const ClockSptr &clock)
Samples the time from this clock and the given clock, then stores the measurement.
QT precision
The expected precision of the instrument under the conditions in which the sample was taken...
NanoClock::time_point NanoTime
A point in time in Interstellar Time stored in Nanoseconds.
void setMeasurement(const ConstMeasurementSptr &store, int sIdx=0) const
Updates the current measurement of a member sensor.