#include <mtsTask.h>
Inheritance diagram for mtsTask:


Definition at line 59 of file mtsTask.h.
typedef cmnNamedMap<mtsStateTable> mtsTask::StateTableMapType [protected] |
| mtsTask::mtsTask | ( | const std::string & | name, | |
| unsigned int | sizeStateTable = 256 | |||
| ) |
Create a task with name 'name' and set the state table size (see mtsStateTable). This is the task base class. Tasks should be derived from one of the existing derived classes: mtsTaskContinuous, mtsTaskPeriodic, and mtsTaskFromCallback.
| name | The name for the task | |
| sizeStateTable | The history size of the state table |
| virtual mtsTask::~mtsTask | ( | ) | [virtual] |
Default Destructor.
| virtual void* mtsTask::RunInternal | ( | void * | argument | ) | [protected, pure virtual] |
The member function that is passed as 'start routine' argument for thread creation.
Referenced by mtsTaskFromCallback::DoCallback().
| void mtsTask::DoRunInternal | ( | void | ) | [protected] |
The main part of the Run loop that is the same for all derived classes. This should not be overloaded.
| virtual void mtsTask::StartupInternal | ( | void | ) | [protected, virtual] |
The member funtion that is executed as soon as the thread gets created. It does some housekeeping before the user code can be executed.
| virtual void mtsTask::CleanupInternal | ( | void | ) | [protected, virtual] |
The member function that is executed once the task terminates. This does some cleanup work.
| void mtsTask::Sleep | ( | double | timeInSeconds | ) | [protected] |
Delay the task by the specified amount. This is a protected member function because it should only be called from within the task. Otherwise, use osaSleep.
| mtsStateIndex::TimeTicksType mtsTask::GetTick | ( | void | ) | const [protected] |
Return the current tick count.
| virtual void mtsTask::SaveThreadStartData | ( | void * | data | ) | [protected, virtual] |
Save any 'user data' that was passed to the thread start routine.
| bool mtsTask::WaitForState | ( | mtsComponentState | desiredState, | |
| double | timeout | |||
| ) | [protected, virtual] |
Helper function to wait on a state change, with specified timeout in seconds.
Reimplemented from mtsComponent.
| virtual void mtsTask::Run | ( | void | ) | [pure virtual] |
Virtual method that gets overloaded to run the actual task.
| virtual void mtsTask::Startup | ( | void | ) | [inline, virtual] |
| virtual void mtsTask::Cleanup | ( | void | ) | [inline, virtual] |
| virtual void mtsTask::Configure | ( | const std::string & | CMN_UNUSED(filename) = "" |
) | [inline, virtual] |
| void mtsTask::SetInitializationDelay | ( | double | delay | ) |
Set the initialization delay. See InitializationDelay.
| void mtsTask::Create | ( | void | ) | [inline, virtual] |
Virtual method to create the components, e.g. for tasks create the required threads. For other components, place initialization code.
Reimplemented from mtsComponent.
Definition at line 203 of file mtsTask.h.
References mtsComponent::Create().
| virtual void mtsTask::Start | ( | void | ) | [pure virtual] |
Start or resume execution of the task.
Reimplemented from mtsComponent.
| virtual void mtsTask::Suspend | ( | void | ) | [pure virtual] |
Suspend the execution of the task.
| void mtsTask::Kill | ( | void | ) | [virtual] |
End the task
Reimplemented from mtsComponent.
| double mtsTask::GetAveragePeriod | ( | void | ) | const [inline] |
| const std::string mtsTask::GetDefaultStateTableName | ( | void | ) | const [inline] |
| mtsStateTable* mtsTask::GetStateTable | ( | const std::string & | stateTableName | ) | [inline] |
| mtsStateTable* mtsTask::GetDefaultStateTable | ( | void | ) | [inline] |
| bool mtsTask::AddStateTable | ( | mtsStateTable * | existingStateTable, | |
| bool | addInterfaceProvided = true | |||
| ) |
Add an existing state table to the list of known state tables in this task. This method will add a provided interface for the state table using the name "StateTable" + existingStateTable->GetName() unless the caller specifies that no interface should be created.
By default, all state tables added will advance at each call of the Run method. To avoid the automatic advance, use the method mtsStateTable::SetAutomaticAdvance(false).
| mtsInterfaceRequired* mtsTask::AddInterfaceRequired | ( | const std::string & | interfaceRequiredName, | |
| mtsRequiredType | required = MTS_REQUIRED | |||
| ) | [virtual] |
Add a required interface. This interface will later on be connected to another task and use the provided interface of the other task. The required interface created also contains a list of event handlers to be used as observers.
Reimplemented from mtsComponent.
| mtsInterfaceProvided* mtsTask::AddInterfaceProvided | ( | const std::string & | newInterfaceName, | |
| mtsInterfaceQueueingPolicy | queueingPolicy = MTS_COMPONENT_POLICY | |||
| ) | [virtual] |
Method to add a provided interface to the component. This method is virtual so that mtsTaskBase can redefine it and generate the appropriate type of interface, i.e. mtsInterfaceProvided as opposed to mtsInterfaceProvided for mtsComponent.
Reimplemented from mtsComponent.
| virtual bool mtsTask::WaitToStart | ( | double | timeout | ) | [virtual] |
Wait for task to start.
| timeout | The timeout in seconds |
| virtual bool mtsTask::WaitToTerminate | ( | double | timeout | ) | [virtual] |
Wait for task to finish (after issuing a task Kill).
| timeout | The timeout in seconds |
| virtual void mtsTask::WaitForWakeup | ( | void | ) | [inline, virtual] |
| virtual void mtsTask::Wakeup | ( | void | ) | [inline, virtual] |
| virtual bool mtsTask::IsPeriodic | ( | void | ) | const [inline, virtual] |
| virtual bool mtsTask::IsOverranPeriod | ( | void | ) | const [inline, virtual] |
Return true if task overran allocated period. Note that this is not restricted to mtsTaskPeriodic. For example, an mtsTaskFromCallback can overrun if a second callback occurs before the first is finished.
| virtual void mtsTask::ResetOverranPeriod | ( | void | ) | [inline, virtual] |
| void mtsTask::ToStream | ( | std::ostream & | outputStream | ) | const [virtual] |
Send a human readable description of the component.
Reimplemented from mtsComponent.
osaThread mtsTask::Thread [protected] |
double mtsTask::InitializationDelay [protected] |
Delay given for the task to start. During initialization the task thread will wait for the specified delay (set by default to 3 minutes in the constructor). Increasing this delay can be useful when using mtsTaskFromCallback if the callback might take more than 3 minutes to trigger the task's Run method.
osaMutex mtsTask::StateChange [protected] |
osaThreadSignal mtsTask::StateChangeSignal [protected] |
mtsStateTable mtsTask::StateTable [protected] |
bool mtsTask::OverranPeriod [protected] |
void* mtsTask::ThreadStartData [protected] |
void* mtsTask::ReturnValue [protected] |