canbus
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
canbus::Task Class Reference

#include <Task.hpp>

Inheritance diagram for canbus::Task:

Classes

struct  Mapping
 
struct  MappingCacheItem
 

Public Member Functions

 Task (std::string const &name="canbus::Task")
 
 ~Task ()
 
bool configureHook ()
 
bool startHook ()
 
void updateHook ()
 
void stopHook ()
 
void cleanupHook ()
 

Protected Types

typedef std::vector< MappingMappings
 
typedef std::map< uint32_t, MappingCacheItemMappingCache
 

Protected Member Functions

virtual bool watch (std::string const &name, int id, int mask)
 
virtual bool unwatch (std::string const &name)
 

Protected Attributes

canbus::Driver * m_driver
 
canbus::Statistics m_stats
 
Mappings m_mappings
 
MappingCache m_mapping_cache
 
base::Time m_last_can_check_time
 
base::Time m_last_stats_time
 
base::Time m_can_check_interval
 
base::Time m_stats_interval
 

Friends

class TaskBase
 

Member Typedef Documentation

typedef std::map<uint32_t, MappingCacheItem> canbus::Task::MappingCache
protected
typedef std::vector<Mapping> canbus::Task::Mappings
protected

Constructor & Destructor Documentation

Task::Task ( std::string const &  name = "canbus::Task")
Task::~Task ( )

Member Function Documentation

void Task::cleanupHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to PreOperational, requiring the call to configureHook() before calling start() again.

bool Task::configureHook ( )

This hook is called by Orocos when the state machine transitions from PreOperational to Stopped. If it returns false, then the component will stay in PreOperational. Otherwise, it goes into Stopped.

It is meaningful only if the #needs_configuration has been specified in the task context definition with (for example):

task_context "TaskName" do needs_configuration ... end

bool Task::startHook ( )

This hook is called by Orocos when the state machine transitions from Stopped to Running. If it returns false, then the component will stay in Stopped. Otherwise, it goes into Running and updateHook() will be called.

void Task::stopHook ( )

This hook is called by Orocos when the component is in the RunTimeError state, at each activity step. See the discussion in updateHook() about triggering options.

Call recovered() to go back in the Runtime state. This hook is called by Orocos when the state machine transitions from Running to Stopped after stop() has been called.

bool Task::unwatch ( std::string const &  name)
protectedvirtual
void Task::updateHook ( )

This hook is called by Orocos when the component is in the Running state, at each activity step. Here, the activity gives the "ticks" when the hook should be called.

The error(), exception() and fatal() calls, when called in this hook, allow to get into the associated RunTimeError, Exception and FatalError states.

In the first case, updateHook() is still called, and recover() allows you to go back into the Running state. In the second case, the errorHook() will be called instead of updateHook(). In Exception, the component is stopped and recover() needs to be called before starting it again. Finally, FatalError cannot be recovered.

bool Task::watch ( std::string const &  name,
int  id,
int  mask 
)
protectedvirtual

Friends And Related Function Documentation

friend class TaskBase
friend

Member Data Documentation

base::Time canbus::Task::m_can_check_interval
protected
canbus::Driver* canbus::Task::m_driver
protected
base::Time canbus::Task::m_last_can_check_time
protected
base::Time canbus::Task::m_last_stats_time
protected
MappingCache canbus::Task::m_mapping_cache
protected
Mappings canbus::Task::m_mappings
protected
canbus::Statistics canbus::Task::m_stats
protected
base::Time canbus::Task::m_stats_interval
protected

The documentation for this class was generated from the following files: