Public Types | Public Member Functions | Public Attributes | List of all members
lar::dump::ArrayDumper< Array > Struct Template Reference

Dumps the first N elements of an array. More...

#include <DumpUtils.h>

Public Types

using Array_t = Array
 
using This_t = ArrayDumper< Array_t >
 

Public Member Functions

 ArrayDumper (Array_t const &a, size_t n)
 
 ArrayDumper (This_t const &from)=default
 
 ArrayDumper (This_t &&from)=default
 
ArrayDumperoperator= (This_t const &from)=delete
 
ArrayDumperoperator= (This_t &&from)=delete
 
template<typename Stream >
void operator() (Stream &&out) const
 Inserts the content of the referenced array into the specified stream. More...
 
 operator std::string () const
 Converts the content of the stored vector into a string. More...
 

Public Attributes

Array_t const & a
 A reference to the array to be printed. More...
 
size_t n
 Number of elements to be printed. More...
 

Detailed Description

template<typename Array>
struct lar::dump::ArrayDumper< Array >

Dumps the first N elements of an array.

Template Parameters
Arraythe array type (supporting indexing operator)

The dump is producer by the call operator, in the form

{ a1, a2, ... aN }

Definition at line 60 of file DumpUtils.h.

Member Typedef Documentation

template<typename Array>
using lar::dump::ArrayDumper< Array >::Array_t = Array

Definition at line 61 of file DumpUtils.h.

template<typename Array>
using lar::dump::ArrayDumper< Array >::This_t = ArrayDumper<Array_t>

Definition at line 62 of file DumpUtils.h.

Constructor & Destructor Documentation

template<typename Array>
lar::dump::ArrayDumper< Array >::ArrayDumper ( Array_t const &  a,
size_t  n 
)
inline

Definition at line 67 of file DumpUtils.h.

67 : a(a), n(n) {}
size_t n
Number of elements to be printed.
Definition: DumpUtils.h:65
Array_t const & a
A reference to the array to be printed.
Definition: DumpUtils.h:64
template<typename Array>
lar::dump::ArrayDumper< Array >::ArrayDumper ( This_t const &  from)
default
template<typename Array>
lar::dump::ArrayDumper< Array >::ArrayDumper ( This_t &&  from)
default

Member Function Documentation

template<typename Array>
lar::dump::ArrayDumper< Array >::operator std::string ( ) const
inlineexplicit

Converts the content of the stored vector into a string.

Definition at line 81 of file DumpUtils.h.

82  { std::ostringstream sstr; this->operator()(sstr); return sstr.str(); }
void operator()(Stream &&out) const
Inserts the content of the referenced array into the specified stream.
Definition: DumpUtils.h:77
template<typename Array>
template<typename Stream >
void lar::dump::ArrayDumper< Array >::operator() ( Stream &&  out) const
inline

Inserts the content of the referenced array into the specified stream.

Definition at line 77 of file DumpUtils.h.

78  { details::dumpArray(std::forward<Stream>(out), a, n); }
void dumpArray(Stream &&out, Array &&a, size_t n)
Inserts n of elements of a in the specified stream.
Definition: DumpUtils.h:37
size_t n
Number of elements to be printed.
Definition: DumpUtils.h:65
Array_t const & a
A reference to the array to be printed.
Definition: DumpUtils.h:64
template<typename Array>
ArrayDumper& lar::dump::ArrayDumper< Array >::operator= ( This_t const &  from)
delete
template<typename Array>
ArrayDumper& lar::dump::ArrayDumper< Array >::operator= ( This_t &&  from)
delete

Member Data Documentation

template<typename Array>
Array_t const& lar::dump::ArrayDumper< Array >::a

A reference to the array to be printed.

Definition at line 64 of file DumpUtils.h.

template<typename Array>
size_t lar::dump::ArrayDumper< Array >::n

Number of elements to be printed.

Definition at line 65 of file DumpUtils.h.


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