LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
A quantity point. More...
#include "intervals.h"
Public Types | |
using | category_base_t = details::WithCategory< Cat > |
using | traits_t = typename category_base_t::traits_t |
Traits of the category. More... | |
template<typename OC , typename Type = void> | |
using | enable_if_compatible_t = std::enable_if_t< category_base_t::template category_compatible_with< OC >(), Type > |
using | point_t = Point< Q, Cat, IV > |
This type. More... | |
Types from the base quantity | |
using | quantity_t = Q |
Quantity the interval is based on. More... | |
using | category_t = typename category_base_t::category_t |
The category this point belongs to. More... | |
using | interval_t = IV |
The interval type corresponding to the unit of this point. More... | |
template<typename R > | |
using | scaled_quantity_t = rescale< quantity_t, R > |
A quantity in the same unit, but possibly a different scale. More... | |
using | value_t = typename quantity_t::value_t |
Type of the stored value. More... | |
using | unit_t = typename quantity_t::unit_t |
Description of the scaled unit. More... | |
using | baseunit_t = typename quantity_t::baseunit_t |
Description of the unscaled unit. More... | |
template<typename OQ , typename OI > | |
using | other_point_t = Point< OQ, category_t, OI > |
A point based on a different quantity but with the same category. More... | |
Public Member Functions | |
Point ()=default | |
Constructor: value is left uninitialized. More... | |
constexpr | Point (value_t v) |
Constructor: takes a value in the intended representation. More... | |
template<typename... Args> | |
constexpr | Point (Quantity< Args... > const q) |
Constructor: converts from a quantity. More... | |
template<typename PT , typename std::enable_if_t< is_point_v< PT >> * = nullptr> | |
constexpr | Point (PT const p) |
Constructor: converts from another point. More... | |
constexpr quantity_t const & | quantity () const |
Returns the value of the interval as a quantity. More... | |
constexpr | operator value_t () const |
Conversion to the base quantity. More... | |
template<typename PT > | |
constexpr std::enable_if_t< is_point_v< PT >, PT > | convertInto () const |
Convert this interval into the specified one. More... | |
Asymmetric operand arithmetic operations | |
These arithmetic operations take care of preserving the point unit through them. Not all possible (or reasonable) operations are supported yet. Some operations that may be symmetric (like addition of interval) are implemented as free functions rather than methods.
| |
template<typename R > | |
constexpr point_t | operator+ (scaled_quantity_t< R > const delta) const |
template<typename OQ , typename OC > | |
constexpr enable_if_compatible_t< Interval< OQ, OC >, point_t > | operator+ (Interval< OQ, OC > const delta) const |
template<typename R > | |
constexpr point_t | operator- (scaled_quantity_t< R > const delta) const |
Returns the value of this point after subtraction of an interval. More... | |
template<typename OQ , typename OC > | |
constexpr enable_if_compatible_t< Interval< OQ, OC >, point_t > | operator- (Interval< OQ, OC > const delta) const |
Returns the value of this point after subtraction of an interval. More... | |
template<typename R > | |
point_t & | operator+= (scaled_quantity_t< R > const other) |
Add a quantity (possibly converted) to this one. More... | |
template<typename OQ , typename OC > | |
enable_if_compatible_t< Interval< OQ, OC >, point_t & > | operator+= (Interval< OQ, OC > const other) |
Add the other interval (possibly converted) to this point. More... | |
template<typename R > | |
point_t & | operator-= (scaled_quantity_t< R > const other) |
Subtract a quantity (possibly converted) from this one. More... | |
template<typename OQ , typename OC > | |
enable_if_compatible_t< Interval< OQ, OC >, point_t & > | operator-= (Interval< OQ, OC > const other) |
Subtract the other interval (possibly converted) from this point. More... | |
constexpr point_t | operator+ () const |
Returns a point with same value. More... | |
constexpr point_t | operator- () const |
Returns a parity-changed point. More... | |
Comparisons. | |
Comparisons with plain numbers are managed by implicit conversion. More care is needed for quantities. Comparisons between two point instances
Value storage types are compared according to C++ rules. | |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator== (other_point_t< OQ, OI > const other) const |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator!= (other_point_t< OQ, OI > const other) const |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator>= (other_point_t< OQ, OI > const other) const |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator> (other_point_t< OQ, OI > const other) const |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator<= (other_point_t< OQ, OI > const other) const |
template<typename OQ , typename OI > | |
constexpr enable_if_compatible_t< other_point_t< OQ, OI >, bool > | operator< (other_point_t< OQ, OI > const other) const |
Static Public Member Functions | |
template<typename U > | |
static point_t | castFrom (U value) |
Returns a new point initialized with the specified value. More... | |
static constexpr category_t | category () |
Returns an instance of the category of this object. More... | |
static constexpr bool | hasCategoryName () |
Returns whether this category has a name. More... | |
static std::string | categoryName () |
Returns the name of the category of this object. More... | |
template<typename OC > | |
static constexpr bool | same_category_as () |
Returns whether the type OC belongs to category_t . More... | |
template<typename OC > | |
static constexpr bool | same_category_as (OC const &) |
Returns whether the type OC belongs to category_t . More... | |
template<typename OC > | |
static constexpr bool | category_compatible_with () |
Returns whether OC has a category compatible with this one. More... | |
template<typename OC > | |
static constexpr bool | category_compatible_with (OC const &) |
Returns whether OC has a category compatible with this one. More... | |
A quantity point.
Q | quantity the interval is based on |
Cat | category this point belongs to (NoCategory by default) |
A point shares most of the concepts of a Quantity
, but it interacts only with other points rather than with bare Quantity
objects, with the exception of construction. In this sense, the relation between Point
and Quantity
is similar to the one between Quantity
and its base type (Quantity::value_t
).
In addition, Point
has some interaction with the corresponding Interval
: an interval can be seen as the distance, or difference, between two quantity points.
The point belongs to a category, which is just a tag that prevents different points from being mixed up. Note that intervals do not have a category.
Definition at line 605 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::baseunit_t = typename quantity_t::baseunit_t |
Description of the unscaled unit.
Definition at line 642 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::category_base_t = details::WithCategory<Cat> |
Definition at line 607 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::category_t = typename category_base_t::category_t |
The category this point belongs to.
Definition at line 626 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::enable_if_compatible_t = std::enable_if_t<category_base_t::template category_compatible_with<OC>(), Type> |
Definition at line 614 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::interval_t = IV |
The interval type corresponding to the unit of this point.
Definition at line 629 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::other_point_t = Point<OQ, category_t, OI> |
A point based on a different quantity but with the same category.
Definition at line 646 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::point_t = Point<Q, Cat, IV> |
This type.
Definition at line 617 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::quantity_t = Q |
Quantity the interval is based on.
Definition at line 623 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::scaled_quantity_t = rescale<quantity_t, R> |
A quantity in the same unit, but possibly a different scale.
Definition at line 633 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::traits_t = typename category_base_t::traits_t |
Traits of the category.
Definition at line 610 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::unit_t = typename quantity_t::unit_t |
Description of the scaled unit.
Definition at line 639 of file intervals.h.
using util::quantities::concepts::Point< Q, Cat, IV >::value_t = typename quantity_t::value_t |
Type of the stored value.
Definition at line 636 of file intervals.h.
|
explicitdefault |
Constructor: value is left uninitialized.
|
inlineexplicit |
Constructor: takes a value in the intended representation.
Definition at line 657 of file intervals.h.
|
inline |
Constructor: converts from a quantity.
OQ | type of the quantity |
q | quantity to be converted from |
The quantity is required to be in the same unit as this point (unit scale may differ). The value in q
is converted from its native scale into the one of this point.
Definition at line 670 of file intervals.h.
|
inline |
Constructor: converts from another point.
PT | type of the other point |
p | point to be converted from |
Points are required to be in the same unit (unit scale may differ). The value in p
is converted from its native scale into the one of this point.
Definition at line 683 of file intervals.h.
|
inlinestatic |
Returns a new point initialized with the specified value.
U | type to initialize the quantity with |
value | the value to initialize the point with |
Point
object initialized with value
The value
is cast into value_t
via static_cast()
.
Definition at line 887 of file intervals.h.
References value.
|
staticinherited |
Returns an instance of the category of this object.
Definition at line 1190 of file intervals.h.
|
staticinherited |
Returns whether OC
has a category compatible with this one.
Definition at line 1213 of file intervals.h.
|
staticinherited |
Returns whether OC
has a category compatible with this one.
Definition at line 1220 of file intervals.h.
|
staticinherited |
Returns the name of the category of this object.
Definition at line 1234 of file intervals.h.
|
inline |
Convert this interval into the specified one.
Definition at line 873 of file intervals.h.
|
staticinherited |
Returns whether this category has a name.
Definition at line 1227 of file intervals.h.
|
inlineexplicit |
|
inline |
Definition at line 822 of file intervals.h.
References util::quantities::concepts::operator!=(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Returns the sum of this point plus an interval (from quantity) (note that addition is not symmetric).
Definition at line 726 of file intervals.h.
|
inline |
Returns the sum of this point plus an interval (note that addition is not symmetric).
Definition at line 734 of file intervals.h.
References util::quantities::concepts::operator+(), and util::quantities::concepts::Interval< Q, Cat >::quantity().
|
inline |
Returns a point with same value.
Definition at line 786 of file intervals.h.
|
inline |
Add a quantity (possibly converted) to this one.
Definition at line 757 of file intervals.h.
References lar::dump::operator+=().
|
inline |
Add the other
interval (possibly converted) to this point.
Definition at line 765 of file intervals.h.
References lar::dump::operator+=(), and util::quantities::concepts::Interval< Q, Cat >::quantity().
|
inline |
Returns the value of this point after subtraction of an interval.
Definition at line 742 of file intervals.h.
|
inline |
Returns the value of this point after subtraction of an interval.
Definition at line 749 of file intervals.h.
References util::quantities::concepts::operator-(), and util::quantities::concepts::Interval< Q, Cat >::quantity().
|
inline |
Returns a parity-changed point.
Definition at line 789 of file intervals.h.
|
inline |
Subtract a quantity (possibly converted) from this one.
Definition at line 772 of file intervals.h.
|
inline |
Subtract the other
interval (possibly converted) from this point.
Definition at line 780 of file intervals.h.
References util::quantities::concepts::Interval< Q, Cat >::quantity().
|
inline |
Definition at line 850 of file intervals.h.
References util::quantities::concepts::operator<(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Definition at line 843 of file intervals.h.
References util::quantities::concepts::operator<=(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Definition at line 815 of file intervals.h.
References util::quantities::concepts::operator==(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Definition at line 836 of file intervals.h.
References util::quantities::concepts::operator>(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Definition at line 829 of file intervals.h.
References util::quantities::concepts::operator>=(), and util::quantities::concepts::Point< Q, Cat, IV >::quantity().
|
inline |
Returns the value of the interval as a quantity.
Definition at line 687 of file intervals.h.
References value.
Referenced by util::quantities::concepts::Point< Q, Cat, IV >::operator!=(), util::quantities::concepts::operator-(), util::quantities::concepts::Point< Q, Cat, IV >::operator<(), util::quantities::concepts::operator<<(), util::quantities::concepts::Point< Q, Cat, IV >::operator<=(), util::quantities::concepts::Point< Q, Cat, IV >::operator==(), util::quantities::concepts::Point< Q, Cat, IV >::operator>(), util::quantities::concepts::Point< Q, Cat, IV >::operator>=(), and util::quantities::concepts::to_string().
|
staticinherited |
Returns whether the type OC
belongs to category_t
.
Definition at line 1198 of file intervals.h.
|
staticinherited |
Returns whether the type OC
belongs to category_t
.
Definition at line 1205 of file intervals.h.