From f979d8aad4bb72dbf8373a270f219ca9449bef07 Mon Sep 17 00:00:00 2001 From: irfan Date: Thu, 13 Jul 2000 08:06:45 +0000 Subject: ChangeLogTag: Thu Jul 13 02:50:26 2000 Irfan Pyarali --- TAO/tao/CurrentC.cpp | 149 ++++++++++++--------------------------------------- 1 file changed, 35 insertions(+), 114 deletions(-) (limited to 'TAO/tao/CurrentC.cpp') diff --git a/TAO/tao/CurrentC.cpp b/TAO/tao/CurrentC.cpp index bcf055e6936..d85060483d2 100644 --- a/TAO/tao/CurrentC.cpp +++ b/TAO/tao/CurrentC.cpp @@ -1,50 +1,32 @@ -/* -*- C++ -*- */ -// $Id$ +/* -*- C++ -*- $Id$ */ // ****** Code generated by the The ACE ORB (TAO) IDL Compiler ******* -// TAO ORB and the TAO IDL Compiler have been developed by Washington -// University Computer Science's Distributed Object Computing Group. +// TAO and the TAO IDL Compiler have been developed by the Center for +// Distributed Object Computing at Washington University, St. Louis. // -// Information on TAO is available at +// Information about TAO is available at: // http://www.cs.wustl.edu/~schmidt/TAO.html #include "tao/CurrentC.h" -#include "tao/Stub.h" -#include "tao/Servant_Base.h" -#include "tao/Typecode.h" -#include "tao/Any.h" -#include "tao/POA_CORBA.h" -#include "tao/Environment.h" #if !defined (__ACE_INLINE__) #include "tao/CurrentC.i" #endif /* !defined INLINE */ -ACE_RCSID(tao, CurrentC, "$Id$") +// default constructor +CORBA_Current::CORBA_Current (void) +{} -CORBA_Current_ptr CORBA_Current::_duplicate (CORBA_Current_ptr obj) -{ - if (!CORBA::is_nil (obj)) - obj->_add_ref (); - - return obj; -} // end of _duplicate +// destructor +CORBA_Current::~CORBA_Current (void) +{} CORBA_Current_ptr CORBA_Current::_narrow ( CORBA::Object_ptr obj, CORBA::Environment &ACE_TRY_ENV ) { - if (CORBA::is_nil (obj)) - return CORBA_Current::_nil (); - if (! obj->_is_local ()) - { - CORBA::Boolean is_a = obj->_is_a ("IDL:CORBA_Current:1.0", ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA_Current::_nil ()); - if (is_a == 0) - return CORBA_Current::_nil (); - } return CORBA_Current::_unchecked_narrow (obj, ACE_TRY_ENV); } @@ -55,25 +37,7 @@ CORBA_Current_ptr CORBA_Current::_unchecked_narrow ( { if (CORBA::is_nil (obj)) return CORBA_Current::_nil (); - if (! obj->_is_local ()) - { - TAO_Stub* stub = obj->_stubobj (); - if (stub) - stub->_incr_refcnt (); - CORBA_Current_ptr default_proxy = CORBA_Current::_nil (); - - if (obj->_is_collocated () && _TAO_collocation_CORBA_Current_Stub_Factory_function_pointer != 0) - { - default_proxy = _TAO_collocation_CORBA_Current_Stub_Factory_function_pointer (obj); - } - if (CORBA::is_nil (default_proxy)) - ACE_NEW_RETURN (default_proxy, CORBA_Current (stub), CORBA_Current::_nil ()); - - return default_proxy; - - } - else - return + return ACE_reinterpret_cast ( CORBA_Current_ptr, @@ -88,26 +52,28 @@ CORBA_Current_ptr CORBA_Current::_unchecked_narrow ( ); } -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_ptr +CORBA_Current::_duplicate (CORBA_Current_ptr obj) { - CORBA_Current *tmp = ACE_static_cast (CORBA_Current*,x); - CORBA::release (tmp); + if (!CORBA::is_nil (obj)) + obj->_add_ref (); + return obj; } -CORBA::Boolean CORBA_Current::_is_a (const CORBA::Char *value, CORBA::Environment &ACE_TRY_ENV) +void *CORBA_Current::_tao_QueryInterface (ptr_arith_t type) { - if ( - (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/Current:1.0")) || - (!ACE_OS::strcmp ((char *)value, "IDL:omg.org/CORBA/Object:1.0"))) - return 1; // success using local knowledge - else - return this->CORBA_Object::_is_a (value, ACE_TRY_ENV); // remote call + void *retv = 0; + if (type == ACE_reinterpret_cast + (ptr_arith_t, + &CORBA_Current::_narrow)) + retv = ACE_reinterpret_cast (void*, this); + else if (type == ACE_reinterpret_cast (ptr_arith_t, &CORBA::Object::_narrow)) + retv = ACE_reinterpret_cast (void *, + ACE_static_cast (CORBA::Object_ptr, this)); + + if (retv) + this->_add_ref (); + return retv; } const char* CORBA_Current::_interface_repository_id (void) const @@ -115,54 +81,9 @@ const char* CORBA_Current::_interface_repository_id (void) const return "IDL:omg.org/CORBA/Current:1.0"; } -CORBA_Current_ptr (*_TAO_collocation_CORBA_Current_Stub_Factory_function_pointer) ( - CORBA::Object_ptr obj - ) = 0; -void operator<<= (CORBA::Any &_tao_any, CORBA::Current_ptr _tao_elem) -{ - TAO_OutputCDR stream; - if (stream << _tao_elem) - { - _tao_any._tao_replace ( - CORBA::_tc_Current, - TAO_ENCAP_BYTE_ORDER, - stream.begin () - ); - } -} - -CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Current_ptr &_tao_elem) -{ - 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 - { - return 0; - } - ACE_TRY_CHECK; - TAO_InputCDR stream ( - _tao_any._tao_get_cdr (), - _tao_any._tao_byte_order () - ); - if (stream >> _tao_elem) - { - ((CORBA::Any *)&_tao_any)->_tao_replace ( - CORBA::_tc_Current, - 1, - _tao_elem, - CORBA::Current::_tao_any_destructor - ); - return 1; - } - } - ACE_CATCHANY - { - _tao_elem = CORBA::Current::_nil (); - return 0; - } - ACE_ENDTRY; - _tao_elem = CORBA::Current::_nil (); - return 0; -} +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_GNU_REPO) + template class TAO_Object_Manager; + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + # pragma instantiate TAO_Object_Manager +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -- cgit v1.2.1