1 #ifndef guard_unbounded_sequence_cdr
2 #define guard_unbounded_sequence_cdr
6 * @brief Extract the sequence
8 * @author Carlos O'Ryan
9 * @author Johnny Willemsen
12 #include "tao/Basic_Types.h"
13 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 template <typename stream
, typename sequence
>
17 bool extract_unbounded_sequence(stream
& strm
, sequence
& target
) {
18 ::CORBA::ULong new_length
;
19 if (!(strm
>> new_length
)) {
22 if (new_length
> strm
.length()) {
25 sequence
tmp(new_length
);
26 tmp
.length(new_length
);
27 typename
sequence::value_type
* buffer
= tmp
.get_buffer();
28 for(CORBA::ULong i
= 0; i
< new_length
; ++i
) {
29 if (!(strm
>> buffer
[i
])) {
37 template <typename stream
, typename sequence
>
38 bool insert_unbounded_sequence(stream
& strm
, const sequence
& source
) {
39 const CORBA::ULong length
= source
.length ();
40 if (!(strm
<< length
)) {
43 for(CORBA::ULong i
= 0; i
< length
; ++i
) {
44 if (!(strm
<< source
[i
])) {
53 TAO_END_VERSIONED_NAMESPACE_DECL
54 #endif /* guard_unbounded_sequence_cdr */