DUDS
Distributed Update of Data from Something
duds::data Namespace Reference

Namespaces

 _it_needs_to_go_somewhere_
 A namespace to hold some internal data structures where they won't cause trouble.
 
 constants
 A collection of useful constant Quantity objects.
 
 units
 A collection of Unit objects representing commonly used SI units.
 

Classes

struct  CompactMeasurement
 
struct  CompactSample
 A template for a sample from an insturment that does not store units or the origin. More...
 
struct  ExtendedQuantity
 An idea that is not yet implemented; DO NOT USE. More...
 
class  ExtendedUnit
 redo: Use floats for scale and offset. More...
 
struct  ExtraCompactSample
 
class  GenericMeasuement
 
struct  GenericMeasurement
 Stores a sample of something along with a timestamp stored as a sample from a clock. More...
 
struct  GenericSample
 A template for a sample from an insturment. More...
 
class  GenericValueDurationVisitor
 
class  GenericValueNumericVisitor
 
class  GenericValueStringVisitor
 
class  GenericValueTable
 A set of key-value pairs where the value can be one of several types. More...
 
class  GenericValueTimeVisitor
 
struct  LargeIntWrapper
 Wraps an integer to allow the Boost multiprecision library to provide insertion and extraction operators, and to provide Boost serialization support that will produce the same result, while using either a native integer type or a Boost multiprecision type. More...
 
struct  Quantity
 A container for a value and a unit to better describe the value. More...
 
struct  QuantityArray
 A fixed size array of quantities all sharing the same units. More...
 
class  QuantityIterator
 An iterator template for QuantityArray and QuantityNddArray that provides a Quantity object when dereferenced. More...
 
struct  QuantityNddArray
 An array of quantites of dynamic size and number of dimensions. More...
 
struct  QuantityXyz
 A QuantityArray for the common usage of a three dimentional coordinate or a triple axis sample. More...
 
struct  SampleNU
 
class  Unit
 Represents an SI unit, either base or derived. More...
 
struct  UnitBadConversion
 A conversion between units was attempted that cannot be performed. More...
 
struct  UnitError
 A general unit related error. More...
 
struct  UnitMismatch
 Indicates that two different Unit objects were used in an operation that requires identical Unit objects. More...
 
struct  UnitRangeError
 Indicates that a value is beyond the range allowed by the Unit or ExtendedUnit class. More...
 

Typedefs

typedef boost::error_info< struct Info_unitname, std::string > BadUnit
 The name of the bad unit. More...
 
typedef boost::error_info< struct Info_unitexp, int > BadUnitExponent
 The out-of-range exponent. More...
 
typedef std::shared_ptr< const MeasurementConstMeasurementSptr
 A shared pointer to a const Measurement, a common GenericMeasurement type. More...
 
typedef std::map< std::string, GenericValuegeneric_value_table_base_t
 
typedef 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 regular C++ I/O stream. More...
 
typedef boost::multiprecision::int128_t int128_t
 The type used for 128-bit integers. More...
 
typedef LargeIntWrapper< int128_t, boost::multiprecision::int128_t > int128_w
 A 128-bit integer wrapped by LargeIntWrapper to make the Boost serialized result interchangable between 32 and 64-bit targets. More...
 
typedef GenericMeasurement< GenericValue, double, duds::time::interstellar::NanoTime, float > Measurement
 A measurement type capable of holding a wide range of types for the sample value. More...
 
typedef std::shared_ptr< MeasurementMeasurementSptr
 A shared pointer to a Measurement, a common GenericMeasurement type. More...
 
typedef GenericSample< GenericValue, double > Sample
 A sample type that is good for general purpose use. More...
 

Functions

Quantity operator* (double s, const Quantity &q)
 Multiplies a Quantity by a scalar. More...
 
Quantity operator/ (double s, const Quantity &q)
 Divides a Quantity by a scalar. More...
 
template<typename QT >
static constexpr QT unspecified ()
 Returns the value used to represent an unspecified or unknown accuracy, precision, resolution, or error. More...
 

Typedef Documentation

◆ BadUnit

typedef boost::error_info<struct Info_unitname, std::string> duds::data::BadUnit

The name of the bad unit.

Definition at line 45 of file Unit.hpp.

◆ BadUnitExponent

typedef boost::error_info<struct Info_unitexp, int> duds::data::BadUnitExponent

The out-of-range exponent.

Definition at line 40 of file Unit.hpp.

◆ ConstMeasurementSptr

typedef std::shared_ptr<const Measurement> duds::data::ConstMeasurementSptr

A shared pointer to a const Measurement, a common GenericMeasurement type.

Definition at line 70 of file Measurement.hpp.

◆ generic_value_table_base_t

typedef std::map<std::string, GenericValue> duds::data::generic_value_table_base_t

Definition at line 118 of file GenericValue.hpp.

◆ GenericValue

typedef 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> >> duds::data::GenericValue

A general value of a type can be serialized for transmission over a network and can be used with a regular C++ I/O stream.

This value can be a map (a bunch of name-value pairs) to allow storing sub-values to make heirarchical structures. It is 32 bytes on 32-bit and 64-bit targets.

Allowed types in index order:

  1. String
  2. A language tagged string
  3. A map of language tagged strings

  4. An array of 4 signed integers, 4 bytes each
  5. An array of 2 signed integers, 8 bytes each
  6. A LargeIntWrapper holding a 16 byte signed integer (int128_w)
  7. An array of 4 floating point numbers, single precision
  8. An array of 2 floating point numbers, double precision
  9. Double precision floating point number (direct numeric non-array assignments use this type, including integers)
  10. A Quantity
  11. A Quantity array with a dynamic size and number of dimensions

  12. A duration in femtoseconds
  13. A duration in nanoseconds
  14. A time with femtosecond precision
  15. A time with nanosecond precision
  16. UUID
  17. A std::map with strings for keys and this variant type for values
  18. Arbitrary data stored as a vector of char
Todo:
Maybe a map with UUID keys, too?

A boolean value is not included because it causes the assignment of string literals to assign boolean values.

Integers
I chose to include a 16 byte integer as one of the types since it is the same size as a UUID, which is also included, so it will fit. Because gcc has no 128-bit integer support for 32-bit targets, and because this variant type needs to be serializable for use between 32-bit and 64-bit hosts, the 128-bit integer is wrapped up in an int128_w. This prevents easy use with an int128_t, but attempting to allow such use results in doubles being stored as integers.
Note
Assigning an integer will cause the value to be stored as a double. Making the variant act this way prevents it from implicitly converting floating point values to integers for storage, which I think is much worse. This is the benifit of the not-so-easy to use int128_w type: it cannot be used directly with other interger types, so doubles remain doubles.

boost::recursive_wrapper is used for a couple of the variant's types to store them dynamically instead of inside the memory of the variant. In the case of duds::general::GenericValueTable, this prevents the variant from being even larger.

Author
Jeff Jackowski

Definition at line 26 of file GenericValue.hpp.

◆ int128_t

typedef boost::multiprecision::int128_t duds::data::int128_t

The type used for 128-bit integers.

The type varies: gcc will use __int128 if available (currently only 64-bit targets), otherwise Boost's 128-bit fixed size integer from the multiprecision library is used. It seems Boost added this in version 1.53, and several bug fixes were added up to the most current version when this text was writen, 1.55.

Note
This type should not be used for serialization; instead use int128_w. This type is intended for internal storage and usage that does not escape the process.

Definition at line 66 of file Int128.hpp.

◆ int128_w

typedef LargeIntWrapper<int128_t, boost::multiprecision::int128_t> duds::data::int128_w

A 128-bit integer wrapped by LargeIntWrapper to make the Boost serialized result interchangable between 32 and 64-bit targets.

Definition at line 205 of file Int128.hpp.

◆ Measurement

A measurement type capable of holding a wide range of types for the sample value.

It is suitable for storing measurements when it is not known at compile-time what sample types are needed.

Definition at line 60 of file Measurement.hpp.

◆ MeasurementSptr

typedef std::shared_ptr<Measurement> duds::data::MeasurementSptr

A shared pointer to a Measurement, a common GenericMeasurement type.

Definition at line 65 of file Measurement.hpp.

◆ Sample

A sample type that is good for general purpose use.

It isn't the most memory efficent type, but it can work with a wide variety of data types to hold the sample. This makes it a good choice to support anything when it isn't known at compile-time what will be sampled.

Definition at line 166 of file Sample.hpp.

Function Documentation

◆ operator*()

Quantity duds::data::operator* ( double  s,
const Quantity q 
)
inline

Multiplies a Quantity by a scalar.

Definition at line 225 of file Quantity.hpp.

Referenced by duds::data::Unit::clear().

◆ operator/()

Quantity duds::data::operator/ ( double  s,
const Quantity q 
)
inline

Divides a Quantity by a scalar.

Definition at line 232 of file Quantity.hpp.

Referenced by duds::data::Unit::clear().

◆ unspecified()

template<typename QT >
static constexpr QT duds::data::unspecified ( )
static

Returns the value used to represent an unspecified or unknown accuracy, precision, resolution, or error.

It will either be the type's representation of infinity, or if it lacks that, the lowest possible value. This works for floating point, fix point, and signed integer types. It does not work well for unsigned integers.

Author
Jeff Jackowski

Definition at line 52 of file Sample.hpp.

Referenced by duds::data::GenericSample< SVT, SQT >::clear().