diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-26 00:39:16 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-26 00:39:16 +0000 |
commit | 87a45a2db2fba602238d23fe6259956da2a37334 (patch) | |
tree | a0bb484c93034a27212afea52017a69c87561578 | |
parent | d251e715658a568ee277ab36dec3af41e7690a1b (diff) | |
download | ATCD-87a45a2db2fba602238d23fe6259956da2a37334.tar.gz |
Added insertion/extraction operator for long double.
-rw-r--r-- | TAO/tao/Any.cpp | 65 | ||||
-rw-r--r-- | TAO/tao/Any.h | 6 |
2 files changed, 71 insertions, 0 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index 7142e14c4b8..16bc566d9ae 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -652,6 +652,30 @@ CORBA_Any::operator<<= (CORBA::Double d) ACE_CHECK; } +void +CORBA_Any::operator<<= (CORBA::LongDouble ld) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + CORBA::LongDouble *nld; + ACE_NEW (nld, + CORBA::LongDouble (ld)); + this->replace (CORBA::_tc_longdouble, + nld, + 1, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("Exception in CORBA::LongDouble insertion\n"))); + } + ACE_ENDTRY; + ACE_CHECK; +} + // insertion of Any - copying void CORBA_Any::operator<<= (const CORBA_Any& a) @@ -1353,6 +1377,47 @@ CORBA_Any::operator>>= (CORBA::Double &d) const } CORBA::Boolean +CORBA_Any::operator>>= (CORBA::LongDouble &ld) const +{ + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + CORBA::Boolean result = + this->type_->equivalent (CORBA::_tc_longdouble, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (result) + { + if (this->any_owns_data_ && this->value_) + { + ld = *(CORBA::LongDouble *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_, + this->byte_order_); + return stream.read_longdouble (ld); + } + } + else + { + return 0; + } + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("Exception in CORBA::LongDouble extraction\n"))); + } + ACE_ENDTRY; + + return 0; +} + +CORBA::Boolean CORBA_Any::operator>>= (CORBA::Any &a) const { ACE_DECLARE_NEW_CORBA_ENV; diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 20f09d06655..88a1d32f043 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -126,6 +126,9 @@ public: void operator<<= (CORBA::Double); // insert a double + void operator<<= (CORBA::LongDouble); + // insert a long double + void operator<<= (const CORBA_Any&); // insert an Any, copying @@ -174,6 +177,9 @@ public: CORBA::Boolean operator>>= (CORBA::Double&) const; // extract a double + CORBA::Boolean operator>>= (CORBA::LongDouble&) const; + // extract a long double + CORBA::Boolean operator>>= (CORBA_Any&) const; // non-spec CORBA::Boolean operator>>= (const CORBA_Any*&) const; // extract an Any |