diff options
author | bala <balanatarajan@users.noreply.github.com> | 2003-10-25 00:19:32 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2003-10-25 00:19:32 +0000 |
commit | 51e1cd5dbe19e8950b55855ad1602a86750f915c (patch) | |
tree | 053c603b1746bb2356cf21c0c937daafc73dc2fe | |
parent | 8742e7b0eb5736bebfa36c0d7778078d66bf47f9 (diff) | |
download | ATCD-51e1cd5dbe19e8950b55855ad1602a86750f915c.tar.gz |
ChangeLogTag:Fri Oct 24 19:22:10 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog_ref | 8 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase_T.cpp | 78 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase_T.h | 53 |
3 files changed, 139 insertions, 0 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref index 67d173a2fb6..3a76d1ca7fa 100644 --- a/TAO/ChangeLog_ref +++ b/TAO/ChangeLog_ref @@ -1,3 +1,11 @@ +Fri Oct 24 19:22:10 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * tao/Valuetype/AbstractBase_T.h: + * tao/Valuetype/AbstractBase_T.cpp: + + New files that contain the implementation of _narrow () and + _unchecked_narrow (). + Fri Oct 24 19:18:13 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * tao/Any.cpp: diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp new file mode 100644 index 00000000000..97e62fb07c1 --- /dev/null +++ b/TAO/tao/Valuetype/AbstractBase_T.cpp @@ -0,0 +1,78 @@ +// $Id$ +#ifndef TAO_ABSTRACT_BASE_T_C +#define TAO_ABSTRACT_BASE_T_C + +#include "AbstractBase_T.h" +#include "AbstractBase.h" +#include "Stub.h" + +ACE_RCSID (Valuetype, + Abstractbase_T, + "$Id$") +namespace TAO +{ + template<typename T> T * + AbstractBase_Narrow_Utils<T>::narrow ( + CORBA::AbstractBase_ptr obj, + const char *repo_id, + Proxy_Broker_Factory pbf + ACE_ENV_ARG_DECL) + { + if (CORBA::AbstractBase::is_nil (obj)) + { + return T::_nil (); + } + + CORBA::Boolean is_it = + obj->_is_a ( + repo_id + ACE_ENV_ARG_PARAMETER + ); + ACE_CHECK_RETURN (T::_nil ()); + + if (is_it == 0) + { + return T::_nil (); + } + + return AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, + pbf); + } + + template<typename T> T * + AbstractBase_Narrow_Utils<T>::unchecked_narrow ( + CORBA::AbstractBase_ptr obj, + Proxy_Broker_Factory pbf) + { + if (CORBA::AbstractBase::is_nil (obj)) + { + return T::_nil (); + } + + T_ptr proxy = T::_nil (); + + if (obj->_is_objref ()) + { + TAO_Stub* stub = obj->_stubobj (); + + bool collocated = + !CORBA::is_nil (stub->servant_orb_var ().ptr ()) + && stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () + && obj->_is_collocated () + && pbf != 0; + + ACE_NEW_RETURN (proxy, + T (obj->_stubobj (), + collocated ? 1 : 0, + obj->_servant ()), + T::_nil ()); + } + else + { + proxy = T::_downcast (obj); + proxy->_add_ref (); + } + + return proxy; + } +} diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h new file mode 100644 index 00000000000..a628b987e58 --- /dev/null +++ b/TAO/tao/Valuetype/AbstractBase_T.h @@ -0,0 +1,53 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file AbstractBase_T.h + * + * $Id$ + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_ABSTRACTBASE_T_H +#define TAO_ABSTRACTBASE_T_H +#include /**/ "ace/pre.h" + +#include "tao/Object_T.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CORBA +{ + class AbstractBase; + typedef AbstractBase *AbstractBase_ptr; +} + +namespace TAO +{ + template<typename T> + class AbstractBase_Narrow_Utils + { + static T_ptr narrow (CORBA::AbstractBase_ptr, + const char *repo_id, + Proxy_Broker_Factory + ACE_ENV_ARG_DECL); + + static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, + Proxy_Broker_Factory); + }; +} + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "tao/Valetype/AbstractBase_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("AbstractBase_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +3endif /*TAO_ABSTRACTBASE_T_H*/ |