1 #ifndef canvas_Persistency_Common_detail_aggregate_h 2 #define canvas_Persistency_Common_detail_aggregate_h 5 #include "cetlib/container_algorithms.h" 6 #include "cetlib/map_vector.h" 7 #include "cetlib/metaprogramming.h" 8 #include "cetlib_except/demangle.h" 24 class HepLorentzVector;
33 using cet::enable_if_function_exists_t;
35 template <
typename T,
typename =
void>
41 enable_if_function_exists_t<void (T::*)(T const&), &T::aggregate>>
47 enable_if_function_exists_t<void (T::*)(T), &T::aggregate>>
50 template <
typename T,
typename Enable =
void>
56 <<
"Products of type \"" << cet::demangle_symbol(
typeid(T).name())
57 <<
"\" cannot be aggregated.\n" 58 <<
"Please contact artists@fnal.gov.\n";
89 p.insert(p.cend(), other.cbegin(), other.cend());
98 p.insert(p.cend(), other.cbegin(), other.cend());
102 template <
typename T>
107 p.insert(p.cend(), other.cbegin(), other.cend());
112 template <
typename T,
size_t N>
117 cet::transform_all(p, other,
begin(p), [](T
t1, T
const&
t2) {
125 template <std::
size_t>
130 template <
typename Tuple>
136 template <std::
size_t I>
138 template <
typename Tuple>
142 using elem_type = std::tuple_element_t<I, Tuple>;
149 template <
typename... Args>
158 template <
typename K,
typename V>
164 p.insert(other.cbegin(), other.cend());
168 template <
typename K,
typename V>
178 template <
typename K,
typename V>
183 p.insert(other.cbegin(), other.cend());
187 template <
typename T>
193 p.insert(other.cbegin(), other.cend());
197 template <
typename T>
203 p.insert(other.cbegin(), other.cend());
215 <<
"Products of type \"" 216 << cet::demangle_symbol(
typeid(std::string).name())
217 <<
"\" cannot be aggregated unless their values are the same.\n" 218 <<
"Values presented were: \"" << p <<
"\" and \"" << other
228 static void aggregate(CLHEP::HepVector& p, CLHEP::HepVector
const&
other);
233 static void aggregate(CLHEP::Hep2Vector& p, CLHEP::Hep2Vector
const&
other);
238 static void aggregate(CLHEP::Hep3Vector& p, CLHEP::Hep3Vector
const&
other);
243 static void aggregate(CLHEP::HepLorentzVector& p,
244 CLHEP::HepLorentzVector
const&
other);
249 static void aggregate(CLHEP::HepMatrix& p, CLHEP::HepMatrix
const&
other);
254 static void aggregate(CLHEP::HepSymMatrix& p,
255 CLHEP::HepSymMatrix
const&
other);
272 template <
typename T>
static void aggregate(std::set< T > &p, std::set< T > const &other)
static void aggregate(T &p, T const &other)
static void aggregate(T &p, T const other)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
auto array(Array const &a)
Returns a manipulator which will print the specified array.
static void aggregate(std::tuple< Args... > &p, std::tuple< Args... > const &other)
static void aggregate(T &, T const &)
static void aggregate(std::string &p, std::string const &other)
static void combine(Tuple &, Tuple const &)
static void aggregate(std::array< T, N > &p, std::array< T, N > const &other)
static void aggregate(std::deque< T > &p, std::deque< T > const &other)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
static void aggregate(std::list< T > &p, std::list< T > const &other)
static void combine(Tuple &p, Tuple const &other)
static void aggregate(cet::map_vector< T > &p, cet::map_vector< T > const &other)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
static void aggregate(std::multimap< K, V > &p, std::multimap< K, V > const &other)
static void aggregate(std::map< K, V > &p, std::map< K, V > const &other)
static void aggregate(T &p, T const &other)
static void aggregate(std::vector< T > &p, std::vector< T > const &other)
static void aggregate(std::pair< K, V > &p, std::pair< K, V > const &other)