detinfo::timescales::timescale_traits< Cat > Struct Template Reference

A collection of traits for a time scale. More...

#include <DetectorTimingTypes.h>

Inheritance diagram for detinfo::timescales::timescale_traits< Cat >:
detinfo::timescales::details::custom_timescale_traits< Cat >

Detailed Description

template<typename Cat>
struct detinfo::timescales::timescale_traits< Cat >

A collection of traits for a time scale.

Template Parameters
Catcategory the traits belong to

The included traits are documented in details::timescale_traits_base.

Writing traits for a category

Traits are specified by specializing the timescale_traits class for the category. The easiest way is to derive the specialized class from details::timescale_traits_base<Cat> and add the necessary customization:

template <>
struct timescale_traits<MyCat>: details::timescale_traits_base<MyCat>
{
// more customization as needed
};
} // namespace detinfo::timescales

Category compatibility

Among the traits, one offers whether a specified category is "compatible" with this one. The easiest way to implement that is to define a set of compatible categories, and then an object which returns whether a category is among them. This object should override category_compatible_with member of each relevant category trait. A way to achieve that is to define a specific trait base class:

struct TimeOnePointOneCategory: util::quantities::concepts::CategoryBase
{ static std::string name() { return "time 1.1"; } };
struct TimeOnePointTwoCategory: util::quantities::concepts::CategoryBase
{ static std::string name() { return "time 1.2"; } };
template <typename TimeOneCat>
struct timeone_traits_base
{
template <typename OC>
static constexpr bool category_compatible_with = util::is_any_of_v
<OC, TimeOnePointOneCategory, TimeOnePointTwoCategory>;
};
template <>
struct timescale_traits<::TimeOnePointOneCategory>
: ::timeone_traits_base<::TimeOnePointOneCategory>
{};
template <>
struct timescale_traits<::TimeOnePointTwoCategory>
: ::timeone_traits_base<::TimeOnePointTwoCategory>
{};
} // namespace detinfo::timescales

Definition at line 89 of file DetectorTimingTypes.h.


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