19 #ifndef CORBA_SEQUTIL_H 20 #define CORBA_SEQUTIL_H 97 template <
class CorbaSequence,
class Functor>
98 Functor
for_each(CorbaSequence& seq, Functor f)
102 for (CORBA::ULong i = 0; i < len; ++i)
141 template <
class CorbaSequence,
class Functor>
142 CORBA::Long
find(
const CorbaSequence& seq, Functor f)
144 CORBA::ULong len(seq.length());
145 for (CORBA::ULong i = 0; i < len; ++i)
147 if (f(seq[i]))
return (CORBA::Long)i;
174 template <
class CorbaSequence,
class SequenceElement>
175 void push_back(CorbaSequence& seq, SequenceElement elem)
177 CORBA::ULong len(seq.length());
202 template <
class CorbaSequence>
205 CORBA::ULong len1(seq1.length());
206 CORBA::ULong len2(seq2.length());
207 CORBA::ULong len(len1 + len2);
210 for (CORBA::ULong i = 0; i < len2; ++i)
212 seq1[len1 + i] = seq2[i];
244 template <
class CorbaSequence,
class SequenceElement>
245 void insert(CorbaSequence& seq, SequenceElement& elem, CORBA::ULong
index)
247 CORBA::ULong len(seq.length());
255 for (CORBA::ULong i = len; i >
index; --i)
287 template <
class CorbaSequence,
class SequenceElement>
288 SequenceElement&
front(CorbaSequence& seq)
316 template <
class CorbaSequence,
class SequenceElement>
317 SequenceElement&
back(CorbaSequence& seq)
319 return seq[seq.length() - 1];
344 template <
class CorbaSequence>
347 CORBA::ULong len(seq.length());
348 if (index > len)
return;
350 for (CORBA::ULong i = index; i < len - 1; ++i)
380 template <
class CorbaSequence,
class Functor>
384 index =
find(seq, f);
385 if (index < 0)
return;
404 template <
class CorbaSequence>
412 template <
class CorbaRefSequence>
418 for (CORBA::ULong i(0), len(objlist.length()); i < len; ++i)
421 CORBA::String_var str_var = orb->object_to_string(objlist[i].in());
423 CORBA_Object obj = (objlist.cobj())->
_buffer[i];
424 CORBA::String_var str_var = orb->object_to_string2(obj);
426 iorlist.push_back(str_var.in());
431 #endif // CORBA_SEQUTIL_H void erase(CorbaSequence &seq, CORBA::ULong index)
Erase the element of the specified index.
SequenceElement & front(CorbaSequence &seq)
Get the front element of the CORBA sequence.
void clear(CorbaSequence &seq)
Erase all the elements of the CORBA sequence.
CORBA::ORB_ptr getORB()
Get the pointer to ORB.
static Manager & instance()
Get instance of the manager.
RTComponent manager class.
std::vector< std::string > vstring
SequenceElement & back(CorbaSequence &seq)
Get the last element of the CORBA sequence.
void insert(CorbaSequence &seq, SequenceElement &elem, CORBA::ULong index)
Insert the element to the CORBA sequence.
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
void erase_if(CorbaSequence &seq, Functor f)
Remove an element of a sequence according to a predicate.
void push_back_list(CorbaSequence &seq1, const CorbaSequence &seq2)
Merge the elements of the CORBA sequence.
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
coil::vstring refToVstring(const CorbaRefSequence &objlist)
CORBA IOR helper functions.
Functor for_each(CorbaSequence &seq, Functor f)
Apply the functor to all CORBA sequence elements.