ExecutionContext.cpp
Go to the documentation of this file.
1 
18 #include <rtm/ExecutionContext.h>
19 #include <rtm/CORBA_SeqUtil.h>
20 
21 namespace RTC
22 {
23 
24  ExecutionContextBase::ExecutionContextBase(RTObject_ptr owner)
25  : rtclog("exec_cxt"), m_running(false)
26  {
27  m_profile.kind = OTHER;
28  m_profile.rate = 0.0;
29  m_profile.owner = owner;
30  m_profile.participants.length(0);
31  }
32 
40  CORBA::Boolean ExecutionContextBase::is_running()
41  {
42  RTC_TRACE(("is_running()"));
43  return m_running;
44  }
45 
46 
54  ReturnCode_t ExecutionContextBase::start()
55  {
56  RTC_TRACE(("start()"));
57  return RTC::RTC_OK;
58  }
59 
60 
68  ReturnCode_t ExecutionContextBase::stop()
69  {
70  RTC_TRACE(("stop()"));
71  return RTC::RTC_OK;
72  }
73 
74 
82  CORBA::Double ExecutionContextBase::get_rate()
83  {
84  RTC_TRACE(("get_rate()"));
85  return m_profile.rate;
86  }
87 
88 
96  ReturnCode_t ExecutionContextBase::set_rate(CORBA::Double rate)
97  {
98  RTC_TRACE(("set_rate(%f)", rate));
99  if (rate > 0.0)
100  {
101  m_profile.rate = rate;
102  return RTC::RTC_OK;
103  }
104  return RTC::BAD_PARAMETER;
105  }
106 
107 
116  ExecutionContextBase::activate_component(LightweightRTObject_ptr comp)
117  {
118  RTC_TRACE(("activate_component()"));
119  return RTC::RTC_OK;
120  }
121 
122 
131  ExecutionContextBase::deactivate_component(LightweightRTObject_ptr comp)
132  {
133  RTC_TRACE(("deactivate_component()"));
134  return RTC::RTC_OK;
135  }
136 
137 
146  ExecutionContextBase::reset_component(LightweightRTObject_ptr comp)
147  {
148  RTC_TRACE(("reset_component()"));
149  return RTC::RTC_OK;
150  }
151 
152 
161  ExecutionContextBase::get_component_state(LightweightRTObject_ptr comp)
162  {
163  RTC_TRACE(("get_component_state()"));
164  return RTC::INACTIVE_STATE;
165  }
166 
167 
175  ExecutionKind ExecutionContextBase::get_kind()
176  {
177  RTC_TRACE(("get_kind()"));
178  return m_profile.kind;
179  }
180 
181 
190  ExecutionContextBase::add_component(LightweightRTObject_ptr comp)
191  {
192  RTC_TRACE(("add_component()"));
193  if (!CORBA::is_nil(comp))
194  {
195  CORBA_SeqUtil::push_back(m_profile.participants,
196  RTC::RTObject::_narrow(comp));
197  return RTC::RTC_OK;
198  }
199  return RTC::BAD_PARAMETER;
200  }
201 
202 
211  ExecutionContextBase::remove_component(LightweightRTObject_ptr comp)
212  {
213  RTC_TRACE(("remove_component()"));
214  CORBA::ULong index;
215  index = CORBA_SeqUtil::find(m_profile.participants,
216  find_objref<RTObject_ptr>(RTC::RTObject::_narrow(comp)));
217 
218  if (index < 0) return RTC::BAD_PARAMETER;
219  CORBA_SeqUtil::erase(m_profile.participants, index);
220  return RTC::RTC_OK;
221  }
222 
223 
224  //============================================================
225  // ExecutionContextAdmin interfaces
226  //============================================================
234  ExecutionContextProfile* ExecutionContextBase::get_profile()
235  {
236  RTC_TRACE(("get_profile()"));
237  ExecutionContextProfile_var p;
238  p = new ExecutionContextProfile(m_profile);
239  return p._retn();
240  }
241 
242 
243 
244 }; // namespace RTC
void erase(CorbaSequence &seq, CORBA::ULong index)
Erase the element of the specified index.
RT-Component.
ReturnCode_t
Definition: doil.h:53
ExecutionKind
Definition: IRTC.h:48
#define RTC_TRACE(fmt)
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
list index
Definition: rtimages.py:10
CORBA sequence utility template functions.
LifeCycleState
Definition: IRTC.h:40
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
RTC::Local::ExecutionContextProfile ExecutionContextProfile


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Feb 28 2022 23:00:43