///////////////////////////////////////////////////////////////////
//
// A logical group of processors to be executed sequentially, if the
// conditional processor returns OKTRUE. This block continually executes
// its processor list DSEvent IFF the conditional processor returns
// OKTRUE. Note the BeginOfRun and EndOfRun methods are executed for all
// processors including the conditional.
//
// Author: P G Jones
//
// REVISION HISTORY:
// 2013-10-11 : P G Jones - New File.
//
///////////////////////////////////////////////////////////////////
#ifndef __RAT_WhileProcBlock__
#define __RAT_WhileProcBlock__
#include
#include
namespace RAT
{
class WhileProcBlock : public ProcBlock
{
public:
// Construct the WhileProcBlock
//
// proc: the conditional processor
WhileProcBlock( Processor* const proc );
// Destroy the WhileProcBlock
virtual ~WhileProcBlock();
// Close the the current ProcBlock
//
// Will close this ProcBlock if no nested ProcBlocks are open
//
// type: Identifies the command used, block will Log::Die if incorrect command applied.
virtual void EndCommand( const EEndCommand type );
// Called at the beginning of a run
//
// Each processor is called in turn (no conditional aspect)
//
// run: Data structure for the run
virtual void BeginOfRun( DS::Run& run );
// Called for each event
//
// Firstly the conditional processor is evaluated, if the result is OKTRUE then
// each processor is called in turn if the result is anything else then
// no processors are called.
//
// run: Data structure for the run
// ds: Data structure for the event
//
// Returns a Is the net condition for all processors in the list, will be OK, FAIL or ABORT
virtual Processor::Result DSEvent( DS::Run& run, DS::Entry& ds );
// Called at the end of a run.
//
// Each processor is called in turn (no conditional aspect)
//
// run: Data structure for the run
virtual void EndOfRun( DS::Run& run );
protected:
Processor* fConditionalProcessor; // The processor to conditional while upon
Profiler fConditionalBeginProfiler; // Profiler details (total time, calls) for the BeginOfRun call
Profiler fConditionalEventProfiler; // Profiler details (total time, calls) for the conditional DSEvent call
Profiler fConditionalEndProfiler; // Profiler details (total time, calls) for the EndOfRun call
};
} // namespace RAT
#endif