Falaise
4.0.1
SuperNEMO Software Toolkit
|
Template class for a physical value with a strict dimension. More...
#include <falaise/config/quantity.h>
Public Member Functions | |
quantity_t () | |
Default constructor. More... | |
quantity_t (double value, std::string const &unit) | |
Construct a quantity from a value and unit. More... | |
quantity_t (quantity const &q) | |
Copy constructor from a raw quantity. More... | |
virtual | ~quantity_t ()=default |
Destructor. More... | |
Public Member Functions inherited from falaise::config::quantity | |
quantity ()=default | |
Default constructor. More... | |
quantity (double value, std::string const &unit) | |
Construct a quantity from a value and unit. More... | |
virtual | ~quantity ()=default |
Destructor. More... | |
double | operator() () const |
Convert quantity to double value in the CLHEP::Units numeric scaling system. More... | |
double | value () const |
Return the value for the quantity in its units. More... | |
double | value_in (std::string const &unit) const |
Return value for the quantity in given units. More... | |
std::string const & | unit () const |
Return datatools::units tag for the quantity's unit. More... | |
std::string const & | dimension () const |
Return datatools::unit tag for the quantity's dimension. More... | |
Template class for a physical value with a strict dimension.
Provides a concrete class of quantity, enforcing
Dimensional correctness is enforced by requiring that the unit supplied to the constructor is:
Dimension
template parameter's label
type.The template parameter must provide a public typedef label
to a boost::mpl::string
.
Client code should prefer to use the predefined type aliases for all known datatools::units dimensions (see System of Units)
Dimension | dimensional tag for the quantity |
|
inline |
Default constructor.
Initializes quantity with zero value and default units for Dimension
Dimension | dimension tag for this quantity_t |
|
inline |
Construct a quantity from a value and unit.
[in] | value | Numeric value |
[in] | unit | datatools::units::unit tag |
falaise::config::unknown_unit_error | if unit is not supported by datatools::units::unit |
falaise::config::wrong_dimension_error | if unit's dimension does not match the Dimension type parameter tag |
|
inline |
Copy constructor from a raw quantity.
Dimension | dimension tag for this quantity_t |
[in] | q | quantity to copy from |
falaise::config::wrong_dimension_error | if dimension of q does not match the Dimension tag |
|
virtualdefault |
Destructor.