summaryrefslogtreecommitdiff
path: root/TAO/tao/Unbounded_Array_Sequence_T.h
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2006-06-20 06:50:41 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2006-06-20 06:50:41 +0000
commit656d007c43508d5b1266be8a711c36c6d5cfcf8e (patch)
treeddae261b58cd5cf64115cbdbdecda874af1afd9c /TAO/tao/Unbounded_Array_Sequence_T.h
parentdd263f8a1dba72d3bccf49ca44477831c639c9dc (diff)
downloadATCD-656d007c43508d5b1266be8a711c36c6d5cfcf8e.tar.gz
ChangeLogTag: Mon Jun 19 12:11:09 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao/Unbounded_Array_Sequence_T.h')
-rw-r--r--TAO/tao/Unbounded_Array_Sequence_T.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/TAO/tao/Unbounded_Array_Sequence_T.h b/TAO/tao/Unbounded_Array_Sequence_T.h
index d3ec27f0e51..5fe22be1f9e 100644
--- a/TAO/tao/Unbounded_Array_Sequence_T.h
+++ b/TAO/tao/Unbounded_Array_Sequence_T.h
@@ -91,6 +91,56 @@ public:
private:
implementation_type impl_;
};
+
+ template <typename stream, typename array_traits>
+ bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence<array_traits> & target) {
+ typedef TAO::unbounded_array_sequence<array_traits> sequence;
+ typedef TAO_Array_Forany_T <array_traits> forany;
+
+ ::CORBA::ULong new_length = 0;
+ if (!(strm >> new_length)) {
+ return false;
+ }
+ if (new_length > strm.length()) {
+ return false;
+ }
+ sequence tmp(new_length);
+ tmp.length(new_length);
+ typename sequence::value_type * buffer = tmp.get_buffer();
+ for(CORBA::ULong i = 0; i < new_length; ++i) {
+ forany tmp (TAO::details::array_traits<array_traits>::alloc ());
+ bool const _tao_marshal_flag = (strm >> tmp);
+ if (_tao_marshal_flag) {
+ TAO::details::array_traits<array_traits>::copy (buffer[i], tmp.in ());
+ }
+ TAO::details::array_traits<array_traits>::free (tmp.inout ());
+ if (!_tao_marshal_flag) {
+ return false;
+ }
+ }
+ tmp.swap(target);
+ return true;
+ }
+
+ template <typename stream, typename array_traits>
+ bool marshal_sequence(stream & strm, const TAO::unbounded_array_sequence<array_traits> & source) {
+ if (0 == &source)
+ ACE_THROW_RETURN (::CORBA::BAD_PARAM(0, CORBA::COMPLETED_MAYBE), false);
+ typedef typename ::TAO_FixedArray_Var_T <array_traits> fixed_array;
+ typedef typename ::TAO_Array_Forany_T <array_traits> forany;
+ ::CORBA::ULong const length = source.length ();
+ if (!(strm << length)) {
+ return false;
+ }
+ for(CORBA::ULong i = 0; i < length; ++i) {
+ fixed_array tmp_array = TAO::details::array_traits<array_traits>::dup (source[i]);
+ forany const tmp (tmp_array.inout ());
+ if (!(strm << tmp)) {
+ return false;
+ }
+ }
+ return true;
+ }
}
TAO_END_VERSIONED_NAMESPACE_DECL