OpenRTM-aist  1.2.1
ExecutionContextProfile.h
Go to the documentation of this file.
1 // -*- C++ -*-
19 #ifndef RTC_EXECUTIONCONTEXTPROFILE_H
20 #define RTC_EXECUTIONCONTEXTPROFILE_H
21 
22 #include <coil/Mutex.h>
23 #include <coil/Guard.h>
24 #include <coil/Properties.h>
25 #include <coil/TimeValue.h>
26 
27 #include <rtm/idl/RTCStub.h>
28 #include <rtm/SystemLogger.h>
29 
30 #ifdef WIN32
31 #pragma warning( disable : 4290 )
32 #endif
33 
34 namespace RTC_impl
35 {
57  {
59  public:
79  ExecutionContextProfile(RTC::ExecutionKind kind = RTC::PERIODIC);
80 
94  virtual ~ExecutionContextProfile(void);
95 
119  void setObjRef(RTC::ExecutionContextService_ptr ec_ptr);
120 
140  RTC::ExecutionContextService_ptr getObjRef(void) const;
141 
175  RTC::ReturnCode_t setRate(double rate);
176  RTC::ReturnCode_t setPeriod(double period);
177  RTC::ReturnCode_t setPeriod(coil::TimeValue period);
178 
199  double getRate(void) const;
200  coil::TimeValue getPeriod(void) const;
201 
224  const char* getKindString(RTC::ExecutionKind kind) const;
225  const char* getKindString() const
226  {
227  return getKindString(m_profile.kind);
228  }
229 
248  RTC::ReturnCode_t setKind(RTC::ExecutionKind kind);
249 
269  RTC::ExecutionKind getKind(void) const;
270 
288  RTC::ReturnCode_t setOwner(RTC::LightweightRTObject_ptr comp);
289 
306  const RTC::RTObject_ptr getOwner() const;
307 
339  RTC::ReturnCode_t addComponent(RTC::LightweightRTObject_ptr comp);
340 
371  RTC::ReturnCode_t removeComponent(RTC::LightweightRTObject_ptr comp);
372 
400  const RTC::RTCList& getComponentList() const;
401 
422  void setProperties(coil::Properties& props);
423 
443  const coil::Properties getProperties() const;
444 
467  RTC::ExecutionContextProfile* getProfile(void);
468 
486  const RTC::ExecutionContextProfile& getProfile(void) const;
487 
503  void lock() const;
504 
520  void unlock() const;
521 
522  private:
530  mutable RTC::Logger rtclog;
538  RTC::ExecutionContextProfile m_profile;
539 
547  mutable coil::Mutex m_profileMutex;
548 
556  coil::TimeValue m_period;
557 
565  RTC::ExecutionContextService_var m_ref;
566 
567  class find_participant
568  {
569  RTC::RTObject_var m_comp;
570  public:
571  find_participant(RTC::RTObject_ptr comp)
572  : m_comp(RTC::RTObject::_duplicate(comp)) {}
573  bool operator()(RTC::RTObject_ptr comp)
574  {
575  return m_comp->_is_equivalent(comp);
576  }
577  };
578  }; // class ExecutionContextProfile
579 }; // namespace RTC
580 
581 #ifdef WIN32
582 #pragma warning( default : 4290 )
583 #endif
584 
585 #endif // RTC_EXECUTIONCONTEXTPROFILE_H
RTC::ExecutionContextService_ptr getObjRef(void) const
Get the reference to the CORBA object.
RTC::ExecutionKind getKind(void) const
Get the ExecutionKind.
Mutex class.
Definition: Mutex.h:40
RT component logger class.
Definition: ExecutionContextProfile.h:34
const RTC::RTObject_ptr getOwner() const
Getting a reference of the owner component.
RTC::ReturnCode_t removeComponent(RTC::LightweightRTObject_ptr comp)
Remove the RT-Component from participant list.
TimeValue class.
Definition: TimeValue.h:40
const coil::Properties getProperties() const
Setting Properties.
double getRate(void) const
Get execution rate(Hz) of ExecutionContext.
ExecutionContextProfile(RTC::ExecutionKind kind=RTC::PERIODIC)
Default Constructor.
Guard template class.
const char * getKindString() const
Definition: ExecutionContextProfile.h:225
RTC::ExecutionContextProfile * getProfile(void)
Getting Profile.
Logger class.
Definition: SystemLogger.h:99
RTC::ReturnCode_t setOwner(RTC::LightweightRTObject_ptr comp)
Setting owner component of the execution context.
RTC::ReturnCode_t setKind(RTC::ExecutionKind kind)
Set the ExecutionKind.
Class represents a set of properties.
Definition: Properties.h:101
ExecutionContextProfile class.
Definition: ExecutionContextProfile.h:56
coil::TimeValue getPeriod(void) const
void setProperties(coil::Properties &props)
Setting Properties.
void setObjRef(RTC::ExecutionContextService_ptr ec_ptr)
Setting a CORBA object reference.
void lock() const
Getting a lock of RTC::ExecutionContextProfile.
Property list class (derived from Java Properties)
RTC::LightweightRTObject_ptr LightweightRTObject_ptr
Definition: ExecutionContextWorker.h:43
const RTC::RTCList & getComponentList() const
Getting participant RTC list.
virtual ~ExecutionContextProfile(void)
Destructor.
RTC::ReturnCode_t addComponent(RTC::LightweightRTObject_ptr comp)
Add an RT-component.
void unlock() const
Release a lock of the RTC::ExecutionContextProfile.
RTC::ReturnCode_t setRate(double rate)
Set execution rate(Hz) of ExecutionContext.
RTC::ReturnCode_t setPeriod(double period)