diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-01-04 17:38:11 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-01-04 17:38:11 +0000 |
commit | 7262684582dbe2df05d72662e31aaf0981282758 (patch) | |
tree | f9a75068320840619a2f871f341a6dd07b6f6f44 | |
parent | c151b96a98761929f5643db8cf3e4b7a27758b35 (diff) | |
download | ATCD-7262684582dbe2df05d72662e31aaf0981282758.tar.gz |
Added >>= to pointer to const Any, as laid out in CORBA 2.3.1.
-rw-r--r-- | TAO/tao/Any.cpp | 208 | ||||
-rw-r--r-- | TAO/tao/Any.h | 11 |
2 files changed, 213 insertions, 6 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index ea9bde575a3..6614a3e669a 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -1375,6 +1375,8 @@ CORBA_Any::operator>>= (CORBA::Any &a) const &a, 0, ACE_TRY_ENV); + ACE_TRY_CHECK; + return (CORBA::Boolean) ((retval == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0); @@ -1396,6 +1398,68 @@ CORBA_Any::operator>>= (CORBA::Any &a) const } CORBA::Boolean +CORBA_Any::operator>>= (const CORBA::Any *&a) const +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::Boolean result = + this->type_->equivalent (CORBA::_tc_any, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (result) + { + if (this->any_owns_data_ && this->value_) + { + a = (CORBA::Any *) this->value_; + return 1; + } + else + { + ACE_NEW_RETURN (a, + CORBA::Any, + 0); + TAO_InputCDR stream (this->cdr_); + // decode the CDR + CORBA::TypeCode::traverse_status retval = + stream.decode (CORBA::_tc_any, + a, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) + { + return 1; + } + else + { + delete a; + a = 0; + return 0; + } + } + } + else + { + a = 0; + return 0; + } + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("Exception in CORBA::Any extraction\n"))); + } + ACE_ENDTRY; + + a = 0; + return 0; +} + +CORBA::Boolean CORBA_Any::operator>>= (char *&s) const { ACE_DECLARE_NEW_CORBA_ENV; @@ -1435,11 +1499,16 @@ CORBA_Any::operator>>= (char *&s) const return 1; } - return 0; + else + { + s = 0; + return 0; + } } } else { + s = 0; return 0; } } @@ -1450,6 +1519,71 @@ CORBA_Any::operator>>= (char *&s) const } ACE_ENDTRY; + s = 0; + return 0; +} + +CORBA::Boolean +CORBA_Any::operator>>= (const char *&s) const +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::Boolean result = + this->type_->equivalent (CORBA::_tc_string, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (result) + { + if (this->any_owns_data_ && this->value_) + { + s = *(char **) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + if (stream.read_string ((char *&)s)) + { + ACE_const_cast (CORBA_Any *, + this)->any_owns_data_ = 1; + + char **tmp; + + ACE_NEW_RETURN (tmp, + char *, + 0); + + *tmp = (char *)s; + + ACE_const_cast (CORBA_Any *, + this)->value_ = tmp; + + return 1; + } + else + { + s = 0; + return 0; + } + } + } + else + { + s = 0; + return 0; + } + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("Exception in unbounded string extraction\n"))); + } + ACE_ENDTRY; + + s = 0; return 0; } @@ -1493,11 +1627,80 @@ CORBA_Any::operator>>= (CORBA::WChar *&ws) const return 1; } - return 0; + else + { + ws = 0; + return 0; + } + } + } + else + { + ws = 0; + return 0; + } + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("Exception in unbounded wstring extraction\n"))); + } + ACE_ENDTRY; + + ws = 0; + return 0; +} + +CORBA::Boolean +CORBA_Any::operator>>= (const CORBA::WChar *&ws) const +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::Boolean result = + this->type_->equivalent (CORBA::_tc_wstring, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (result) + { + if (this->any_owns_data_ && this->value_) + { + ws = *(CORBA::WChar **) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + if (stream.read_wstring ((CORBA::WChar *&)ws)) + { + ACE_const_cast (CORBA_Any *, + this)->any_owns_data_ = 1; + + CORBA::WChar **tmp; + + ACE_NEW_RETURN (tmp, + CORBA::WChar *, + 0); + + *tmp = (CORBA::WChar *)ws; + + ACE_const_cast (CORBA_Any *, + this)->value_ = tmp; + + return 1; + } + else + { + ws = 0; + return 0; + } } } else { + ws = 0; return 0; } } @@ -1508,6 +1711,7 @@ CORBA_Any::operator>>= (CORBA::WChar *&ws) const } ACE_ENDTRY; + ws = 0; return 0; } diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 9c010470e85..01c672e1181 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -173,16 +173,19 @@ public: CORBA::Boolean operator>>= (CORBA::Double&) const; // extract a double - CORBA::Boolean operator>>= (CORBA_Any&) const; + CORBA::Boolean operator>>= (CORBA_Any&) const; // non-spec + CORBA::Boolean operator>>= (const CORBA_Any*&) const; // extract an Any CORBA::Boolean operator>>= (CORBA::TypeCode_ptr&) const; // extract a TypeCode - CORBA::Boolean operator>>= (char*&) const; + CORBA::Boolean operator>>= (char*&) const; // deperecated + CORBA::Boolean operator>>= (const char*&) const; // extract an unbounded string - CORBA::Boolean operator>>= (CORBA::WChar*&) const; + CORBA::Boolean operator>>= (CORBA::WChar*&) const; // deprecated + CORBA::Boolean operator>>= (const CORBA::WChar*&) const; // extract an unbounded wide string // = Special types. @@ -235,7 +238,7 @@ public: // This one's not in ACE. struct TAO_Export to_object { - // This signature reflects the change seet out in + // This signature reflects the change set out in // issue 154 of the 1.3 RTF. to_object (CORBA_Object_out obj); CORBA::Object_ptr &ref_; |