LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 69 of file DumpUtils.h.

Member Typedef Documentation

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

Definition at line 70 of file DumpUtils.h.

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

Definition at line 71 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 76 of file DumpUtils.h.

76 : a(a), n(n) {}
size_t n
Number of elements to be printed.
Definition: DumpUtils.h:74
Array_t const & a
A reference to the array to be printed.
Definition: DumpUtils.h:73
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 92 of file DumpUtils.h.

93  {
94  std::ostringstream sstr;
95  this->operator()(sstr);
96  return sstr.str();
97  }
void operator()(Stream &&out) const
Inserts the content of the referenced array into the specified stream.
Definition: DumpUtils.h:86
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 86 of file DumpUtils.h.

87  {
88  details::dumpArray(std::forward<Stream>(out), a, n);
89  }
void dumpArray(Stream &&out, Array &&a, size_t n)
Inserts n of elements of a in the specified stream.
Definition: DumpUtils.h:41
size_t n
Number of elements to be printed.
Definition: DumpUtils.h:74
Array_t const & a
A reference to the array to be printed.
Definition: DumpUtils.h:73
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 73 of file DumpUtils.h.

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

Number of elements to be printed.

Definition at line 74 of file DumpUtils.h.


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