ExecutionContext.cpp
Go to the documentation of this file.
00001 
00018 #include <rtm/ExecutionContext.h>
00019 #include <rtm/CORBA_SeqUtil.h>
00020 
00021 namespace RTC
00022 {
00023   
00024   ExecutionContextBase::ExecutionContextBase(RTObject_ptr owner)
00025     : rtclog("exec_cxt"), m_running(false)
00026   {
00027     m_profile.kind = OTHER;
00028     m_profile.rate = 0.0;
00029     m_profile.owner = owner;
00030     m_profile.participants.length(0);
00031   }
00032 
00040   CORBA::Boolean ExecutionContextBase::is_running()
00041   {
00042     RTC_TRACE(("is_running()"));
00043     return m_running;
00044   }
00045   
00046 
00054   ReturnCode_t ExecutionContextBase::start()
00055   {
00056     RTC_TRACE(("start()"));
00057     return RTC::RTC_OK;
00058   }
00059   
00060 
00068   ReturnCode_t ExecutionContextBase::stop()
00069   {
00070     RTC_TRACE(("stop()"));
00071     return RTC::RTC_OK;
00072   }
00073   
00074   
00082   CORBA::Double ExecutionContextBase::get_rate()
00083   {
00084     RTC_TRACE(("get_rate()"));
00085     return m_profile.rate;
00086   }
00087   
00088   
00096   ReturnCode_t ExecutionContextBase::set_rate(CORBA::Double rate)
00097   {
00098     RTC_TRACE(("set_rate(%f)", rate));
00099     if (rate > 0.0)
00100       {
00101         m_profile.rate = rate;
00102         return RTC::RTC_OK;
00103       }
00104     return RTC::BAD_PARAMETER;
00105   }
00106   
00107 
00115   ReturnCode_t
00116   ExecutionContextBase::activate_component(LightweightRTObject_ptr comp)
00117   {
00118     RTC_TRACE(("activate_component()"));
00119     return RTC::RTC_OK;
00120   }
00121   
00122 
00130   ReturnCode_t
00131   ExecutionContextBase::deactivate_component(LightweightRTObject_ptr comp)
00132   {
00133     RTC_TRACE(("deactivate_component()"));
00134     return RTC::RTC_OK;
00135   }
00136   
00137 
00145   ReturnCode_t
00146   ExecutionContextBase::reset_component(LightweightRTObject_ptr comp)
00147   {
00148     RTC_TRACE(("reset_component()"));
00149     return RTC::RTC_OK;
00150   }
00151   
00152   
00160   LifeCycleState
00161   ExecutionContextBase::get_component_state(LightweightRTObject_ptr comp)
00162   {
00163     RTC_TRACE(("get_component_state()"));
00164     return RTC::INACTIVE_STATE;
00165   }
00166   
00167   
00175   ExecutionKind ExecutionContextBase::get_kind()
00176   {
00177     RTC_TRACE(("get_kind()"));
00178     return m_profile.kind;
00179   }
00180   
00181 
00189   ReturnCode_t
00190   ExecutionContextBase::add_component(LightweightRTObject_ptr comp)
00191   {
00192     RTC_TRACE(("add_component()"));
00193     if (!CORBA::is_nil(comp))
00194       {
00195         CORBA_SeqUtil::push_back(m_profile.participants,
00196                                  RTC::RTObject::_narrow(comp));
00197         return RTC::RTC_OK;
00198       }
00199     return RTC::BAD_PARAMETER;
00200   }
00201   
00202   
00210   ReturnCode_t
00211   ExecutionContextBase::remove_component(LightweightRTObject_ptr comp)
00212   {
00213     RTC_TRACE(("remove_component()"));
00214     CORBA::ULong index;
00215     index = CORBA_SeqUtil::find(m_profile.participants,
00216                 find_objref<RTObject_ptr>(RTC::RTObject::_narrow(comp)));
00217                                 
00218     if (index < 0) return RTC::BAD_PARAMETER;
00219     CORBA_SeqUtil::erase(m_profile.participants, index);
00220     return RTC::RTC_OK;
00221   }
00222 
00223 
00224   //============================================================
00225   // ExecutionContextAdmin interfaces
00226   //============================================================
00234   ExecutionContextProfile* ExecutionContextBase::get_profile()
00235   {
00236     RTC_TRACE(("get_profile()"));
00237     ExecutionContextProfile_var p;
00238     p = new ExecutionContextProfile(m_profile);
00239     return p._retn();
00240   }
00241   
00242   
00243   
00244 }; // namespace RTC


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15