DUDS
Distributed Update of Data from Something
Unit.hpp File Reference
#include <boost/serialization/nvp.hpp>
#include <boost/exception/exception.hpp>
#include <boost/exception/info.hpp>
#include <duds/general/SignExtend.hpp>
#include <stdexcept>
#include <cstdint>
Include dependency graph for Unit.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  duds::data::Unit
 Represents an SI unit, either base or derived. More...
 
struct  duds::data::UnitBadConversion
 A conversion between units was attempted that cannot be performed. More...
 
struct  duds::data::UnitError
 A general unit related error. More...
 
struct  duds::data::UnitMismatch
 Indicates that two different Unit objects were used in an operation that requires identical Unit objects. More...
 
struct  duds::data::UnitRangeError
 Indicates that a value is beyond the range allowed by the Unit or ExtendedUnit class. More...
 

Namespaces

 duds
 
 duds::data
 

Macros

#define DUDS_UNIT_VALUE(A, cd, K, kg, m, mol, s, rad, sr)
 Creates the internal value used by duds::Unit in a way that allows the compiler to generate a constant value. More...
 

Typedefs

typedef boost::error_info< struct Info_unitname, std::string > duds::data::BadUnit
 The name of the bad unit. More...
 
typedef boost::error_info< struct Info_unitexp, int > duds::data::BadUnitExponent
 The out-of-range exponent. More...
 

Macro Definition Documentation

◆ DUDS_UNIT_VALUE

#define DUDS_UNIT_VALUE (   A,
  cd,
  K,
  kg,
  m,
  mol,
  s,
  rad,
  sr 
)
Value:
(((A) & 0xF) | (((cd) & 0xF) << 4) | (((K) & 0xF) << 8) | \
(((kg) & 0xF) << 12) | (((m) & 0xF) << 16) | (((mol) & 0xF) << 20) | \
(((s) & 0xF) << 24) | (((rad) & 3) << 28) | (((sr) & 3) << 30))

Creates the internal value used by duds::Unit in a way that allows the compiler to generate a constant value.

The Unit constructor that takes the same set of parameters cannot be declared as constexpr, but using this macro along with duds::Unit::Unit(std::int32_t) makes a constant when all the macro's parameters are constants.

Parameters
AThe exponent for amperes.
cdThe exponent for candelas.
KThe exponent for kelvin.
kgThe exponent for kilograms.
mThe exponent for meters.
molThe exponent for moles.
sThe exponent for seconds.
radThe exponent for radians.
srThe exponent for steradians.

Definition at line 678 of file Unit.hpp.