19#ifndef RTC_PERIODICEXECUTIONCONTEXT2_H
20#define RTC_PERIODICEXECUTIONCONTEXT2_H
23#include <condition_variable>
24#include <coil/Affinity.h>
31#define NUM_OF_LIFECYCLESTATE 4
56 :
public virtual POA_RTC::ExecutionContextService,
57 public virtual PortableServer::RefCountServantBase,
111 void init(coil::Properties& props)
override;
187 int close(
unsigned long flags)
override;
273 RTC::ReturnCode_t
stop()
override;
326 RTC::ReturnCode_t
set_rate(CORBA::Double rate)
override;
514 RTC::ReturnCode_t
add_component(RTC::LightweightRTObject_ptr comp)
override;
572 void getProperty(coil::Properties& prop,
const char* key, T& value)
574 if (prop.findNode(key) !=
nullptr)
577 if (coil::stringTo(tmp, prop[key].c_str()))
641 std::lock_guard<std::mutex> guard(
m_svcmutex);
ExecutionContext base class.
void PeriodicExecutionContextInit(RTC::Manager *manager)
Initialization function to register to ECFactory .
A base class for ExecutionContext.
Definition ExecutionContextBase.h:366
Logger class.
Definition SystemLogger.h:101
Manager class.
Definition Manager.h:91
PeriodicExecutionContext class.
Definition PeriodicExecutionContext.h:60
bool m_svc
The thread running flag of ExecutionContext .
Definition PeriodicExecutionContext.h:661
std::mutex m_svcmutex
Definition PeriodicExecutionContext.h:662
coil::CpuMask m_cpu
CPU affinity mask list.
Definition PeriodicExecutionContext.h:701
RTC::ReturnCode_t activate_component(RTC::LightweightRTObject_ptr comp) override
Activate an RT-component.
RTC::ReturnCode_t start() override
Start the ExecutionContext.
RTC::ReturnCode_t onReset(RTC_impl::RTObjectStateMachine *comp, long int count) override
onReset() template function
PeriodicExecutionContext()
Default Constructor.
RTC::ReturnCode_t onRemovedComponent(RTC::LightweightRTObject_ptr rtobj) override
onRemovedComponent() template function
bool threadRunning()
Definition PeriodicExecutionContext.h:639
RTC::ReturnCode_t add_component(RTC::LightweightRTObject_ptr comp) override
Add an RT-component.
~PeriodicExecutionContext() override
Destructor.
void init(coil::Properties &props) override
Initialize the ExecutionContext.
void getProperty(coil::Properties &prop, const char *key, T &value)
Definition PeriodicExecutionContext.h:572
RTC::ExecutionContextProfile * get_profile() override
Get the ExecutionContextProfile.
WorkerThreadCtrl m_workerthread
A condition variable for external triggered worker .
Definition PeriodicExecutionContext.h:686
CORBA::Boolean is_running() override
Check for ExecutionContext running state.
RTC::ReturnCode_t set_rate(CORBA::Double rate) override
Set execution rate(Hz) of ExecutionContext.
CORBA::Double get_rate() override
Get execution rate(Hz) of ExecutionContext.
RTC::LifeCycleState get_component_state(RTC::LightweightRTObject_ptr comp) override
Get RT-component's state.
RTC::ReturnCode_t stop() override
Stop the ExecutionContext.
RTC::ReturnCode_t onAddedComponent(RTC::LightweightRTObject_ptr rtobj) override
onAddedComponent() template function
RTC::ReturnCode_t deactivate_component(RTC::LightweightRTObject_ptr comp) override
Deactivate an RT-component.
RTC::ReturnCode_t onActivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onActivated() template function
RTC::ReturnCode_t remove_component(RTC::LightweightRTObject_ptr comp) override
Remove the RT-Component from participant list.
RTC::ReturnCode_t reset_component(RTC::LightweightRTObject_ptr comp) override
Reset the RT-component.
int close(unsigned long flags) override
Thread execution function for ExecutionContext.
RTC::ExecutionKind get_kind() override
Get the ExecutionKind.
RTC::Logger rtclog
Logger stream .
Definition PeriodicExecutionContext.h:652
bool m_nowait
Flag of ExecutionContext to run immediately (to run without waiting) .
Definition PeriodicExecutionContext.h:696
RTC::ReturnCode_t onWaitingDeactivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingDeactivated() template function
RTC::ReturnCode_t onStopping() override
onStopping() template function
RTC::ReturnCode_t onWaitingReset(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingReset() template function
RTC::ReturnCode_t onStarted() override
onStarted() template function
virtual void setCpuAffinity(coil::Properties &props)
setting CPU affinity from given properties
RTC::ReturnCode_t onWaitingActivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onWaitingActivated() template function
int svc() override
Thread execution function for ExecutionContext.
int open(void *args) override
Generate internal activity thread for ExecutionContext.
RTC::ReturnCode_t onDeactivated(RTC_impl::RTObjectStateMachine *comp, long int count) override
onDeactivated() template function
Definition RTObjectStateMachine.h:43
Definition MultilayerCompositeEC.h:28
Condition variable class for worker .
Definition PeriodicExecutionContext.h:672
std::mutex mutex_
Definition PeriodicExecutionContext.h:674
WorkerThreadCtrl()
Definition PeriodicExecutionContext.h:673
std::condition_variable cond_
Definition PeriodicExecutionContext.h:675
bool running_
Definition PeriodicExecutionContext.h:676