diff options
Diffstat (limited to 'TAO/tao/Policy_ForwardC.cpp')
-rw-r--r-- | TAO/tao/Policy_ForwardC.cpp | 282 |
1 files changed, 178 insertions, 104 deletions
diff --git a/TAO/tao/Policy_ForwardC.cpp b/TAO/tao/Policy_ForwardC.cpp index 56255fddae1..2acfd50b377 100644 --- a/TAO/tao/Policy_ForwardC.cpp +++ b/TAO/tao/Policy_ForwardC.cpp @@ -465,37 +465,54 @@ TAO_NAMESPACE_BEGIN (CORBA) TAO_NAMESPACE_DEFINE (::CORBA::TypeCode_ptr, _tc_SetOverrideType, &_tc_TAO_tc_CORBA_SetOverrideType) TAO_NAMESPACE_END + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_cs.cpp:61 + +// Copying insertion. void operator<<= ( CORBA::Any &_tao_any, const CORBA::PolicyList &_tao_elem - ) // copying + ) { TAO_OutputCDR stream; + if (stream << _tao_elem) - { - _tao_any._tao_replace ( - CORBA::_tc_PolicyList, - TAO_ENCAP_BYTE_ORDER, - stream.begin () - ); - } + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyList, + TAO_ENCAP_BYTE_ORDER, + stream.begin () + ); + } } -void operator<<= (CORBA::Any &_tao_any, CORBA::PolicyList *_tao_elem) // non copying +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + CORBA::PolicyList *_tao_elem + ) { TAO_OutputCDR stream; - stream << *_tao_elem; - _tao_any._tao_replace ( - CORBA::_tc_PolicyList, - TAO_ENCAP_BYTE_ORDER, - stream.begin (), - 1, - _tao_elem, - CORBA::PolicyList::_tao_any_destructor - ); + + if (stream << *_tao_elem) + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyList, + TAO_ENCAP_BYTE_ORDER, + stream.begin (), + 1, + _tao_elem, + CORBA::PolicyList::_tao_any_destructor + ); + } } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyList *&_tao_elem) +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + CORBA::PolicyList *&_tao_elem + ) { return _tao_any >>= ACE_const_cast( const CORBA::PolicyList*&, @@ -503,90 +520,127 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyList *&_tao ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::PolicyList *&_tao_elem) +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const CORBA::PolicyList *&_tao_elem + ) { _tao_elem = 0; + ACE_TRY_NEW_ENV { CORBA::TypeCode_var type = _tao_any.type (); - CORBA::Boolean result = type->equivalent (CORBA::_tc_PolicyList ACE_ENV_ARG_PARAMETER); + CORBA::Boolean result = + type->equivalent ( + CORBA::_tc_PolicyList + ACE_ENV_ARG_PARAMETER + ); ACE_TRY_CHECK; if (!result) - return 0; // not equivalent + { + return 0; // not equivalent + } if (_tao_any.any_owns_data ()) - { - _tao_elem = ACE_static_cast( - const CORBA::PolicyList*, - _tao_any.value () - ); - return 1; - } - else - { - CORBA::PolicyList *tmp; - ACE_NEW_RETURN (tmp, CORBA::PolicyList, 0); - TAO_InputCDR stream ( - _tao_any._tao_get_cdr (), - _tao_any._tao_byte_order () - ); - if (stream >> *tmp) { - ((CORBA::Any *)&_tao_any)->_tao_replace ( - CORBA::_tc_PolicyList, - 1, - ACE_static_cast (void *, tmp), - CORBA::PolicyList::_tao_any_destructor + _tao_elem = ACE_static_cast( + const CORBA::PolicyList*, + _tao_any.value () ); - _tao_elem = tmp; + return 1; } - else + else { - delete tmp; + CORBA::PolicyList *tmp = 0; + ACE_NEW_RETURN ( + tmp, + CORBA::PolicyList, + 0 + ); + + TAO_InputCDR stream ( + _tao_any._tao_get_cdr (), + _tao_any._tao_byte_order () + ); + + if (stream >> *tmp) + { + ((CORBA::Any *)&_tao_any)->_tao_replace ( + CORBA::_tc_PolicyList, + 1, + ACE_static_cast (void *, tmp), + CORBA::PolicyList::_tao_any_destructor + ); + + _tao_elem = tmp; + return 1; + } + else + { + delete tmp; + } } - } } ACE_CATCHANY { } ACE_ENDTRY; + return 0; } + +// TAO_IDL - Generated from +// be/be_visitor_sequence/any_op_cs.cpp:61 + +// Copying insertion. void operator<<= ( CORBA::Any &_tao_any, const CORBA::PolicyTypeSeq &_tao_elem - ) // copying + ) { TAO_OutputCDR stream; + if (stream << _tao_elem) - { - _tao_any._tao_replace ( - CORBA::_tc_PolicyTypeSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin () - ); - } + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyTypeSeq, + TAO_ENCAP_BYTE_ORDER, + stream.begin () + ); + } } -void operator<<= (CORBA::Any &_tao_any, CORBA::PolicyTypeSeq *_tao_elem) // non copying +// Non-copying insertion. +void operator<<= ( + CORBA::Any &_tao_any, + CORBA::PolicyTypeSeq *_tao_elem + ) { TAO_OutputCDR stream; - stream << *_tao_elem; - _tao_any._tao_replace ( - CORBA::_tc_PolicyTypeSeq, - TAO_ENCAP_BYTE_ORDER, - stream.begin (), - 1, - _tao_elem, - CORBA::PolicyTypeSeq::_tao_any_destructor - ); + + if (stream << *_tao_elem) + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyTypeSeq, + TAO_ENCAP_BYTE_ORDER, + stream.begin (), + 1, + _tao_elem, + CORBA::PolicyTypeSeq::_tao_any_destructor + ); + } } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyTypeSeq *&_tao_elem) +// Extraction to non-const pointer (deprecated). +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + CORBA::PolicyTypeSeq *&_tao_elem + ) { return _tao_any >>= ACE_const_cast( const CORBA::PolicyTypeSeq*&, @@ -594,56 +648,76 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyTypeSeq *&_ ); } -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::PolicyTypeSeq *&_tao_elem) +// Extraction to const pointer. +CORBA::Boolean operator>>= ( + const CORBA::Any &_tao_any, + const CORBA::PolicyTypeSeq *&_tao_elem + ) { _tao_elem = 0; + ACE_TRY_NEW_ENV { CORBA::TypeCode_var type = _tao_any.type (); - CORBA::Boolean result = type->equivalent (CORBA::_tc_PolicyTypeSeq ACE_ENV_ARG_PARAMETER); + CORBA::Boolean result = + type->equivalent ( + CORBA::_tc_PolicyTypeSeq + ACE_ENV_ARG_PARAMETER + ); ACE_TRY_CHECK; if (!result) - return 0; // not equivalent + { + return 0; // not equivalent + } if (_tao_any.any_owns_data ()) - { - _tao_elem = ACE_static_cast( - const CORBA::PolicyTypeSeq*, - _tao_any.value () - ); - return 1; - } - else - { - CORBA::PolicyTypeSeq *tmp; - ACE_NEW_RETURN (tmp, CORBA::PolicyTypeSeq, 0); - TAO_InputCDR stream ( - _tao_any._tao_get_cdr (), - _tao_any._tao_byte_order () - ); - if (stream >> *tmp) { - ((CORBA::Any *)&_tao_any)->_tao_replace ( - CORBA::_tc_PolicyTypeSeq, - 1, - ACE_static_cast (void *, tmp), - CORBA::PolicyTypeSeq::_tao_any_destructor + _tao_elem = ACE_static_cast( + const CORBA::PolicyTypeSeq*, + _tao_any.value () ); - _tao_elem = tmp; + return 1; } - else + else { - delete tmp; + CORBA::PolicyTypeSeq *tmp = 0; + ACE_NEW_RETURN ( + tmp, + CORBA::PolicyTypeSeq, + 0 + ); + + TAO_InputCDR stream ( + _tao_any._tao_get_cdr (), + _tao_any._tao_byte_order () + ); + + if (stream >> *tmp) + { + ((CORBA::Any *)&_tao_any)->_tao_replace ( + CORBA::_tc_PolicyTypeSeq, + 1, + ACE_static_cast (void *, tmp), + CORBA::PolicyTypeSeq::_tao_any_destructor + ); + + _tao_elem = tmp; + return 1; + } + else + { + delete tmp; + } } - } } ACE_CATCHANY { } ACE_ENDTRY; + return 0; } @@ -713,16 +787,16 @@ CORBA::Boolean operator>> ( CORBA::ULong _tao_seq_len; if (strm >> _tao_seq_len) { + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 1159.) + if (_tao_seq_len > strm.length()) + return 0; // set the length of the sequence _tao_sequence.length (_tao_seq_len); // If length is 0 we return true. if (0 >= _tao_seq_len) return 1; - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length()) - return 0; // retrieve all the elements CORBA::Boolean _tao_marshal_flag = 1; for (CORBA::ULong i = 0; i < _tao_sequence.length () && _tao_marshal_flag; i++) @@ -755,16 +829,16 @@ CORBA::Boolean operator>> ( CORBA::ULong _tao_seq_len; if (strm >> _tao_seq_len) { + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 1159.) + if (_tao_seq_len > strm.length()) + return 0; // set the length of the sequence _tao_sequence.length (_tao_seq_len); // If length is 0 we return true. if (0 >= _tao_seq_len) return 1; - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length()) - return 0; // retrieve all the elements return strm.read_ulong_array (_tao_sequence.get_buffer (), _tao_sequence.length ()); } |