Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

SIGEL_Simulation::SIG_Recorder Class Reference

The SIG_Recorder is an abstract class for the classes that record simulation-data each timestep. More...

#include <SIG_Recorder.h>

Inheritance diagram for SIGEL_Simulation::SIG_Recorder:

SIGEL_GP::SIG_GPSimpleRecorder SIGEL_Visualisation::SIG_RenderRecorder List of all members.

Public Methods

 SIG_Recorder ()
 The SIG_Recorders constructor. More...

virtual void init () throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException)
 This method does initialization-work that cannot be done at construction time (because simulationQueries is still 0). More...

virtual void record () throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException)
 Will be called in each timeframe by the simulator. More...

virtual void finish () throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException)
 Is called after all the data-recording is done (for example to do final preparations on the collected data). More...

void setSimulationQueries (SIG_SimulationQueries const &newSimulationQueries)
 This sets the simulationQueries pointer. More...


Protected Attributes

SIG_SimulationQueries const* simulationQueries
 The pointer to the SIG_SimulationQueries object. More...


Private Attributes

bool initialized
 True if and only if the method init was already executed. More...

bool finished
 True if and only if the method finish was already executed. More...


Detailed Description

The SIG_Recorder is an abstract class for the classes that record simulation-data each timestep.

It contains a pointer to a SIG_SimulationQueries object whose methods can be used to collect information about the simulation state in the current frame. During the simulation run the three methods init, record and finish of the recorder are called by the SIG_Simulation's main methods (makeTimeStep respectively start). Their equivalents in derived class should perform the data-recording. From SIG_Recorder e.g. a fitness-recorder (collecting data used by a fitness function) or a render-recorder (collecting all the data used to graphically render the simulated frame) can be derived.

Definition at line 27 of file SIG_Recorder.h.


Constructor & Destructor Documentation

SIGEL_Simulation::SIG_Recorder::SIG_Recorder ( )
 

The SIG_Recorders constructor.

It has to be called by the constructors of derived classes.

Definition at line 3 of file SIG_Recorder.cpp.


Member Function Documentation

void SIGEL_Simulation::SIG_Recorder::finish ( ) throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException) [virtual]
 

Is called after all the data-recording is done (for example to do final preparations on the collected data).

Attention:
The virtual finish-method defined in a derived recorder-class has to call SIG_Recorder::finish() as its first statement!
Exceptions:
SIG_RecorderNoQueriesSetException   simulationQueries points to 0.
SIG_RecorderBadRecordingOrderException   finish was called more than once.
SIG_RecorderBadRecordingOrderException   finish was called before the init-call.

Precondition:
The pointer simlulationsQueries has to be set to the simulation's SIG_SimulationQueries object (must not be 0).
initialized has to be true (meaning that init has to be called).
finished has to be false (meaning that this is the first time finishe is called).

Reimplemented in SIGEL_GP::SIG_GPSimpleRecorder, and SIGEL_Visualisation::SIG_RenderRecorder.

Definition at line 32 of file SIG_Recorder.cpp.

Referenced by SIGEL_Visualisation::SIG_RenderRecorder::finish(), and SIGEL_GP::SIG_GPSimpleRecorder::finish().

void SIGEL_Simulation::SIG_Recorder::init ( ) throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException) [virtual]
 

This method does initialization-work that cannot be done at construction time (because simulationQueries is still 0).

Attention:
The virtual init-method defined in a derived recorder-class has to call SIG_Recorder::init() as its first statement!
Exceptions:
SIG_RecorderNoQueriesSetException   simulationQueries points to 0.
SIG_RecorderBadRecordingOrderException   init was called more than once.

Precondition:
The pointer simlulationsQueries has to be set to the simulation's SIG_SimulationQueries object (must not be 0).
initialized has to be false, because init may only be called once.
Postcondition:
The bool initialized is set to true.
The bool finished is (still) false.

Reimplemented in SIGEL_GP::SIG_GPSimpleRecorder, and SIGEL_Visualisation::SIG_RenderRecorder.

Definition at line 9 of file SIG_Recorder.cpp.

Referenced by SIGEL_Visualisation::SIG_RenderRecorder::init(), and SIGEL_GP::SIG_GPSimpleRecorder::init().

void SIGEL_Simulation::SIG_Recorder::record ( ) throw (SIG_RecorderNoQueriesSetException, SIG_RecorderBadRecordingOrderException) [virtual]
 

Will be called in each timeframe by the simulator.

Each time the record-method is called it takes the relevant information from the simulation's queries-interface and stored in an appropriate data structure.

Attention:
The virtual record-method defined in a derived recorder-class has to call SIG_Recorder::record() as its first statement!
Exceptions:
SIG_RecorderNoQueriesSetException   simulationQueries points to 0.
SIG_RecorderBadRecordingOrderException   record was called before the init-call
SIG_RecorderBadRecordingOrderException   record was called after the finish-call.

Precondition:
The pointer simlulationsQueries has to be set to the simulation's SIG_SimulationQueries object (must not be 0).
initialized has to be true (meaning that init has already been executed).
finished has to be false (meaning that finished hasn't executed yet).

Reimplemented in SIGEL_GP::SIG_GPSimpleRecorder, and SIGEL_Visualisation::SIG_RenderRecorder.

Definition at line 20 of file SIG_Recorder.cpp.

Referenced by SIGEL_Visualisation::SIG_RenderRecorder::record().

void SIGEL_Simulation::SIG_Recorder::setSimulationQueries ( SIG_SimulationQueries const & newSimulationQueries )
 

This sets the simulationQueries pointer.

Parameters:
newSimulationQueries   reference to the simulator's SIG_SimulationQueries object.

Postcondition:
simulationQueries points to the supplied SIG_SimulationQueries object.

Definition at line 45 of file SIG_Recorder.cpp.


Member Data Documentation

bool SIGEL_Simulation::SIG_Recorder::finished [private]
 

True if and only if the method finish was already executed.

Definition at line 140 of file SIG_Recorder.h.

bool SIGEL_Simulation::SIG_Recorder::initialized [private]
 

True if and only if the method init was already executed.

Definition at line 135 of file SIG_Recorder.h.

SIG_SimulationQueries const * SIGEL_Simulation::SIG_Recorder::simulationQueries [protected]
 

The pointer to the SIG_SimulationQueries object.

Its methods are the only way for the recorder to collect data about the simulation.

Definition at line 129 of file SIG_Recorder.h.


The documentation for this class was generated from the following files:
Generated at Mon Sep 3 01:32:53 2001 for PG 368 - SIGEL by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000