summaryrefslogtreecommitdiff
path: root/TAO/tao/CurrentC.cpp
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-21 20:04:48 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-21 20:04:48 +0000
commitf797fcd6004cc2a8b595c4b1ba2ac6482d1fdeb8 (patch)
tree6a09865d0c260552f76f345fecc5caf29afb8162 /TAO/tao/CurrentC.cpp
parent6028e711b83d8e5f632659e24ccbf05c63ab3c6c (diff)
downloadATCD-f797fcd6004cc2a8b595c4b1ba2ac6482d1fdeb8.tar.gz
ChangeLogTag:Tue Mar 21 13:51:23 2000 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/CurrentC.cpp')
-rw-r--r--TAO/tao/CurrentC.cpp49
1 files changed, 13 insertions, 36 deletions
diff --git a/TAO/tao/CurrentC.cpp b/TAO/tao/CurrentC.cpp
index d514f92cc20..c187a2de222 100644
--- a/TAO/tao/CurrentC.cpp
+++ b/TAO/tao/CurrentC.cpp
@@ -67,6 +67,13 @@ CORBA_Current_ptr CORBA_Current::_nil (void)
return (CORBA_Current_ptr)NULL;
} // end of _nil
+void
+CORBA_Current::_tao_any_destructor (void* x)
+{
+ CORBA_Current *tmp = ACE_static_cast (CORBA_Current*,x);
+ CORBA::release (tmp);
+}
+
CORBA::Boolean CORBA_Current::_is_a (const CORBA::Char *value, CORBA::Environment &ACE_TRY_ENV)
{
if (
@@ -84,47 +91,25 @@ const char* CORBA_Current::_interface_repository_id (void) const
void operator<<= (CORBA::Any &_tao_any, CORBA::Current_ptr _tao_elem)
{
- CORBA::Object_ptr *_tao_obj_ptr = 0;
- ACE_TRY_NEW_ENV
- {
- ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);
- *_tao_obj_ptr = CORBA::Current::_duplicate (_tao_elem);
- TAO_OutputCDR stream;
- if (stream << *_tao_obj_ptr)
+ TAO_OutputCDR stream;
+ if (stream << _tao_elem)
{
_tao_any._tao_replace (
- CORBA::_tc_Current,
+ CORBA::_tc_Current,
TAO_ENCAP_BYTE_ORDER,
- stream.begin (),
- 1,
- _tao_obj_ptr,
- ACE_TRY_ENV
+ stream.begin ()
);
- ACE_TRY_CHECK;
- }
- else
- {
- delete _tao_obj_ptr;
}
- }
- ACE_CATCHANY
- {
- delete _tao_obj_ptr;
- }
- ACE_ENDTRY;
}
CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Current_ptr &_tao_elem)
{
- CORBA::Object_ptr *tmp = 0;
- ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0);
ACE_TRY_NEW_ENV
{
_tao_elem = CORBA::Current::_nil ();
CORBA::TypeCode_var type = _tao_any.type ();
if (!type->equivalent (CORBA::_tc_Current, ACE_TRY_ENV)) // not equal
{
- delete tmp;
return 0;
}
ACE_TRY_CHECK;
@@ -137,24 +122,17 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Current_ptr &_tao
{
_tao_elem = CORBA::Current::_narrow (_tao_obj_var.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
- *tmp = (CORBA::Object_ptr) _tao_elem; // any owns the object
((CORBA::Any *)&_tao_any)->_tao_replace (
CORBA::_tc_Current,
1,
- tmp,
- ACE_TRY_ENV
+ _tao_elem,
+ CORBA::Current::_tao_any_destructor
);
- ACE_TRY_CHECK;
return 1;
}
- else // failure
- {
- delete tmp;
- }
}
ACE_CATCHANY
{
- delete tmp;
_tao_elem = CORBA::Current::_nil ();
return 0;
}
@@ -162,4 +140,3 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Current_ptr &_tao
_tao_elem = CORBA::Current::_nil ();
return 0;
}
-