1 #ifndef guard_bounded_sequence_cdr
2 #define guard_bounded_sequence_cdr
6 * @brief Extract the sequence
8 * @author Carlos O'Ryan
9 * @author Johnny Willemsen
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 template <typename stream
, typename sequence
>
17 bool extract_bounded_sequence(stream
& strm
, sequence
& target
) {
18 ::CORBA::ULong new_length
;
19 if (!(strm
>> new_length
)) {
22 if (new_length
> strm
.length()) {
25 if (new_length
> target
.maximum ()) {
29 tmp
.length(new_length
);
30 typename
sequence::value_type
* buffer
= tmp
.get_buffer();
31 for(CORBA::ULong i
= 0; i
< new_length
; ++i
) {
32 if (!(strm
>> buffer
[i
])) {
40 template <typename stream
, typename sequence
>
41 bool insert_bounded_sequence(stream
& strm
, const sequence
& source
) {
42 const ::CORBA::ULong length
= source
.length ();
43 if (!(strm
<< length
)) {
46 for(CORBA::ULong i
= 0; i
< length
; ++i
) {
47 if (!(strm
<< source
[i
])) {
56 TAO_END_VERSIONED_NAMESPACE_DECL
57 #endif /* guard_bounded_sequence_cdr */