CYCLUS
Loading...
Searching...
No Matches
cyclus::Recorder Class Reference

Detailed Description

Collects and manages output data generation for the cyclus core and agents during a simulation.

By default, datum managers are auto-initialized with a unique uuid simulation id.

Example usage:

Recorder* manager = new Recorder();
...
...
manager->NewDatum("CapacityFactor");
->AddVal("Name", aname)
->AddVal("Capacity", cap)
->Record();
...
...
manager->Close();
Datum * AddVal(const char *field, boost::spirit::hold_any val, std::vector< int > *shape=NULL)
Add an arbitrary field-value pair to the datum.
Definition datum.cc:22
void Record()
Record this datum to its Recorder.
Definition datum.cc:35
Collects and manages output data generation for the cyclus core and agents during a simulation.
Definition recorder.h:45
void RegisterBackend(RecBackend *b)
Registers b to receive Datum notifications for all Datum objects collected by the Recorder and to rec...
Definition recorder.cc:113
Datum * NewDatum(std::string title)
Creates a new datum namespaced under the specified title.
Definition recorder.cc:69
Recorder()
create a new recorder with default dump frequency, random simulation id, and simulation id injection.
Definition recorder.cc:13
void Close()
Flushes all buffered Datum objects and flushes all registered backends.
Definition recorder.cc:117
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters

Definition at line 45 of file recorder.h.

#include <recorder.h>

Public Member Functions

void Close ()
 
unsigned int dump_count ()
 
void Flush ()
 
bool inject_sim_id ()
 
void inject_sim_id (bool x)
 
DatumNewDatum (std::string title)
 
 Recorder ()
 
 Recorder (bool inject_sim_id)
 
 Recorder (boost::uuids::uuid simid)
 
 Recorder (unsigned int dump_count)
 
void RegisterBackend (RecBackend *b)
 
void set_dump_count (unsigned int count)
 
boost::uuids::uuid sim_id ()
 
 ~Recorder ()
 

Constructor & Destructor Documentation

◆ Recorder() [1/4]

cyclus::Recorder::Recorder ( )

create a new recorder with default dump frequency, random simulation id, and simulation id injection.

Definition at line 13 of file recorder.cc.

◆ Recorder() [2/4]

cyclus::Recorder::Recorder ( bool inject_sim_id)

create a new recorder with the given dump count, random simulation id, and given flag for injecting the simulation id.

Definition at line 18 of file recorder.cc.

◆ Recorder() [3/4]

cyclus::Recorder::Recorder ( unsigned int dump_count)

create a new recorder with the given dump count and random simulation id.

Definition at line 23 of file recorder.cc.

◆ Recorder() [4/4]

cyclus::Recorder::Recorder ( boost::uuids::uuid simid)

create a new recorder with default dump frequency.

the specified simulation id, and simulation id injection.

Definition at line 28 of file recorder.cc.

◆ ~Recorder()

cyclus::Recorder::~Recorder ( )

Definition at line 33 of file recorder.cc.

Member Function Documentation

◆ Close()

void cyclus::Recorder::Close ( )

Flushes all buffered Datum objects and flushes all registered backends.

Unregisters all backends and resets.

Definition at line 117 of file recorder.cc.

◆ dump_count()

unsigned int cyclus::Recorder::dump_count ( )

Return the dump frequency, # Datum objects buffered between flushes to backends.

Definition at line 45 of file recorder.cc.

◆ Flush()

void cyclus::Recorder::Flush ( )

Flushes all buffered Datum objects and flushes all registered backends.

Definition at line 92 of file recorder.cc.

◆ inject_sim_id() [1/2]

bool cyclus::Recorder::inject_sim_id ( )
inline

returns whether or not the unique simulation id will be injected.

Definition at line 83 of file recorder.h.

◆ inject_sim_id() [2/2]

void cyclus::Recorder::inject_sim_id ( bool x)
inline

sets whether or not the unique simulation id will be injected.

Definition at line 86 of file recorder.h.

◆ NewDatum()

Datum * cyclus::Recorder::NewDatum ( std::string title)

Creates a new datum namespaced under the specified title.

Warning
choose title carefully to not conflict with Datum objects from other agents. Also note that a static title (e.g. an unchanging string) will result in multiple instances of this agent storing datum data together (e.g. the same table).

Definition at line 69 of file recorder.cc.

◆ RegisterBackend()

void cyclus::Recorder::RegisterBackend ( RecBackend * b)

Registers b to receive Datum notifications for all Datum objects collected by the Recorder and to receive a flush notification when there are no more Datum objects.

Parameters
bbackend to receive Datum objects

Definition at line 113 of file recorder.cc.

◆ set_dump_count()

void cyclus::Recorder::set_dump_count ( unsigned int count)

set the Recorder to flush its collected Datum objects to registered backends every [count] Datum objects.

If count == 0 then Datum objects will be flushed immediately as they come.

Parameters
count# Datum objects to buffer before flushing to backends.
Warning
this deletes all buffered data from the recorder.

Definition at line 53 of file recorder.cc.

◆ sim_id()

boost::uuids::uuid cyclus::Recorder::sim_id ( )

returns the unique id associated with this cyclus simulation.

Definition at line 49 of file recorder.cc.


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