Falaise  4.0.1
SuperNEMO Software Toolkit
Public Member Functions | List of all members
falaise::config::quantity_t< Dimension > Class Template Reference

Template class for a physical value with a strict dimension. More...

#include <falaise/config/quantity.h>

Inheritance diagram for falaise::config::quantity_t< Dimension >:
falaise::config::quantity

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 constunit () const
 Return datatools::units tag for the quantity's unit. More...
 
std::string constdimension () const
 Return datatools::unit tag for the quantity's dimension. More...
 

Detailed Description

template<typename Dimension>
class falaise::config::quantity_t< Dimension >

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:

  1. Known to the datatools::units system
  2. Has a datatools::units dimension tag identical to the value of the 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)

Template Parameters
Dimensiondimensional tag for the quantity
See also
FALAISE_ADD_DIMENSION_TAG
System of Units
quantity

Constructor & Destructor Documentation

◆ quantity_t() [1/3]

template<typename Dimension>
falaise::config::quantity_t< Dimension >::quantity_t ( )
inline

Default constructor.

Initializes quantity with zero value and default units for Dimension

Template Parameters
Dimensiondimension tag for this quantity_t

◆ quantity_t() [2/3]

template<typename Dimension>
falaise::config::quantity_t< Dimension >::quantity_t ( double  value,
std::string const unit 
)
inline

Construct a quantity from a value and unit.

Parameters
[in]valueNumeric value
[in]unitdatatools::units::unit tag
Exceptions
falaise::config::unknown_unit_errorif unit is not supported by datatools::units::unit
falaise::config::wrong_dimension_errorif unit's dimension does not match the Dimension type parameter tag

◆ quantity_t() [3/3]

template<typename Dimension>
falaise::config::quantity_t< Dimension >::quantity_t ( quantity const q)
inline

Copy constructor from a raw quantity.

Template Parameters
Dimensiondimension tag for this quantity_t
Parameters
[in]qquantity to copy from
Exceptions
falaise::config::wrong_dimension_errorif dimension of q does not match the Dimension tag

◆ ~quantity_t()

template<typename Dimension>
virtual falaise::config::quantity_t< Dimension >::~quantity_t ( )
virtualdefault

Destructor.


The documentation for this class was generated from the following file: