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 static_cast<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>
345 void erase(CorbaSequence& seq, CORBA::ULong index)
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>
415 coil::vstring iorlist;
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.emplace_back(str_var.in());
CORBA::ORB_ptr getORB()
ORB のポインタを取得する (所有権複製)
static Manager & instance()
マネージャのインスタンスの取得
CORBA sequence ヘルパーテンプレート関数
SequenceElement & back(CorbaSequence &seq)
CORBA sequence の末尾要素を取得する
Definition CORBA_SeqUtil.h:317
coil::vstring refToVstring(const CorbaRefSequence &objlist)
Definition CORBA_SeqUtil.h:413
void insert(CorbaSequence &seq, SequenceElement &elem, CORBA::ULong index)
CORBA sequence に要素を挿入する
Definition CORBA_SeqUtil.h:245
void push_back(CorbaSequence &seq, SequenceElement elem)
CORBA sequence の最後に要素を追加する
Definition CORBA_SeqUtil.h:175
CORBA::Long find(const CorbaSequence &seq, Functor f)
CORBA sequence の中から functor に適合する要素のインデックスを返す
Definition CORBA_SeqUtil.h:142
Functor for_each(CorbaSequence &seq, Functor f)
CORBA sequence に対して functor を適用する
Definition CORBA_SeqUtil.h:98
void erase_if(CorbaSequence &seq, Functor f)
シーケンスの要素を述語にしたがって削除する
Definition CORBA_SeqUtil.h:381
void clear(CorbaSequence &seq)
CORBA sequence の全要素を削除
Definition CORBA_SeqUtil.h:405
void erase(CorbaSequence &seq, CORBA::ULong index)
CORBA sequence の指定された位置の要素を削除する
Definition CORBA_SeqUtil.h:345
SequenceElement & front(CorbaSequence &seq)
CORBA sequence の先頭要素を取得する
Definition CORBA_SeqUtil.h:288
void push_back_list(CorbaSequence &seq1, const CorbaSequence &seq2)
CORBA sequence をマージする
Definition CORBA_SeqUtil.h:203