11 #ifndef LARCORE_COREUTILS_DUMPUTILS_H 12 #define LARCORE_COREUTILS_DUMPUTILS_H 17 #include <type_traits> 26 template <
typename Coll>
40 template <
typename Stream,
typename Array>
52 out <<
"; " << (*++it);
68 template <
typename Array>
70 using Array_t = Array;
85 template <
typename Stream>
92 explicit operator std::string()
const 94 std::ostringstream sstr;
95 this->operator()(sstr);
101 template <
typename T>
112 template <
typename Stream>
119 explicit operator std::string()
const 121 std::ostringstream sstr;
122 this->operator()(sstr);
173 template <
typename Vector>
189 template <
typename Stream>
192 out <<
"{ " << v.X() <<
"; " << v.Y() <<
"; " << v.Z() <<
" }";
196 explicit operator std::string()
const 198 std::ostringstream sstr;
199 this->operator()(sstr);
206 template <
typename T>
212 template <
typename T>
249 template <
size_t N,
typename Array>
288 template <
typename Vector>
325 template <
typename Vector3D>
361 template <
typename Stream,
typename Array>
362 Stream& operator<<(Stream&& out, ArrayDumper<Array>&& manip)
364 manip(std::forward<Stream>(out));
397 template <
typename Stream,
typename Vector>
398 Stream& operator<<(Stream&& out, VectorDumper<Vector>&& manip)
400 manip(std::forward<Stream>(out));
434 template <
typename String,
typename Vector>
437 return s + std::string(manip);
441 template <
typename Vector>
444 return std::string(s) + manip;
448 template <
typename String,
typename Vector>
451 return std::string(manip) + s;
455 template <
typename Vector>
458 return manip + std::string(s);
462 template <
typename String,
typename Vector>
465 return s += std::string(manip);
472 #endif // LARCORE_COREUTILS_DUMPUTILS_H void operator()(Stream &&out) const
Inserts the content of the referenced array into the specified stream.
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
void operator()(Stream &&out) const
Inserts the content of the referenced array into the specified stream.
String operator+(String const &s, VectorDumper< Vector > const &manip)
Concatenates a vector to the specified string.
void dumpArray(Stream &&out, Array &&a, size_t n)
Inserts n of elements of a in the specified stream.
recob::tracking::Vector_t Vector3D
size_t n
Number of elements to be printed.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
ArrayDumper(Array_t a, size_t n)
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Vector_t const & v
A reference to the vector to be printed.
auto ptr_cbegin(Coll const &v)
Array_t const & a
A reference to the array to be printed.
VectorDumper(Vector_t const &v)
Dumps the first N elements of an array.
String & operator+=(String &s, VectorDumper< Vector > const &manip)
Appends a string rendering of a vector to the specified string.
void operator()(Stream &&out) const
Inserts the content of the stored vector into the specified stream.
Array_t a
A reference to the array to be printed.
Collection of utilities for dumping data on screen.
LArSoft-specific namespace.
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
ArrayDumper(Array_t const &a, size_t n)
size_t n
Number of elements to be printed.
Manipulator managing the dump of the vector content into a stream.