PortProfileHelper.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
20 
21 import threading
22 import OpenRTM_aist
23 import RTC
24 
25 
26 
46  """
47  """
48 
49  def __init__(self):
50  self._mutex = threading.RLock()
51  self._name = ""
52  self._ifProfiles = []
53  self._portRef = None
54  self._connProfiles = []
55  self._owner = None
56  self._properties = []
57  return
58 
59 
81  def setPortProfile(self, profile):
82  guard = OpenRTM_aist.ScopedLock(self._mutex)
83  self._name = profile.name
84  self._ifProfiles = profile.interfaces
85  self._portRef = profile.port_ref
86  self._connProfiles = profile.connector_profiles
87  self._owner = profile.owner
88  self._properties = profile.properties
89  return
90 
91 
111  def getPortProfile(self):
112  guard = OpenRTM_aist.ScopedLock(self._mutex)
113  prof = RTC.PortProfile(self._name,
114  self._ifProfiles,
115  self._portRef,
116  self._connProfiles,
117  self._owner,
118  self._properties)
119  return prof
120 
121 
122 
143  def setName(self, name):
144  guard = OpenRTM_aist.ScopedLock(self._mutex)
145  self._name = name
146  return
147 
148 
168  def getName(self):
169  guard = OpenRTM_aist.ScopedLock(self._mutex)
170  return self._name
171 
172 
173 
193  def appendPortInterfaceProfile(self, if_prof):
194  guard = OpenRTM_aist.ScopedLock(self._mutex)
195  self._ifProfiles.append(if_prof)
196  return
197 
198 
219  guard = OpenRTM_aist.ScopedLock(self._mutex)
220  return self._ifProfiles
221 
222 
223 
247  def getPortInterfaceProfile(self, instance_name):
248  guard = OpenRTM_aist.ScopedLock(self._mutex)
250  self.if_name(instance_name))
251  if index < 0:
252  return None
253  else:
254  return self._ifProfiles[index]
255 
256 
257 
280  def erasePortInterfaceProfile(self, instance_name):
281  guard = OpenRTM_aist.ScopedLock(self._mutex)
283  self.if_name(instance_name))
284  if index < 0:
285  return
286  else:
287  del self._ifProfiles[index]
288 
289 
290 
311  def setPortRef(self, port):
312  guard = OpenRTM_aist.ScopedLock(self._mutex)
313  self._portRef = port
314  return
315 
316 
317 
338  def getPortRef(self):
339  guard = OpenRTM_aist.ScopedLock(self._mutex)
340  return self._portRef
341 
342 
343 
363  def appendConnectorProfile(self, conn_profile):
364  guard = OpenRTM_aist.ScopedLock(self._mutex)
365  self._connProfiles.append(conn_profile)
366  return
367 
368 
390  guard = OpenRTM_aist.ScopedLock(self._mutex)
391  return self._connProfiles
392 
393 
394 
416  def getConnectorProfile(self, name):
417  guard = OpenRTM_aist.ScopedLock(self._mutex)
419  self.conn_name(name))
420  if index < 0:
421  return None
422  else:
423  return self._connProfiles[index]
424 
425  return None
426 
427 
428 
450  def getConnectorProfileById(self, id):
451  guard = OpenRTM_aist.ScopedLock(self._mutex)
453  self.conn_id(id))
454  if index < 0:
455  return None
456  else:
457  return self._connProfiles[index]
458 
459  return None
460 
461 
482  def eraseConnectorProfile(self, name):
483  guard = OpenRTM_aist.ScopedLock(self._mutex)
485  self.conn_name(name))
486  if index < 0:
487  return
488  else:
489  del self._connProfiles[index]
490 
491  return
492 
493 
494 
516  guard = OpenRTM_aist.ScopedLock(self._mutex)
518  self.conn_id(id))
519  if index < 0:
520  return
521  else:
522  del self._connProfiles[index]
523 
524  return
525 
526 
546  def setOwner(self, owner):
547  guard = OpenRTM_aist.ScopedLock(self._mutex)
548  self._owner = owner
549  return
550 
551 
571  def getOwner(self):
572  guard = OpenRTM_aist.ScopedLock(self._mutex)
573  return self._owner
574 
575 
576 
596  def setProperties(self, prop):
597  guard = OpenRTM_aist.ScopedLock(self._mutex)
598  self._properties = prop
599  return
600 
601 
621  def getProperties(self):
622  guard = OpenRTM_aist.ScopedLock(self._mutex)
623  return self._properties
624 
625 
626 
633  class if_name:
634  def __init__(self, name):
635  self._name = name
636  return
637 
638  def __call__(self, prof):
639  return str(self._name) == str(prof.instance_name)
640 
641 
642  # Functor to find ConnectorProfile by name
643  class conn_name:
644  def __init__(self, name):
645  self._name = name
646  return
647 
648  def __call__(self, cprof):
649  return str(self._name) == str(cprof.name)
650 
651 
652  # Functor to find ConnectorProfile by id
653  class conn_id:
654  def __init__(self, id_):
655  self._id = id_
656  return
657 
658  def __call__(self, cprof):
659  return str(self._id) == str(cprof.connector_id)
def setOwner(self, owner)
Set owner&#39;s object reference to the PortProfile.
def getConnectorProfiles(self)
Get ConnectorProfileList.
def setProperties(self, prop)
Set properties to the PortProfile.
def setPortProfile(self, profile)
Set PortProfile.
def getConnectorProfileById(self, id)
Get ConnectorProfile.
def eraseConnectorProfileById(self, id)
Erase ConnectorProfile.
def appendPortInterfaceProfile(self, if_prof)
Append PortInterfaceProfile to the PortProfile.
def erasePortInterfaceProfile(self, instance_name)
Erase PortInterfaceProfile from the PortProfile.
def setPortRef(self, port)
Set Port&#39;s object reference.
def appendConnectorProfile(self, conn_profile)
Append ConnectorProfile.
def getConnectorProfile(self, name)
Get ConnectorProfile.
def getProperties(self)
Get properties of the PortProfile.
def find(seq, f)
Return the index of CORBA sequence element that functor matches.
def getOwner(self)
Get owner&#39;s object reference from the PortProfile.
def getPortInterfaceProfiles(self)
Get PortInterfaceProfileList.
def getPortRef(self)
Get Port&#39;s object reference.
A functor to find a PortInterfaceProfile named instance_name.
def append(dest, src)
Definition: NVUtil.py:386
def setName(self, name)
Set PortProfile.name.
def getPortInterfaceProfile(self, instance_name)
Get PortInterfaceProfile.
def eraseConnectorProfile(self, name)
Erase ConnectorProfile.


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:06