mixpp: bdm::logger Class Reference

bdm::logger Class Reference

Class for storing results (and semi-results) of an experiment. More...

#include <bdmbase.h>

Inheritance diagram for bdm::logger:

bdm::root bdm::memlog bdm::dirfilelog bdm::mexlog bdm::stdlog List of all members.

Public Member Functions

 logger (const string separator)
 Default constructor.
 ~logger ()
 Destructor calls the finalize method.
template<class T>
void add_vector (log_level_intermediate< T > &log_level, enum T::log_level_enums const log_level_enum, const RV &rv, const string &prefix, int enum_subindex=0)
template<class T>
void add_setting (log_level_intermediate< T > &log_level, enum T::log_level_enums const log_level_enum, const string &prefix, int enum_subindex=0)
virtual void step ()=0
 Shifts storage position for another time step.
virtual void finalize ()
virtual void init ()
 Initialize the storage.

Public Attributes

const string separator

Protected Member Functions

template<class U>
void log_setting (int id, const U data)
virtual void log_vector (int id, const vec &v) NOT_IMPLEMENTED_VOID
virtual void log_double (int id, const double &d) NOT_IMPLEMENTED_VOID

Protected Attributes

Array< RVentries
 RVs of all logged variables.
Array< string > names
 Names of logged quantities, e.g. names of algorithm variants.
Config setting_conf
 Root Setting for storing Settings.
Array< Setting * > settings
 list of Settings for specific ids

Friends

class log_level_template
 it is necessary to allow log_levels to call log_setting, log_vector and log_double methods

Detailed Description

Class for storing results (and semi-results) of an experiment.

This class abstracts logging of results from implementation. This class replaces direct logging of results (e.g. to files or to global variables) by calling methods of a logger. Specializations of this abstract class for specific storage method are designed.


Member Function Documentation

template<class T>
void bdm::logger::add_setting ( log_level_intermediate< T > &  log_level,
enum T::log_level_enums const   log_level_enum,
const string &  prefix,
int  enum_subindex = 0 
) [inline]

sets up the ids identifier in the passed log_level instance to permit future calls of the log_level_template<T>::store(...) method

It also sets a pointer to logger or justify it is correctly assigned from previous call to this procedure

To allow both arguments log_level and log_level_enum be templated, it was necessary to declare log_level_intermediate<T> class. This way we check compatibility of the passed log_level and log_level_enum, which would be impossible using just log_level_base class here.

passing the last parameter enum_subindex one can store multiple settings in the position of one enum

template<class T>
void bdm::logger::add_vector ( log_level_intermediate< T > &  log_level,
enum T::log_level_enums const   log_level_enum,
const RV rv,
const string &  prefix,
int  enum_subindex = 0 
) [inline]

sets up the ids identifier in the passed log_level instance to permit future calls of the log_level_template<T>::store(...) method

It also sets a pointer to logger or justify it is correctly assigned from previous call to this procedure Entries with empty RV will be ignored

passing the last parameter enum_subindex one can store multiple vectors in the position of one enum

virtual void bdm::logger::finalize (  )  [inline, virtual]

Finalize storing information

This method is called either directly or via destructor ~logger(), therefore it has to permit repetitive calls for the case it is called twice

virtual void bdm::logger::log_double ( int  id,
const double &  d 
) [protected, virtual]

log this double

this method has to be called only through log_level class to assure the validity of the passed id

template<class U>
void bdm::logger::log_setting ( int  id,
const U  data 
) [inline, protected]

log this instance to Setting

this method has to be called only through log_level class to assure the validity of the passed id

virtual void bdm::logger::log_vector ( int  id,
const vec &  v 
) [protected, virtual]

log this vector

this method has to be called only through log_level class to assure the validity of the passed id


Member Data Documentation

const string bdm::logger::separator

separator of prefixes of entries

It is a constant string, thus it can be safely declared as public without creating any accessor method


The documentation for this class was generated from the following file:
Generated on 2 Dec 2013 for mixpp by  doxygen 1.4.7