14 namespace duds {
namespace hardware {
namespace devices {
17 template<
class SVT,
class SQT,
class TVT,
class TQT>
33 template<
class SVT,
class SQT,
class TVT,
class TQT>
39 std::atomic<unsigned int> destructWait = 0;
46 std::atomic<unsigned int> &
count;
99 std::vector<SensorSptr>
sens;
106 sens[sIdx]->meas = store;
135 for (
auto s : sens) {
139 while (destructWait > 0) {
140 std::this_thread::yield();
147 std::shared_ptr< GenericDevice< SVT, SQT, TVT, TQT > >
sharedPtr() {
153 Something::weak_from_this().lock()
162 virtual void sample() = 0;
169 virtual void sample(
const ClockSptr &clock) = 0;
182 const SensorSptr &
sensor(
unsigned int sIdx = 0)
const {
184 return sens.at(sIdx);
195 return sens.at(sIdx)->measurement();
ConstMeasurementSptr currentMeasurement(unsigned int sIdx=0) const
Returns the measurement object for the sensor at the given device specific index. ...
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...
~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.
GenericDevice(const boost::uuids::uuid &id)
Derived classes should create Sensor objects and place them in sens either in the constructor or an i...
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...
GenericSensor< SVT, SQT, TVT, TQT > Sensor
The sensor type used by this device.
std::weak_ptr< Device > DeviceWptr
clocks::GenericClock< SVT, SQT, TVT, TQT > Clock
The clock driver type used by the instruments of this device for time stamps.
Something specific; a base class for identifying things.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
std::vector< SensorSptr > sens
Contains Sensor objects to represent all the kinds of data this device can collect.
void setMeasurement(ConstMeasurementSptr &&store, int sIdx=0) const
Updates the current measurement of a member sensor.
duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
The measurement type provided by the instruments of this device.
DestructCounter(std::atomic< unsigned int > &c)
Represents a sensor on a specific Device; allows access to measurements without needing to use a Devi...
Used to assure the destructor function does not return before Sensor objects quit using member functi...
Represents something with one or more sensors that are sampled through the same hardware.
std::shared_ptr< Clock > ClockSptr
A shared pointer type to the clock type used by this device.
const SensorSptr & sensor(unsigned int sIdx=0) const
Returns the sensor object at the given device specific index.
std::atomic< unsigned int > & count
std::shared_ptr< Sensor > SensorSptr
A shared pointer type to the sensor type used by this device.
GenericDevice< duds::data::GenericValue, double, duds::time::interstellar::NanoTime, float > Device
std::weak_ptr< Sensor > SensorWptr
A weak pointer type to the sensor type used by this device.
std::shared_ptr< Measurement > MeasurementSptr
A shared pointer type to the measurement type used by this device.
The foundation to a clock driver.
Stores a sample of something along with a timestamp stored as a sample from a clock.
std::shared_ptr< Device > DeviceSptr
unsigned int numSensors() const
Returns the number of sensors provided by this device.
std::shared_ptr< const Measurement > ConstMeasurementSptr
A shared pointer type to the const measurement type used by this device.
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.
std::shared_ptr< const Sensor > ConstSensorSptr
A shared pointer type to the const sensor type used by this device.