Falaise  4.0.1
SuperNEMO Software Toolkit
Classes | Namespaces | Macros
quantity.h File Reference

Types for configuration validation of physical quantities. More...

#include <exception>
#include "CLHEP/Units/PhysicalConstants.h"
#include "CLHEP/Units/SystemOfUnits.h"
#include "bayeux/datatools/units.h"
#include "boost/metaparse/string.hpp"
#include "boost/mpl/string.hpp"

Go to the source code of this file.

Classes

class  falaise::config::wrong_dimension_error
 Exception reporting wrong or incompatible dimensions. More...
 
class  falaise::config::unknown_unit_error
 Exception reporting unknown unit tags. More...
 
class  falaise::config::quantity
 Class representing a value and physical unit. More...
 
class  falaise::config::quantity_t< Dimension >
 Template class for a physical value with a strict dimension. More...
 

Namespaces

 falaise
 
 falaise::config
 

Macros

#define FALAISE_ADD_DIMENSION_TAG(Tag)
 Register a dimension tag for use as a falaise::config::quantity_t template parameter. More...
 

Detailed Description

Types for configuration validation of physical quantities.

Macro Definition Documentation

◆ FALAISE_ADD_DIMENSION_TAG

#define FALAISE_ADD_DIMENSION_TAG (   Tag)
Value:
namespace falaise { \
namespace config { \
struct Tag { \
typedef BOOST_METAPARSE_STRING(#Tag) label; \
}; \
using Tag##_t = quantity_t<Tag>; \
} \
}
Definition: metadata_utils.h:35

Register a dimension tag for use as a falaise::config::quantity_t template parameter.

Expansion defines a struct for the tag, and a type alias for convenience e.g.

// Expansion results in definition of:
namespace falaise {
namespace config {
struct length {...};
using length_t = quantity_t<length>;
}
}

The string equivalent of the passed parameter must be registered with the datatools::units::registry dimension/unit store.

Client code can then use the type alias directly, e.g.

Parameters
Tagtag for the dimension, which must be known to datatools::units::registry