Simulation Class Reference

Encapsulation of the main loop of a simulation. More...

#include <Simulation/Simulation.H>

Inheritance diagram for Simulation:
Inheritance graph
[legend]
Collaboration diagram for Simulation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Simulation (QWidget *parent=0, const char *name=0)
void createIcon (int num)
void currentItem (int item)
float getAngle ()
void getCoord (int i, int &x, int &y)
void setCoordByPix (int i, int x, int y)
void setCoordByGL (int i, float glx, float gly)
void getRealPosition (int i, float &rx, float &ry)
void getGLPosition (float rx, float ry, float &gx, float &gy)
void reset ()
iconImagegetList ()
 Simulation (OptionManager &mgr)
 Constructor.
virtual ~Simulation ()
 Destructor.
void addModule (nub::ref< SimModule > mod)
 Add a module to our evolve list.
int run ()
 Run the simulation until it breaks.

Public Attributes

float angle
float scale

Protected Member Functions

void initializeGL ()
void resizeGL (int w, int h)
void paintGL ()
void mousePressEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)

Detailed Description

Encapsulation of the main loop of a simulation.

This class encapsulates the main loop of a typical simulation. Basically it holds a SimEventQueue and a bunch of SimModules, and will keep evolving the modules and the queue until some simulation break event terminates the simulation. Modules are evolved in the order in which they have been added using addModule(), and the queue is evolved last.

Definition at line 74 of file simulation.h.


Constructor & Destructor Documentation

Simulation::Simulation ( OptionManager mgr  ) 

Constructor.

Definition at line 49 of file Simulation.C.

References ModelComponent::addSubComponent().

virtual Simulation::~Simulation (  )  [virtual]

Destructor.


Member Function Documentation

void Simulation::addModule ( nub::ref< SimModule mod  ) 

Add a module to our evolve list.

At each time step, SimModule::evolve() will be called on each added module, then on our internal SimEventQueue.

Definition at line 58 of file Simulation.C.

References ModelComponent::addSubComponent().

int Simulation::run (  ) 

Run the simulation until it breaks.

Keep evolve()'ing the simulation until some module posts a SimBreak event. Returns 0 if the simulation ended normally through catching a SimBreak event, or -1 if a Unix signal was caught (e.g., CTRL-C).

Definition at line 65 of file Simulation.C.

References catchsignals(), PauseWaiter::checkPause(), SimEventQueue::evolve(), and signame().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:49 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3