Factory.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
16 
17 import OpenRTM_aist
18 
19 
20 
34 def Delete(rtc):
35  del rtc
36 
37 
38 
39 
62  """
63  """
64 
65 
84  def __init__(self, profile):
85 
86  self._Profile = profile
87 
88  self._Number = -1
89 
90  pass
91 
92 
93 
113  def create(self, mgr):
114  pass
115 
116 
117 
135  def destroy(self, comp):
136  pass
137 
138 
139 
157  def profile(self):
158  return self._Profile
159 
160 
161 
179  def number(self):
180  return self._Number
181 
182 
183 
184 
185 
204  """
205  """
206 
207 
238  def __init__(self, profile, new_func, delete_func, policy=None):
239  FactoryBase.__init__(self, profile)
240 
241  if policy is None:
243  else:
244  self._policy = policy
245 
246  self._New = new_func
247 
248  self._Delete = delete_func
249 
250 
251 
272  def create(self, mgr):
273  try:
274  rtobj = self._New(mgr)
275  if rtobj == 0:
276  return None
277 
278  self._Number += 1
279 
280  rtobj.setProperties(self.profile())
281 
282  instance_name = rtobj.getTypeName()
283  instance_name += self._policy.onCreate(rtobj)
284  rtobj.setInstanceName(instance_name)
285 
286  return rtobj
287  except:
288  print OpenRTM_aist.Logger.print_exception()
289  return None
290 
291 
292 
311  def destroy(self, comp):
312  self._Number -= 1
313  self._policy.onDelete(comp)
314  self._Delete(comp)
_Number
self._Number Number of current component instances.
Definition: Factory.py:88
def Delete(rtc)
Definition: Factory.py:34
_Profile
self._Profile Component profile
Definition: Factory.py:86
def profile(self)
Get component profile.
Definition: Factory.py:157
def __init__(self, profile)
Constructor.
Definition: Factory.py:84
def destroy(self, comp)
Destroy component.
Definition: Factory.py:311
def __init__(self, profile, new_func, delete_func, policy=None)
Constructor.
Definition: Factory.py:238
def create(self, mgr)
Create component.
Definition: Factory.py:113
FactoryBase base class.
Definition: Factory.py:61
FactoryPython class.
Definition: Factory.py:203
def number(self)
Get number of component instances.
Definition: Factory.py:179
def create(self, mgr)
Create component.
Definition: Factory.py:272
def destroy(self, comp)
Destroy component.
Definition: Factory.py:135


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