RTT::extras::SimulationThread Class Reference

#include <SimulationThread.hpp>

Inheritance diagram for RTT::extras::SimulationThread:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool isRunning () const
virtual bool isRunning () const
virtual bool run (unsigned int maxsteps)
virtual bool run (unsigned int maxsteps)
virtual os::ThreadInterfacesimthread ()
virtual os::ThreadInterfacesimthread ()
virtual bool start (unsigned int maxsteps)
virtual bool start ()
virtual bool start (unsigned int maxsteps)
virtual bool start ()
virtual ~SimulationThread ()
virtual ~SimulationThread ()

Static Public Member Functions

static SimulationThreadPtr Instance (double period=0.001)
static SimulationThreadPtr Instance (double period=0.001)
static bool Release ()
static bool Release ()

Protected Member Functions

void finalize ()
void finalize ()
bool initialize ()
bool initialize ()
 SimulationThread (double period)
 SimulationThread (double period)
void step ()
void step ()

Private Attributes

os::TimeServicebeat
unsigned int cursteps
unsigned int maxsteps_
bool sim_running

Static Private Attributes

static SimulationThreadPtr _instance

Detailed Description

This thread is the simulated real-time periodic thread in the Orocos system.

All your activities in the same program must be a SimulationActivity for this to work, since the os::TimeService global time is updated when this thread runs.

By default, the update period is 0.001 seconds. If you want to run with a finer or coarser grained time step, use the Instance() method and supply another period before SimulationActivities are created.

Note:
This implementation has lost the capability to run SimulationActivity objects of different periods.

Definition at line 61 of file install/include/rtt/extras/SimulationThread.hpp.


Constructor & Destructor Documentation

RTT::SimulationThread::~SimulationThread (  )  [virtual]

Destructor

Definition at line 98 of file SimulationThread.cpp.

RTT::SimulationThread::SimulationThread ( double  period  )  [protected]

Constructor

Definition at line 86 of file SimulationThread.cpp.

virtual RTT::extras::SimulationThread::~SimulationThread (  )  [virtual]

Destructor

RTT::extras::SimulationThread::SimulationThread ( double  period  )  [protected]

Constructor


Member Function Documentation

void RTT::extras::SimulationThread::finalize (  )  [protected, virtual]
void RTT::SimulationThread::finalize (  )  [protected, virtual]
See also:
base::RunnableInterface::finalize()

Reimplemented from RTT::extras::TimerThread.

Definition at line 155 of file SimulationThread.cpp.

bool RTT::extras::SimulationThread::initialize (  )  [protected, virtual]
bool RTT::SimulationThread::initialize (  )  [protected, virtual]
See also:
base::RunnableInterface::initialize()

Reimplemented from RTT::extras::TimerThread.

Definition at line 141 of file SimulationThread.cpp.

static SimulationThreadPtr RTT::extras::SimulationThread::Instance ( double  period = 0.001  )  [static]

Create the SimulationThread with a given period. Only one SimulationThread can be created.

Parameters:
period The period in seconds at which the simulation takes steps and updates the TimeService. Only the first invocation of Instance will consider this parameter. The others will ignore it.
SimulationThreadPtr RTT::SimulationThread::Instance ( double  period = 0.001  )  [static]

Create the SimulationThread with a given period. Only one SimulationThread can be created.

Parameters:
period The period in seconds at which the simulation takes steps and updates the TimeService. Only the first invocation of Instance will consider this parameter. The others will ignore it.

Definition at line 69 of file SimulationThread.cpp.

virtual bool RTT::extras::SimulationThread::isRunning (  )  const [virtual]

Returns true if thread is running or run( unsigned int ) is being invoked.

Reimplemented from RTT::os::Thread.

bool RTT::SimulationThread::isRunning (  )  const [virtual]

Returns true if thread is running or run( unsigned int ) is being invoked.

Reimplemented from RTT::os::Thread.

Definition at line 103 of file SimulationThread.cpp.

static bool RTT::extras::SimulationThread::Release (  )  [static]

Releases the SimulationThread Reference counting might aid in making this call safe

Returns:
true on success, false on failure
bool RTT::SimulationThread::Release (  )  [static]

Releases the SimulationThread Reference counting might aid in making this call safe

Returns:
true on success, false on failure

Definition at line 79 of file SimulationThread.cpp.

virtual bool RTT::extras::SimulationThread::run ( unsigned int  maxsteps  )  [virtual]

Execute maxsteps steps immediately. This function will call the step() functions maxsteps times, without requiring start() or stop() to be called before or after. The thread is thus not used.

Returns:
false if maxsteps == 0
Postcondition:
When run() returns, step() has been called maxsteps times.
bool RTT::SimulationThread::run ( unsigned int  maxsteps  )  [virtual]

Execute maxsteps steps immediately. This function will call the step() functions maxsteps times, without requiring start() or stop() to be called before or after. The thread is thus not used.

Returns:
false if maxsteps == 0
Postcondition:
When run() returns, step() has been called maxsteps times.

Definition at line 122 of file SimulationThread.cpp.

virtual os::ThreadInterface* RTT::extras::SimulationThread::simthread (  )  [virtual]

Always returns the MainThread.

os::ThreadInterface * RTT::SimulationThread::simthread (  )  [virtual]

Always returns the MainThread.

Definition at line 137 of file SimulationThread.cpp.

virtual bool RTT::extras::SimulationThread::start ( unsigned int  maxsteps  )  [virtual]

Only run the simulation maxsteps time steps, then stop the SimulationThread.

Returns:
false if maxsteps == 0 or if thread could not be started.
virtual bool RTT::extras::SimulationThread::start (  )  [virtual]

Start the Thread.

Postcondition:
initialize() is called first
The Thread is running
Returns:
true if the function did succeed. false otherwise.

Reimplemented from RTT::os::Thread.

bool RTT::SimulationThread::start ( unsigned int  maxsteps  )  [virtual]

Only run the simulation maxsteps time steps, then stop the SimulationThread.

Returns:
false if maxsteps == 0 or if thread could not be started.

Definition at line 114 of file SimulationThread.cpp.

bool RTT::SimulationThread::start (  )  [virtual]

Start the Thread.

Postcondition:
initialize() is called first
The Thread is running
Returns:
true if the function did succeed. false otherwise.

Reimplemented from RTT::os::Thread.

Definition at line 108 of file SimulationThread.cpp.

void RTT::extras::SimulationThread::step (  )  [protected, virtual]
void RTT::SimulationThread::step (  )  [protected, virtual]
See also:
base::RunnableInterface::step()

Reimplemented from RTT::extras::TimerThread.

Definition at line 166 of file SimulationThread.cpp.


Member Data Documentation

Our only instance of the SimulationThread

Definition at line 132 of file install/include/rtt/extras/SimulationThread.hpp.

The System clock.

Definition at line 137 of file install/include/rtt/extras/SimulationThread.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


rtt
Author(s): RTT Developers
autogenerated on Fri Jan 11 09:49:56 2013