CORBA_SeqUtil.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 
47 def for_each(seq, f):
48  len_ = len(seq)
49  for i in range(len_):
50  f(seq[i])
51  return f
52 
53 
54 
84 def find(seq, f):
85  len_ = len(seq)
86  for i in range(len_):
87  if f(seq[i]):
88  return i
89  return -1
90 
91 
92 
113 def push_back(seq, elem):
114  seq.append(elem)
115 
116 
117 
129 def push_back_list(seq1, seq2):
130  for elem in seq2:
131  seq1.append(elem)
132 
133 
134 
161 def insert(seq, elem, index):
162  len_ = len(seq)
163  if index > len:
164  seq.append(elem)
165  return
166  seq.insert(index, elem)
167 
168 
169 
189 def front(seq):
190  return seq[0]
191 
192 
193 
213 def back(seq):
214  if len(seq) > 0:
215  return seq[-1]
216 
217 
218 
239 def erase(seq, index):
240  if index > len(seq):
241  return
242 
243  del seq[index]
244 
245 
259 def erase_if(seq, f):
260  index = find(seq, f)
261  if index < 0:
262  return
263  del seq[index]
264 
265 
266 
280 def clear(seq):
281  del seq[0:]
282 
283 
284 ## coil::vstring refToVstring(const CorbaRefSequence& objlist)
285 def refToVstring(objlist):
286  iorlist = []
287  orb = OpenRTM_aist.Manager.instance().getORB()
288 
289  for obj in objlist:
290  iorlist.append(orb.object_to_string(obj))
291 
292  return iorlist
293 
def refToVstring(objlist)
coil::vstring refToVstring(const CorbaRefSequence& objlist)
def erase(seq, index)
Erase the element of the specified index.
def insert(seq, elem, index)
Insert the element to the CORBA sequence.
def back(seq)
Get the last element of the CORBA sequence.
def push_back_list(seq1, seq2)
def push_back(seq, elem)
Push the new element back to the CORBA sequence.
def for_each(seq, f)
Apply the functor to all CORBA sequence elements.
def clear(seq)
Erase all the elements of the CORBA sequence.
def find(seq, f)
Return the index of CORBA sequence element that functor matches.
def front(seq)
Get the front element of the CORBA sequence.


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