Robotcode  1.0
Block Class Reference

Abstract block class with behavior for a collection of trials. More...

#include <Experiment.h>

Inheritance diagram for Block:

List of all members.

Public Member Functions

 Block ()
 ~Block ()
virtual bool init (int blocknum, string filename)
 initialize the Trials
virtual void control ()
 control loop for block
virtual void announce ()
 Calls the announcing routine for a block.
virtual void start ()
 starts the block
virtual void giveFeedback ()
 function for Block feedback
virtual void end ()
 Called after feedback: Clean feedback + End the block.
virtual TrialgetTrial ()=0
 create a new Trial
virtual void save ()
 save mov and dat file

Public Attributes

int blockNumber
 Block number.
int trialNum
 Number of the current Trial.
int numTrials
 Total number of trials.
vector< Trial * > trialVec
 Vector of trials.
BlockState state
 state of the block
string datFilename
 Data file name.
string movFilename
 Mov file name.
string targetFilename
 Name of current Target file.
ofstream datFile
 Data file.
ofstream movFile
 Mov file.
ifstream targetFile
 Target file for input.
bool isSaved
 is Block saved?

Detailed Description

Abstract block class with behavior for a collection of trials.

A block is created by typing run at the Text Display. It then reads in a target file and creates as many trial objects as lines in the target file. It then runs these trials and saves the data to disk.

Constructor & Destructor Documentation

Block::Block ( )


The Constructor only sets the number of Trials to zero

Block::~Block ( )


Destructor frees the memory allocated by the block, including the recorded data

Member Function Documentation

bool Block::init ( int  blockn,
string  filename 
) [virtual]

initialize the Trials

Initializes the Block by reading from a target file init makes the .mov and .dat file for later data saving. Calls Trial::read to specify how a trial is read

blocknBlock number
filenameName of the target file to be read in
boolean whether successful or not
void Block::control ( ) [virtual]

control loop for block

Control loop for the Block. When started it calls start(). Then it sets the state of the first trial to START_TRIAL and waits until it is in the state END_TRIAL. Then it automatically advances to the next trial. After the block it calls give_feedback and save.

See also:
start() give_feedback() save() end()

check if user interrupted current block

void Block::save ( ) [virtual]

save mov and dat file

Saves the data collected in a Block. Gives error message if files could not be opened for writing. The routine calls trial->writeDat() to write a line in the dat file, and trial->writeMov() to write a trial into the mov file

See also:
Trial::writeDat() Trial::writeMov() Trial::writeHeader()

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