25 from omniORB
import CORBA
31 periodicecsharedcomposite_spec = [
"implementation_id",
"PeriodicECSharedComposite",
32 "type_name",
"PeriodicECSharedComposite",
33 "description",
"PeriodicECSharedComposite",
35 "vendor",
"jp.go.aist",
36 "category",
"composite.PeriodicECShared",
37 "activity_type",
"DataFlowComponent",
40 "lang_type",
"script",
42 "conf.default.members",
"",
43 "conf.default.exported_ports",
"",
49 OpenRTM_aist.eraseBlank(str)
50 v[0] = str[0].
split(
",")
60 self._org.updateDelegatedPorts()
70 self._org.updateDelegatedPorts()
109 OpenRTM_aist.Organization_impl.__init__(self,rtobj.getObjRef())
113 self.
_rtcout = OpenRTM_aist.Manager.instance().getLogbuf(
"rtobject.PeriodicECOrganization")
142 self._rtcout.RTC_DEBUG(
"add_members()")
148 member = self.
Member(dfc[0])
153 self._rtcMembers.append(member)
155 result = OpenRTM_aist.Organization_impl.add_members(self,sdo_list)
185 self._rtcout.RTC_DEBUG(
"set_members()")
195 member = self.
Member(dfc[0])
200 self._rtcMembers.append(member)
202 result = OpenRTM_aist.Organization_impl.set_members(self, sdo_list)
230 self._rtcout.RTC_DEBUG(
"remove_member(id = %s)", id)
233 if str(id) != str(member._profile.instance_name):
236 self._rtobj.getProperties().setProperty(
"conf.default.exported_ports", OpenRTM_aist.flatten(self.
_expPorts))
240 rm_rtc.append(member)
243 self._rtcMembers.remove(m)
245 result = OpenRTM_aist.Organization_impl.remove_member(self, id)
257 self._rtcout.RTC_DEBUG(
"removeAllMembers()")
264 OpenRTM_aist.Organization_impl.remove_member(self, member._profile.instance_name)
280 if CORBA.is_nil(sdo):
283 dfc[0] = sdo._narrow(OpenRTM.DataFlowComponent)
284 if CORBA.is_nil(dfc[0]):
330 conf = member._config
331 if CORBA.is_nil(conf):
334 conf.add_organization(self.
_objref)
348 if CORBA.is_nil(member._config):
352 ret = member._config.remove_organization(self.
_pId)
365 if CORBA.is_nil(self.
_ec)
or self.
_ec is None:
366 ecs = self._rtobj.get_owned_contexts()
372 ret = self._ec.add_component(member._rtobj)
374 orglist = member._rtobj.get_organizations()
376 sdos = org.get_members()
381 self._ec.add_component(dfc[0])
394 if CORBA.is_nil(self.
_ec)
or self.
_ec is None:
395 ecs = self._rtobj.get_owned_contexts()
399 self._rtcout.RTC_FATAL(
"no owned EC")
401 self._ec.remove_component(member._rtobj)
403 orglist = member._rtobj.get_organizations()
406 sdos = org.get_members()
411 self._ec.remove_component(dfc[0])
445 self._rtcout.RTC_TRACE(
"addPort(%s)", OpenRTM_aist.flatten(portlist))
446 if len(portlist) == 0:
449 comp_name = member._profile.instance_name
450 plist = member._profile.port_profiles
455 port_name = prof.name
457 self._rtcout.RTC_DEBUG(
"port_name: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
458 if not port_name
in portlist:
459 self._rtcout.RTC_DEBUG(
"Not found: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
462 self._rtcout.RTC_DEBUG(
"Found: %s is in %s", (port_name,OpenRTM_aist.flatten(portlist)))
463 self._rtobj.addPort(prof.port_ref)
464 self._rtcout.RTC_DEBUG(
"Port %s was delegated.", port_name)
478 self._rtcout.RTC_DEBUG(
"removePort()")
479 if len(portlist) == 0:
482 comp_name = member._profile.instance_name
483 plist = member._profile.port_profiles
488 port_name = prof.name
490 self._rtcout.RTC_DEBUG(
"port_name: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
491 if not port_name
in portlist:
492 self._rtcout.RTC_DEBUG(
"Not found: %s is in %s?", (port_name,OpenRTM_aist.flatten(portlist)))
495 self._rtcout.RTC_DEBUG(
"Found: %s is in %s", (port_name,OpenRTM_aist.flatten(portlist)))
496 self._rtobj.removePort(prof.port_ref)
497 portlist.remove(port_name)
498 self._rtcout.RTC_DEBUG(
"Port %s was deleted.", port_name)
511 plist = self._rtobj.getProperties().getProperty(
"conf.default.exported_ports")
514 OpenRTM_aist.eraseBlank(p)
528 ports = self._rtobj.getProperties().getProperty(
"conf.default.exported_ports")
529 newPorts = ports.split(
",")
532 removedPorts = list(set(oldPorts).difference(set(newPorts)))
533 createdPorts = list(set(newPorts).difference(set(oldPorts)))
535 self._rtcout.RTC_VERBOSE(
"old ports: %s", OpenRTM_aist.flatten(oldPorts))
536 self._rtcout.RTC_VERBOSE(
"new ports: %s", OpenRTM_aist.flatten(newPorts))
537 self._rtcout.RTC_VERBOSE(
"remove ports: %s", OpenRTM_aist.flatten(removedPorts))
538 self._rtcout.RTC_VERBOSE(
"add ports: %s", OpenRTM_aist.flatten(createdPorts))
542 self.
addPort(member, createdPorts)
638 OpenRTM_aist.RTObject_impl.__init__(self,manager)
643 self._org.getObjRef())
647 self.
_rtcout = OpenRTM_aist.Manager.instance().getLogbuf(
"rtobject.periodic_ec_shared")
648 self._configsets.addConfigurationSetListener(\
649 OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET,
652 self._configsets.addConfigurationSetListener(\
653 OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET,
673 self._rtcout.RTC_TRACE(
"destructor of PeriodicECSharedComposite")
693 self._rtcout.RTC_TRACE(
"onInitialize()")
695 active_set = self._properties.getProperty(
"configuration.active_config",
697 if self._configsets.haveConfig(active_set):
698 self._configsets.update(active_set)
700 self._configsets.update(
"default")
702 mgr = OpenRTM_aist.Manager.instance()
708 rtc = mgr.getComponent(member)
711 print "no RTC found: ", member
714 sdo = rtc.getObjRef()
715 if CORBA.is_nil(sdo):
721 self._org.set_members(sdos)
723 self._rtcout.RTC_ERROR(OpenRTM_aist.Logger.print_exception())
760 self._rtcout.RTC_TRACE(
"onActivated(%d)", exec_handle)
762 sdos = self._org.get_members()
765 rtc = sdo._narrow(RTC.RTObject)
766 ecs[0].activate_component(rtc)
777 self._rtcout.RTC_DEBUG(
"%d member RTC%s activated.", (len_, str_))
814 self._rtcout.RTC_TRACE(
"onDeactivated(%d)", exec_handle)
816 sdos = self._org.get_members()
819 rtc = sdo._narrow(RTC.RTObject)
820 ecs[0].deactivate_component(rtc)
856 self._rtcout.RTC_TRACE(
"onReset(%d)", exec_handle)
858 sdos = self._org.get_members()
861 rtc = sdo._narrow(RTC.RTObject)
862 ecs[0].reset_component(rtc)
892 self._rtcout.RTC_TRACE(
"onFinalize()")
893 self._org.removeAllMembers()
894 self._rtcout.RTC_PARANOID(
"onFinalize() done")
901 manager.registerFactory(profile,
def addPort(self, member, portlist)
Set CompositeRTC's ExecutionContext to the given DFCvoid setCompositeECToTarget(::OpenRTM::DataFlowCo...
def removeParticipantFromEC(self, member)
Remove participant DFC from CompositeRTC's ExecutionContextvoid PeriodicECOrganization::removePartici...
def split(input, delimiter)
Split string by delimiter.
def removeAllMembers(self)
Remove a member of Organization.
def push_back(seq, elem)
Push the new element back to the CORBA sequence.
def __init__(self, rtobj)
Constructor.
def updateExportedPortsList(self)
PortsList is updated.
def bindParameter(self, param_name, var, def_val, trans=None)
template <typename vartype>=""> bool bindParameter(const char* param_name, VarType& var...
def add_members(self, sdo_list)
[CORBA interface] Add Organization member
def onFinalize(self)
[ComponentAction CORBA interface] Finalize RTC
The Properties class represents a persistent set of properties.
def stopOwnedEC(self, member)
Stop Owned ExecutionContextsvoid stopOwnedEC(Member& member);.
def updateDelegatedPorts(self)
Update/Remove a member of Organization.
def __init__(self, rtobj)
def onDeactivated(self, exec_handle)
Callback function to deactivate.
def __init__(self, manager)
Constructor.
def onInitialize(self)
Initialization.
def onActivated(self, exec_handle)
Callback function to activate.
def removePort(self, member, portlist)
Remove delegated participatns's ports from the compositevoid removePort(Member& member, PortList& portlist)
def remove_member(self, id)
[CORBA interface] Remove a member of Organization
def startOwnedEC(self, member)
Start Owned ExecutionContexts.
def PeriodicECSharedCompositeInit(manager)
def addOrganizationToTarget(self, member)
Set Organization object to target DFCvoid addOrganizationToTarget(Member& member);.
def set_members(self, sdo_list)
[CORBA interface] Set Organization member
PeriodicECSharedComposite class.
def __del__(self)
Destructor.
Organization implementation class.
def __call__(self, config_set)
def get_owned_contexts(self)
[CORBA interface] Get ExecutionContextList.
ConfigurationSetListener class.
def __call__(self, config_set)
def sdoToDFC(self, sdo, dfc)
Conversion from SDO to DFCbool sdoToDFC(const SDO_ptr sdo, ::OpenRTM::DataFlowComponent_ptr& dfc);...
def removeOrganizationFromTarget(self, member)
Remove Organization object from a target DFCvoid removeOrganizationFromTarget(Member& member) ...
def stringToStrVec(v, _is)
def onReset(self, exec_handle)
Callback function to reset.
def addParticipantToEC(self, member)
Set CompositeRTC's ExecutionContext to the given DFCvoid addParticipantToEC(Member& member) ...