Tomographer  v5.2
Tomographer C++ Framework Documentation
Tomographer::MultipleMHRWStatsCollectors< MHRWStatsCollectors > Class Template Reference

A simple MHRWStatsCollector interface which combines several stats collectors. More...

#include <tomographer/mhrwstatscollectors.h>

Public Types

typedef std::tuple< MHRWStatsCollectors &... > MHRWStatsCollectorsRefTupleType
 
typedef std::tuple< MHRWStatsCollectors... > MHRWStatsCollectorsTupleType
 
typedef std::tuple< typename tomo_internal::multistatscoll_result_type_helper< MHRWStatsCollectors >::ResultType... > ResultType
 

Public Member Functions

 MultipleMHRWStatsCollectors (MHRWStatsCollectors &... statscollectors_)
 
 MultipleMHRWStatsCollectors (const MultipleMHRWStatsCollectors< MHRWStatsCollectors... > &copy)=default
 It's explicitly allowed to copy this stats collector.
 
template<int I>
const std::tuple_element< I, MHRWStatsCollectorsTupleType >::type & getStatsCollector () const
 
ResultType getResult () const
 
ResultType stealResult ()
 

Static Public Attributes

static constexpr int NumStatColl = sizeof...(MHRWStatsCollectors)
 The number of stats collectors we are tracking.
 

Detailed Description

template<typename... MHRWStatsCollectors>
class Tomographer::MultipleMHRWStatsCollectors< MHRWStatsCollectors >

A simple MHRWStatsCollector interface which combines several stats collectors.

A MHRandomWalk object expects one instance of a MHRWStatsCollector (see MHRWStatsCollector Interface); in case you wish to provide several stats collectors, you should use a MultipleMHRWStatsCollectors instance which combines all your preferred stats collectors.

The obscure variadic templating of this class should not scare you—it's relatively straightforward to use:

// some stat collectors
MyStatCollector1 statcoll1(..);
MyStatCollector2 statcoll2(..);
MyStatCollector3 statcoll3(..);
// we combine them into one single "stat collector interface", which we can then
// give as argument to the MHRandomWalk object:
MultipleMHRWStatsCollectors<MyStatCollector1,MyStatCollector2,MyStatCollector3>
multistatcollector(statcoll1, statcoll2, statcoll3);
MHRandomWalk<...> myrandomwalk(..., multistatcollector,...);
// now, the random walk will call the callbacks in `multistatcollector', which
// will relay the callbacks to all the given stat collectors `statcoll*'.

This class also implements the Resultable Interface interface, providing a ResultType member type which is a tuple of, for each stats collector, either its ResultType, or an empty type if the stats collector doesn't have a ResultType member.

The number of stat collectors that were defined is accessible through the constant enumeration value NumStatColl.

Definition at line 157 of file mhrwstatscollectors.h.


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