diff options
author | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-03-09 16:43:07 +0100 |
---|---|---|
committer | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-03-09 16:43:07 +0100 |
commit | ca4222ab40f1c6c0d17fb7d43539aa675f640976 (patch) | |
tree | e2a91037ac1d9e8895eafbab54c1c11f0b257c85 /bottleneck/include/diagram_traits.h | |
parent | 7fb44351b487c64f23066a428089ef14a95b4176 (diff) | |
parent | 14e91d6c3ad81a1ec763d75a28f20fb689e5166e (diff) |
Merge README
Diffstat (limited to 'bottleneck/include/diagram_traits.h')
-rw-r--r-- | bottleneck/include/diagram_traits.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bottleneck/include/diagram_traits.h b/bottleneck/include/diagram_traits.h new file mode 100644 index 0000000..c8d4862 --- /dev/null +++ b/bottleneck/include/diagram_traits.h @@ -0,0 +1,45 @@ +#ifndef HERA_DIAGRAM_TRAITS_H +#define HERA_DIAGRAM_TRAITS_H + +namespace hera { + +template<class PairContainer_, class PointType_ = typename std::remove_reference< decltype(*std::declval<PairContainer_>().begin())>::type > +struct DiagramTraits +{ + using Container = PairContainer_; + using PointType = PointType_; + using RealType = typename std::remove_reference< decltype(std::declval<PointType>()[0]) >::type; + + static RealType get_x(const PointType& p) { return p[0]; } + static RealType get_y(const PointType& p) { return p[1]; } +}; + + +template<class PairContainer_> +struct DiagramTraits<PairContainer_, std::pair<double, double>> +{ + using PointType = std::pair<double, double>; + using RealType = double; + using Container = std::vector<PointType>; + + static RealType get_x(const PointType& p) { return p.first; } + static RealType get_y(const PointType& p) { return p.second; } +}; + + +template<class PairContainer_> +struct DiagramTraits<PairContainer_, std::pair<float, float>> +{ + using PointType = std::pair<float, float>; + using RealType = float; + using Container = std::vector<PointType>; + + static RealType get_x(const PointType& p) { return p.first; } + static RealType get_y(const PointType& p) { return p.second; } +}; + + +} // end namespace hera + + +#endif // HERA_DIAGRAM_TRAITS_H |