NumberingPolicy.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
16 
17 import string
18 import OpenRTM_aist
19 
20 
38  """
39  """
40 
41 
42 
43 
50  pass
51 
52 
53 
69  def onCreate(self, obj):
70  pass
71 
72 
73 
87  def onDelete(self, obj):
88  pass
89 
90 
91 
92 
107  """
108  """
109 
110 
124  def __init__(self):
125  self._num = 0
126  self._objects = []
127 
128 
129 
145  def onCreate(self, obj):
146  self._num += 1
147 
148  pos = 0
149  try:
150  pos = self.find(None)
151  self._objects[pos] = obj
152  return OpenRTM_aist.otos(pos)
154  self._objects.append(obj)
155  return OpenRTM_aist.otos(int(len(self._objects) - 1))
156 
157 
158 
172  def onDelete(self, obj):
173  pos = 0
174  try:
175  pos = self.find(obj)
176  except:
177  return
178 
179  if (pos < len(self._objects)):
180  self._objects[pos] = None
181  self._num -= 1
182 
183 
184 
200  def find(self, obj):
201  i = 0
202  for obj_ in self._objects:
203  if obj_ == obj:
204  return i
205  i += 1
207 
208 


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34