29 "implementation_id",
"PeriodicECSharedComposite",
30 "type_name",
"PeriodicECSharedComposite",
31 "description",
"PeriodicECSharedComposite",
33 "vendor",
"jp.go.aist",
34 "category",
"composite.PeriodicECShared",
35 "activity_type",
"DataFlowComponent",
38 "lang_type",
"compile",
40 "conf.default.members",
"",
41 "conf.default.exported_ports",
"",
56 rtclog(
"PeriodicECOrganization"),
58 m_ec(::
RTC::ExecutionContext::_nil())
82 throw (CORBA::SystemException,
83 InvalidParameter, NotAvailable, InternalError)
89 for (::CORBA::ULong i(0), len(sdo_list.length()); i < len; ++i)
91 const SDO_var sdo(sdo_list[i]);
92 ::OpenRTM::DataFlowComponent_var dfc;
94 if (!
sdoToDFC(sdo.in(), dfc.out())) {
continue; }
96 ::OpenRTM::DataFlowComponent_ptr dfc_ptr(dfc.object());
97 if (!
sdoToDFC(sdo.in(), dfc_ptr)) {
continue; }
98 #endif // ORB_IS_RTORB 108 CORBA::Boolean result;
122 throw (CORBA::SystemException,
123 InvalidParameter, NotAvailable, InternalError)
130 for (::CORBA::ULong i(0), len(sdo_list.length()); i < len; ++i)
133 const SDO_var sdo = sdo_list[i];
134 ::OpenRTM::DataFlowComponent_var dfc;
135 if (!
sdoToDFC(sdo.in(), dfc.out())) {
continue; }
136 #else // ORB_IS_RTORB 137 const SDO_var sdo = sdo_list[i].object();
139 ::OpenRTM::DataFlowComponent_var dfc;
140 ::OpenRTM::DataFlowComponent_ptr dfc_ptr(dfc);
142 if (!
sdoToDFC(sdo.in(), dfc_ptr)) {
continue; }
143 #endif // ORB_IS_RTORB 155 CORBA::Boolean result;
169 throw (CORBA::SystemException,
170 InvalidParameter, NotAvailable, InternalError)
172 RTC_DEBUG((
"remove_member(id = %s)",
id));
176 if (strncmp(
id, member.
profile_->instance_name, strlen(
id)))
192 CORBA::Boolean result;
233 ::OpenRTM::DataFlowComponent_ptr& dfc)
235 if (::CORBA::is_nil(sdo))
return false;
238 dfc = ::OpenRTM::DataFlowComponent::_narrow(sdo);
239 if (::CORBA::is_nil(dfc))
return false;
253 ::RTC::ExecutionContextList_var ecs(member.
eclist_);
254 for (::CORBA::ULong i(0), len(ecs->length()); i < len; ++i)
271 ::RTC::ExecutionContextList_var ecs(member.
eclist_);
272 for (::CORBA::ULong i(0), len(ecs->length()); i < len; ++i)
290 Configuration_var conf(member.
config_);
291 if (::CORBA::is_nil(conf))
return;
307 if (::CORBA::is_nil(member.
config_)) {
return; }
322 if (::CORBA::is_nil(
m_ec))
325 if (ecs->length() > 0)
337 OrganizationList_var orglist = member.
rtobj_->get_organizations();
338 for (CORBA::ULong i(0); i < orglist->length(); ++i)
340 SDOList_var sdos = orglist[i]->get_members();
341 for (CORBA::ULong
j(0);
j < sdos->length(); ++
j)
344 ::OpenRTM::DataFlowComponent_var dfc;
345 if (!
sdoToDFC(sdos[
j].in(), dfc.out())) {
continue; }
346 #else // ORB_IS_RTORB 347 ::OpenRTM::DataFlowComponent_var dfc;
348 ::OpenRTM::DataFlowComponent_ptr dfc_ptr(dfc);
349 if (!
sdoToDFC(sdos[
j].in(), dfc_ptr)) {
continue; }
350 #endif // ORB_IS_RTORB 351 m_ec->add_component(dfc.in());
367 if (::CORBA::is_nil(
m_ec))
370 if (ecs->length() == 0)
379 OrganizationList_var orglist = member.
rtobj_->get_organizations();
380 for (CORBA::ULong i(0); i < orglist->length(); ++i)
382 SDOList_var sdos = orglist[i]->get_members();
383 for (CORBA::ULong
j(0);
j < sdos->length(); ++
j)
386 ::OpenRTM::DataFlowComponent_var dfc;
387 if (!
sdoToDFC(sdos[
j].in(), dfc.out())) {
continue; }
388 #else // ORB_IS_RTORB 389 ::OpenRTM::DataFlowComponent_var dfc;
390 ::OpenRTM::DataFlowComponent_ptr dfc_ptr(dfc);
391 if (!
sdoToDFC(sdos[
j].in(), dfc_ptr)) {
continue; }
392 #endif // ORB_IS_RTORB 393 m_ec->remove_component(dfc.in());
410 if (portlist.size() == 0) {
return; }
415 #else // ORB_IS_RTORB 417 #endif // ORB_IS_RTORB 420 for (::CORBA::ULong i(0), len(plist.length()); i < len; ++i)
422 std::string port_name(plist[i].name);
428 std::vector<std::string>::iterator pos =
429 std::find(portlist.begin(), portlist.end(), port_name);
430 if (pos == portlist.end())
444 RTC_DEBUG((
"Port %s was delegated.", port_name.c_str()));
460 if (portlist.size() == 0) {
return; }
465 #else // ORB_IS_RTORB 467 #endif // ORB_IS_RTORB 470 for (::CORBA::ULong i(0), len(plist.length()); i < len; ++i)
473 std::string port_name(plist[i].name);
479 std::vector<std::string>::iterator pos =
480 std::find(portlist.begin(), portlist.end(), port_name);
481 if (pos == portlist.end())
496 RTC_DEBUG((
"Port %s was deleted.", port_name.c_str()));
522 std::vector<std::string>& oldPorts(
m_expPorts);
523 std::sort(oldPorts.begin(),oldPorts.end());
524 std::vector<std::string>
526 std::sort(newPorts.begin(),newPorts.end());
528 std::vector<std::string> removedPorts;
529 std::vector<std::string> createdPorts;
531 set_difference(oldPorts.begin(), oldPorts.end(),
532 newPorts.begin(), newPorts.end(),
533 std::back_inserter(removedPorts));
534 set_difference(newPorts.begin(), newPorts.end(),
535 oldPorts.begin(), oldPorts.end(),
536 std::back_inserter(createdPorts));
573 m_org->updateDelegatedPorts();
588 m_org->updateDelegatedPorts();
604 m_ref = this->_this();
626 RTC_TRACE((
"~PeriodicECSharedComposite()"));
641 std::string active_set;
657 ::SDOPackage::SDOList sdos;
658 for (
int i(0), len(
m_members.size()); i < len; ++i)
665 ::SDOPackage::SDO_var sdo;
667 sdo = ::SDOPackage::SDO::_duplicate(rtc->
getObjRef());
668 if (::CORBA::is_nil(sdo))
continue;
671 #else // ORB_IS_RTORB 672 sdo = ::SDOPackage::SDO::_duplicate((rtc->
getObjRef()).in());
673 if (::CORBA::is_nil(sdo))
continue;
676 #endif // ORB_IS_RTORB 698 RTC_TRACE((
"onActivated(%d)", exec_handle));
702 for (::CORBA::ULong i(0), len(sdos->length()); i < len; ++i)
704 ::RTC::RTObject_var rtc(::RTC::RTObject::_narrow(sdos[i]));
705 ecs[0]->activate_component(rtc.in());
707 RTC_DEBUG((
"%d member RTC%s activated.", sdos->length(),
708 sdos->length() == 1 ?
" was" :
"s were"));
721 RTC_TRACE((
"onDeactivated(%d)", exec_handle));
725 for (::CORBA::ULong i(0), len(sdos->length()); i < len; ++i)
727 ::RTC::RTObject_var rtc(::RTC::RTObject::_narrow(sdos[i]));
728 ecs[0]->deactivate_component(rtc.in());
746 for (::CORBA::ULong i(0), len(sdos->length()); i < len; ++i)
748 ::RTC::RTObject_var rtc(::RTC::RTObject::_narrow(sdos[i]));
749 ecs[0]->reset_component(rtc.in());
777 RTC::Create<RTC::PeriodicECSharedComposite>,
778 RTC::Delete<RTC::PeriodicECSharedComposite>);
virtual ReturnCode_t onActivated(RTC::UniqueId exec_handle)
Callback function to activate.
virtual ReturnCode_t onReset(RTC::UniqueId exec_handle)
Callback function to reset.
void removeAllMembers(void)
Remove a member of Organization.
RTC::ComponentProfile_var profile_
virtual SDOList * get_members()
[CORBA interface] Get the member list of the Organization
::RTC::ExecutionContext_var m_ec
ExecutionContext Object reference.
SDOPackage::PeriodicECOrganization * m_org
Reference of Organization.
virtual void operator()(const coil::Properties &config_set)
Virtual Callback function.
RTObject_impl * getComponent(const char *instance_name)
Get RT-Component's pointer.
::RTC::RTObject_impl * m_rtobj
RT Object.
std::vector< std::string > m_members
Components.
void stopOwnedEC(Member &member)
Stop Owned ExecutionContexts.
virtual ~PeriodicECSharedComposite(void)
Destructor.
ConfigurationSetListener class.
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
bool removePort(PortBase &port)
[local interface] Unregister Port
setCallback(::SDOPackage::PeriodicECOrganization *org)
bool sdoToDFC(const SDO_ptr sdo,::OpenRTM::DataFlowComponent_ptr &dfc)
Conversion from SDO to DFC.
coil::Properties & getProperties()
[local interface] Get RTC property
static Manager & instance()
Get instance of the manager.
std::vector< Member > m_rtcMembers
Member list.
virtual ReturnCode_t onFinalize(void)
[ComponentAction CORBA interface] Finalize RTC
RTComponent manager class.
#define RTC_FATAL(fmt)
Error log output macro.
#define RTC_PARANOID(fmt)
Paranoid level log output macro.
SDOPackage::OrganizationList m_sdoOwnedOrganizations
SDO owned organization list.
Periodic Execution Context Shared Composite Component class.
void update(void)
Update the values of configuration parameters (Active configuration set)
::SDOPackage::PeriodicECOrganization * m_org
ExecutionContextHandle_t UniqueId
virtual void operator()(const coil::Properties &config_set)
Virtual Callback function.
#define RTC_DEBUG(fmt)
Debug level log output macro.
virtual CORBA::Boolean set_members(const SDOList &sdos)
[CORBA interface] Set SDO
std::string flatten(vstring sv)
Create CSV file from the given string list.
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
Setup for configuration parameters.
void setOnSetConfigurationSet(OnSetConfigurationSetCallback *cb)
def j(str, encoding="cp932")
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
std::string m_pId
The identifier of the Organization.
RTC::ExecutionContextList_var eclist_
Organization_var m_objref
OpenRTM::DataFlowComponent_var m_ref
Reference of object.
Organization implementation class.
virtual CORBA::Boolean remove_member(const char *id)
[CORBA interface] Remove member SDO from Organization
addCallback(::SDOPackage::PeriodicECOrganization *org)
Organization_ptr getObjRef()
ConfigAdmin m_configsets
Configuration Administrator Object.
void updateExportedPortsList(void)
PortsList is updated.
virtual ::CORBA::Boolean remove_member(const char *id)
[CORBA interface] Remove a member of Organization
void addPort(Member &member, PortList &portlist)
Delegate given RTC's ports to the Composite.
void startOwnedEC(Member &member)
Start Owned ExecutionContexts.
void removeParticipantFromEC(Member &member)
Remove participant DFC from CompositeRTC's ExecutionContext.
virtual ExecutionContextList * get_owned_contexts()
[CORBA interface] Get ExecutionContextList.
bool stringToStrVec(std::vector< std::string > &v, const char *is)
PeriodicECOrganization class.
Class represents a set of properties.
virtual ::CORBA::Boolean set_members(const SDOList &sdos)
[CORBA interface] Set Organization member
virtual ReturnCode_t onDeactivated(RTC::UniqueId exec_handle)
Callback function to deactivate.
SDOPackage::Configuration_var config_
::SDOPackage::PeriodicECOrganization * m_org
bool addPort(PortBase &port)
[local interface] Register Port
void removeOrganizationFromTarget(Member &member)
Remove Organization object from a target DFC.
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
static const char * periodicecsharedcomposite_spec[]
std::vector< std::string > PortList
virtual ~PeriodicECOrganization(void)
Destructor.
void setOnAddConfigurationSet(OnAddConfigurationAddCallback *cb)
coil::Properties m_properties
Alive Status Flag.
PortList m_expPorts
Port List.
void removePort(Member &member, PortList &portlist)
Remove delegated participatns's ports from the composite.
RTObject_var m_objref
Object reference.
void PeriodicECSharedCompositeInit(RTC::Manager *manager)
std::vector< Member >::iterator MemIt
bool haveConfig(const char *config_id)
Check the existence of configuration set.
std::vector< PortProfile * > PortProfileList
bool registerFactory(coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
Register RT-Component Factory.
#define RTC_VERBOSE(fmt)
Verbose level log output macro.
void addParticipantToEC(Member &member)
Set CompositeRTC's ExecutionContext to the given DFC.
virtual ReturnCode_t onInitialize(void)
Initialization.
virtual ::CORBA::Boolean add_members(const SDOList &sdo_list)
[CORBA interface] Add Organization member
void addOrganizationToTarget(Member &member)
Set Organization object to target DFC.
void updateDelegatedPorts(void)
Update/Remove a member of Organization.
RTObject_ptr getObjRef() const
[local interface] Get the object reference
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
std::vector< RTObject_impl * > getComponents()
Get all RT-Components registered in the Manager.
virtual CORBA::Boolean add_members(const SDOList &sdo_list)
[CORBA interface] Add the member SDOs
PeriodicECOrganization(::RTC::RTObject_impl *rtobj)
Constructor.