Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

simth::CounterLoopControl Class Reference

Loop control that increments a counter each iteration. More...

#include <loopcontrol.h>

Inheritance diagram for simth::CounterLoopControl:

simth::LoopControl< T > List of all members.

Public Member Functions

 CounterLoopControl (const std::string &name, int numLoops)
virtual ~CounterLoopControl ()
const std::string & name () const
virtual std::string currentIteration () const
virtual std::string lastIteration () const
virtual bool nextIteration ()
virtual void connectControlInterface (ControlInterface *interface)
virtual bool reachedEnd ()
virtual void reset ()

Detailed Description

Loop control that increments a counter each iteration.

The counter is incremented each iteration until it reached a certain number of loops passed as argument in the constructor. Then nextIteration() and reachedEnd() returns false and true, respectivley. The connected control interfaces must belong to wrapped functions that takes no argument (see ControlInterface).


Constructor & Destructor Documentation

simth::CounterLoopControl::CounterLoopControl const std::string &  name,
int  numLoops
 

Class constructor.

Parameters:
name name of the loop control
numLoops of loops

virtual simth::CounterLoopControl::~CounterLoopControl  )  [virtual]
 


Member Function Documentation

const std::string& simth::CounterLoopControl::name  )  const [inline, virtual]
 

Each loop control has a unique name to be adressed in a simulation system.

Returns:
name of the loop control in the simulation system

Implements simth::LoopControl< T >.

virtual std::string simth::CounterLoopControl::currentIteration  )  const [virtual]
 

Returns a string that describes the current iteration value.

Implements simth::LoopControl< T >.

virtual std::string simth::CounterLoopControl::lastIteration  )  const [virtual]
 

Returns a string that describes the last iteration value, i.e. the iteration value when reachedEnd() equals true.

Implements simth::LoopControl< T >.

virtual bool simth::CounterLoopControl::nextIteration  )  [virtual]
 

In derived classes the implemented functions must provide the following behaviour:

Proceed to the next iteration step. If the loop control does not reach its end, it returns true and calls the function of all connected loop interfaces. If it reaches its end, it returns false and does not call any function of the connected loop interfaces.

Implements simth::LoopControl< T >.

virtual void simth::CounterLoopControl::connectControlInterface ControlInterface interface  )  [virtual]
 

Connect the loop control to a ControlInterface: each time the function nextIteration() is called, the function of a Device that is wrapped by the given ControlInterface is called also. (This is similar to the signal slot concept of QT.)

Parameters:
interface pointer to ControlInterface that wrapps a function.

Implements simth::LoopControl< T >.

virtual bool simth::CounterLoopControl::reachedEnd  )  [virtual]
 

Request the state of the loop control. Returns true if the last iteration has been executed.

Implements simth::LoopControl< T >.

virtual void simth::CounterLoopControl::reset  )  [virtual]
 

Reset the state of the loop control to its starting state and calls the functions of the connected loop interface.

Implements simth::LoopControl< T >.


Generated on Mon Apr 24 21:19:19 2006 for simthetic by  doxygen 1.4.1