All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
Serialize_recorder< Recorder_type > Class Template Reference

#include <sample_recorder.h>

Public Types

typedef Recorder_type::Model_type Model_type
typedef Recorder_type::Value_type Value_type

Public Member Functions

 Serialize_recorder (const Recorder_type &r, const std::string &fname_fmt, size_t iterations)
void operator() (const Model_type &model, const Step_log< Model_type > &log)
const Value_typeget () const

Detailed Description

template<class Recorder_type>
class Serialize_recorder< Recorder_type >

"Wraps" and existing recorder, making it serialize the recorded value to a file at every iteration

Template Parameters
RecorderA type implemeting the ModelRecorder concept.
Because the wrapped recorder is stored by reference, the caller must ensure it isn't freed while Serialization_recorder is in use.

Member Typedef Documentation

template<class Recorder_type>
typedef Recorder_type::Model_type Serialize_recorder< Recorder_type >::Model_type
template<class Recorder_type>
typedef Recorder_type::Value_type Serialize_recorder< Recorder_type >::Value_type

Constructor & Destructor Documentation

template<class Recorder_type>
Serialize_recorder< Recorder_type >::Serialize_recorder ( const Recorder_type &  r,
const std::string &  fname_fmt,
size_t  iterations 
recorderThe ModelRecorder to wrap. This object's get function must be serializable.
fname_fmtA printf-style format string that includes one integer field. E.g. "output_%0d" will result in files named "output_00, output_01, ...".
iterationsThe number of iterations per file. If iterations is N, then the N-th iteration will trigger an output, the 2N-th iteration, etc.. Setting iterations to zero disables writing.

Member Function Documentation

template<class Recorder_type>
const Value_type& Serialize_recorder< Recorder_type >::get ( ) const
template<class Recorder_type>
void Serialize_recorder< Recorder_type >::operator() ( const Model_type model,
const Step_log< Model_type > &  log 

Typical record callback. Calls wrapped recorder's callback and increments a counter. If the counter is high enough, output is written to a file and the counter is reset.

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