11 #ifndef LARCORE_COREUTILS_DUMPUTILS_H 12 #define LARCORE_COREUTILS_DUMPUTILS_H 17 #include <type_traits> 28 template <
typename Coll>
36 template <
typename Stream,
typename Array>
39 if (n == 0) { out <<
"}";
return; }
43 while (++i < n) out <<
"; " << (*++it);
59 template <
typename Array>
76 template <
typename Stream>
77 void operator() (Stream&& out)
const 82 { std::ostringstream sstr; this->operator()(sstr);
return sstr.str(); }
98 template <
typename Stream>
99 void operator() (Stream&& out)
const 104 { std::ostringstream sstr; this->operator()(sstr);
return sstr.str(); }
154 template <
typename Vector>
170 template <
typename Stream>
171 void operator() (Stream&& out)
const 172 { out <<
"{ " << v.X() <<
"; " << v.Y() <<
"; " << v.Z() <<
" }"; }
176 { std::ostringstream sstr; this->operator()(sstr);
return sstr.str(); }
182 template <
typename T>
188 template <
typename T>
227 template <
size_t N,
typename Array>
264 template <
typename Vector>
300 template <
typename Vector3D>
335 template <
typename Stream,
typename Array>
336 Stream& operator<< (Stream&& out, ArrayDumper<Array>&& manip)
337 { manip(std::forward<Stream>(out));
return out; }
369 template <
typename Stream,
typename Vector>
370 Stream& operator<< (Stream&& out, VectorDumper<Vector>&& manip)
371 { manip(std::forward<Stream>(out));
return out; }
403 template <
typename String,
typename Vector>
408 template <
typename Vector>
413 template <
typename String,
typename Vector>
418 template <
typename Vector>
423 template <
typename String,
typename Vector>
433 #endif // LARCORE_COREUTILS_DUMPUTILS_H
auto vector3D(Vector3D const &v)
Returns a manipulator which will print the specified vector.
std::vector< float > Vector
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.
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.