Dune Core Modules (unstable)

Dune::CollectorStream Class Reference

Data collector stream. More...

#include <dune/common/test/collectorstream.hh>

Public Member Functions

template<class CallBack , Dune::disableCopyMove< CollectorStream, CallBack > = 0>
 CollectorStream (CallBack &&callBack)
 Create from callback. More...
 
 CollectorStream (CollectorStream &&other)
 Move constructor. More...
 
 ~CollectorStream ()
 Destructor. More...
 

Detailed Description

Data collector stream.

A class derived from std::ostringstream that allows to collect data via a temporary returned object. To facilitate this it stores a callback that is used to pass the collected data to its creator on destruction.

In order to avoid passing the same data twice, copy construction is forbidden and only move construction is allowed.

Constructor & Destructor Documentation

◆ CollectorStream() [1/2]

template<class CallBack , Dune::disableCopyMove< CollectorStream, CallBack > = 0>
Dune::CollectorStream::CollectorStream ( CallBack &&  callBack)
inline

Create from callback.

Template Parameters
CallBackType of callback. Must be convertible to std::function<void(std::string)>
Parameters
callBackA copy of this function will be stored and called on destruction.

◆ CollectorStream() [2/2]

Dune::CollectorStream::CollectorStream ( CollectorStream &&  other)
inline

Move constructor.

This will take over the data and callback from the moved from CollectorStream and disable the callback in the latter.

◆ ~CollectorStream()

Dune::CollectorStream::~CollectorStream ( )
inline

Destructor.

This calls the callback function given on creation passing all collected data as a single string argument.


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Mar 28, 23:30, 2024)