diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:11 +0000 |
commit | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch) | |
tree | da50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/tao/Valuetype | |
parent | 0e555b9150d38e3b3473ba325b56db2642e6352b (diff) | |
download | ATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tao/Valuetype')
33 files changed, 0 insertions, 4232 deletions
diff --git a/TAO/tao/Valuetype/AbstractBase.cpp b/TAO/tao/Valuetype/AbstractBase.cpp deleted file mode 100644 index 24e7347e7f0..00000000000 --- a/TAO/tao/Valuetype/AbstractBase.cpp +++ /dev/null @@ -1,436 +0,0 @@ -// "$Id$" - -#include "tao/Valuetype/AbstractBase.h" -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/ValueFactory.h" -#include "tao/Stub.h" -#include "tao/ORB_Core.h" -#include "tao/Profile.h" -#include "tao/debug.h" -#include "tao/CDR.h" - -#if !defined (__ACE_INLINE__) -# include "tao/Valuetype/AbstractBase.inl" -#endif /* ! __ACE_INLINE__ */ - -ACE_RCSID (Valuetype, - AbstractBase, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// ************************************************************ -// These are in CORBA namespace - -void -CORBA::release (CORBA::AbstractBase_ptr obj) -{ - if (obj) - { - obj->_remove_ref (); - } -} - -CORBA::Boolean -CORBA::is_nil (CORBA::AbstractBase_ptr obj) -{ - return (obj == 0); -} - -// ************************************************************ - -CORBA::AbstractBase::AbstractBase (void) - : is_objref_ (false) - , concrete_stubobj_ (0) - , is_collocated_ (false) - , servant_ (0) - , is_local_ (false) - , equivalent_obj_ (0) -{ -} - -CORBA::AbstractBase::AbstractBase (const CORBA::AbstractBase &rhs) - : is_objref_ (rhs.is_objref_) - , concrete_stubobj_ (rhs.concrete_stubobj_) - , is_collocated_ (rhs.is_collocated_) - , servant_ (rhs.servant_) - , is_local_ (rhs.is_local_) - , equivalent_obj_ (0) -{ - if (rhs.concrete_stubobj_ != 0) - { - rhs.concrete_stubobj_->_incr_refcnt (); - } - - if (!CORBA::is_nil (rhs.equivalent_obj_)) - { - this->equivalent_obj_ = - CORBA::Object::_duplicate (rhs.equivalent_obj_); - } -} - -CORBA::AbstractBase::AbstractBase (TAO_Stub * protocol_proxy, - CORBA::Boolean collocated, - TAO_Abstract_ServantBase * servant) - : is_objref_ (true) - , concrete_stubobj_ (protocol_proxy) - , is_collocated_ (collocated) - , servant_ (servant) - , is_local_ (protocol_proxy == 0 ? true : false) - , equivalent_obj_ (0) -{ - if (this->concrete_stubobj_ != 0) - { - TAO_Stub *stub = this->concrete_stubobj_; - - stub->_incr_refcnt (); - - this->equivalent_obj_ = - stub->orb_core ()->create_object (stub); - } - -} - -CORBA::AbstractBase::~AbstractBase (void) -{ - if (this->concrete_stubobj_ != 0) - { - this->concrete_stubobj_->_decr_refcnt (); - } -} - -CORBA::AbstractBase_ptr -CORBA::AbstractBase::_duplicate (CORBA::AbstractBase_ptr obj) -{ - if (obj) - { - obj->_add_ref (); - } - - if (!CORBA::is_nil (obj->equivalent_obj_.in ())) - { - obj->equivalent_obj_->_add_ref (); - } - - return obj; -} - -// These are non-pure virtual no-ops so we can instantiate the -// class in the CDR extraction operator. The actual management -// of the refcount will always be done in the derived class. -void -CORBA::AbstractBase::_add_ref (void) -{ -} - -void -CORBA::AbstractBase::_remove_ref (void) -{ -} - -void -CORBA::AbstractBase::_tao_any_destructor (void *x) -{ - CORBA::AbstractBase_ptr tmp = static_cast<CORBA::AbstractBase_ptr> (x); - ::CORBA::release (tmp); -} - -CORBA::Object_ptr -CORBA::AbstractBase::_to_object (void) -{ - if (!CORBA::is_nil (this->equivalent_obj_.in ())) - return CORBA::Object::_duplicate (this->equivalent_obj_.in ()); - - if (this->concrete_stubobj_ == 0) - { - return CORBA::Object::_nil (); - } - - TAO_ORB_Core *orb_core = this->concrete_stubobj_->orb_core (); - this->concrete_stubobj_->_incr_refcnt (); - - return orb_core->create_object (this->concrete_stubobj_); -} - -CORBA::ValueBase * -CORBA::AbstractBase::_to_value (void) -{ - if (this->is_objref_) - { - return 0; - } - - CORBA::ValueBase *retval = this->_tao_to_value (); - - if (retval != 0) - { - retval->_add_ref (); - } - - return retval; -} - -CORBA::Boolean -CORBA::AbstractBase::_is_a (const char *type_id - ACE_ENV_ARG_DECL_NOT_USED) -{ - return ! ACE_OS::strcmp (type_id, - "IDL:omg.org/CORBA/AbstractBase:1.0"); -} - -const char * -CORBA::AbstractBase::_interface_repository_id (void) const -{ - return "IDL:omg.org/CORBA/AbstractBase:1.0"; -} - -const char * -CORBA::AbstractBase::_tao_obv_repository_id (void) const -{ - return "IDL:omg.org/CORBA/AbstractBase:1.0"; -} - -CORBA::Boolean -operator<< (TAO_OutputCDR &strm, const CORBA::AbstractBase_ptr abs) -{ - CORBA::Boolean discriminator = true; - - // We marshal a null abstract interface ptr as a discriminator - // plus null object reference (see CORBA::Object::marshal() - // and operator << for CORBA::Object). - if (CORBA::is_nil (abs)) - { - // Marshal discriminator, then empty type hint. - strm << ACE_OutputCDR::from_boolean (discriminator); - strm.write_ulong (1); - strm.write_char ('\0'); - strm.write_ulong (0); - return (CORBA::Boolean) strm.good_bit (); - } - - if (abs->_is_objref ()) - { - if (strm << ACE_OutputCDR::from_boolean (discriminator)) - { - TAO_Stub *stubobj = abs->_stubobj (); - - if (stubobj == 0) - { - return false; - } - - // STRING, a type ID hint - if ((strm << stubobj->type_id.in ()) == 0) - { - return false; - } - - const TAO_MProfile& mprofile = stubobj->base_profiles (); - - CORBA::ULong const profile_count = mprofile.profile_count (); - - if ((strm << profile_count) == 0) - { - return false; - } - - // @@ The MProfile should be locked during this iteration, is there - // anyway to achieve that? - for (CORBA::ULong i = 0; i < profile_count; ++i) - { - const TAO_Profile *p = mprofile.get_profile (i); - - if (p->encode (strm) == 0) - { - return false; - } - } - - return (CORBA::Boolean) strm.good_bit (); - } - } - else - { - discriminator = false; - - if (strm << ACE_OutputCDR::from_boolean (discriminator)) - { - CORBA::Boolean retval = true; - - CORBA::ULong value_tag = TAO_OBV_GIOP_Flags::Value_tag_base - | TAO_OBV_GIOP_Flags::Type_info_single; - - retval = strm.write_ulong (value_tag); - - if (retval == 0) - { - return retval; - } - - retval = strm << abs->_tao_obv_repository_id (); - - if (retval == 0) - { - return retval; - } - - return abs->_tao_marshal_v (strm); - } - } - - return false; -} - -CORBA::Boolean -operator>> (TAO_InputCDR &strm, CORBA::AbstractBase_ptr &abs) -{ - abs = 0; - CORBA::Boolean discriminator = false; - ACE_InputCDR::to_boolean tb (discriminator); - TAO_ORB_Core *orb_core = 0; - - if (strm >> tb) - { - if (discriminator == 0) - { - CORBA::ULong value_tag; - - if (!strm.read_ulong (value_tag)) - { - return false; - } - - if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag)) - { - // Ok, null reference unmarshaled. - return true; - } - - if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag)) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("operator>> CORBA::AbstractBase ") - ACE_TEXT ("not value_tag\n"))); - return false; - } - - CORBA::String_var repo_id_stream; - - // It would be more efficient not to copy the string) - if (strm.read_string (repo_id_stream.inout ()) == 0) - { - return false; - } - - orb_core = strm.orb_core (); - - if (orb_core == 0) - { - orb_core = TAO_ORB_Core_instance (); - - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_WARNING, - "TAO (%P|%t) WARNING: extracting " - "valuetype using default ORB_Core\n")); - } - } - - CORBA::ValueFactory_var factory = - orb_core->orb ()->lookup_value_factory (repo_id_stream.in ()); - - // We should throw an exception, if there were an appropriate one. - if (factory.in() == 0) - { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%N:%l): The following unknown type was received: `%s'."), - repo_id_stream.in ())); - return false; - } - - abs = factory->create_for_unmarshal_abstract (); - - return abs->_tao_unmarshal_v (strm); - } - else - { - CORBA::Object_var generic_objref; - - if (strm >> generic_objref.inout ()) - { - TAO_Stub *concrete_stubobj = generic_objref->_stubobj (); - - CORBA::Boolean const stores_orb = - ! CORBA::is_nil (concrete_stubobj->servant_orb_var ().in ()); - - if (stores_orb) - { - orb_core = - concrete_stubobj->servant_orb_var ()->orb_core (); - } - - CORBA::Boolean const collocated = - orb_core != 0 - && orb_core->optimize_collocation_objects () - && generic_objref->_is_collocated (); - - ACE_NEW_RETURN (abs, - CORBA::AbstractBase ( - concrete_stubobj, - collocated, - generic_objref->_servant ()), - false); - return true; - } - } - } - - return false; -} - -CORBA::Boolean -CORBA::AbstractBase::_tao_marshal_v (TAO_OutputCDR &) const -{ - return false; -} - -CORBA::Boolean -CORBA::AbstractBase::_tao_unmarshal_v (TAO_InputCDR &) -{ - return false; -} - -CORBA::Boolean -CORBA::AbstractBase::_tao_match_formal_type (ptrdiff_t ) const -{ - return false; -} - -CORBA::ValueBase * -CORBA::AbstractBase::_tao_to_value (void) -{ - return 0; -} - -CORBA::Object_ptr -CORBA::AbstractBase::equivalent_objref (void) -{ - if (CORBA::is_nil (this->equivalent_obj_.in ())) - { - if (this->concrete_stubobj_ != 0) - { - TAO_ORB_Core *orb_core = - this->concrete_stubobj_->orb_core (); - - this->concrete_stubobj_->_incr_refcnt (); - - this->equivalent_obj_ = - orb_core->create_object (this->concrete_stubobj_); - } - } - - return this->equivalent_obj_.in (); -} - - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h deleted file mode 100644 index 11e33d0419c..00000000000 --- a/TAO/tao/Valuetype/AbstractBase.h +++ /dev/null @@ -1,180 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file AbstractBase.h - * - * $Id$ - * - * @author Jeff Parsons <parsons@cs.wust.edu> - */ -//============================================================================= - -#ifndef TAO_ABSTRACTBASE_H -#define TAO_ABSTRACTBASE_H - -#include /**/ "ace/pre.h" - -#include "tao/Valuetype/valuetype_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Valuetype/Value_CORBA_methods.h" -#include "tao/Object_Argument_T.h" -#include "tao/Arg_Traits_T.h" -#include "tao/Objref_VarOut_T.h" -#include "tao/Object.h" /* For CORBA::Object_var */ -#include "tao/Pseudo_VarOut_T.h" -#include "ace/CORBA_macros.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_Stub; -class TAO_Abstract_ServantBase; - -#if defined (TAO_EXPORT_MACRO) -#undef TAO_EXPORT_MACRO -#endif -#define TAO_EXPORT_MACRO TAO_Valuetype_Export - -namespace CORBA -{ - class ValueBase; - - typedef TAO_Pseudo_Var_T<AbstractBase> AbstractBase_var; - typedef TAO_Pseudo_Out_T<AbstractBase> AbstractBase_out; - - /** - * @class AbstractBase - * - * @brief Abstract base class for Interfaces and Valuetypes - * - * Allows the determination of whether an object has been passed by - * reference or by value to be deferred until runtime. - */ - class TAO_Valuetype_Export AbstractBase - { - public: - - /// Constructor. - /** - * This constructor is only meant to be called by the - * corresponding CDR stream extraction operator. - */ - AbstractBase (TAO_Stub *p, - CORBA::Boolean collocated, - TAO_Abstract_ServantBase *servant); - - typedef CORBA::AbstractBase_ptr _ptr_type; - typedef CORBA::AbstractBase_var _var_type; - typedef CORBA::AbstractBase_out _out_type; - - static CORBA::AbstractBase_ptr _narrow (CORBA::AbstractBase_ptr obj - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - - static CORBA::AbstractBase_ptr _duplicate (CORBA::AbstractBase_ptr obj); - static CORBA::AbstractBase_ptr _nil (void); - - /// Used in the implementation of CORBA::Any - static void _tao_any_destructor (void*); - - /// Spec required conversion operations - CORBA::Object_ptr _to_object (void); - CORBA::ValueBase *_to_value (void); - - virtual CORBA::Boolean _is_a (const char *type_id - ACE_ENV_ARG_DECL_WITH_DEFAULTS); - virtual const char* _interface_repository_id (void) const; - - /// TAO specific operation - virtual const char* _tao_obv_repository_id (void) const; - virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &strm) const; - virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &strm); - virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const; - - /// Memmory management operations - virtual void _add_ref (void); - virtual void _remove_ref (void); - - CORBA::Boolean _is_objref (void) const; - - /// Return the stub object - TAO_Stub *_stubobj (void) const; - - /// Acessors - CORBA::Boolean _is_collocated (void) const; - TAO_Abstract_ServantBase *_servant (void) const; - CORBA::Boolean _is_local (void) const; - - /// Return the equivalent object reference. - /** - * The object is not refcounted. The caler should not put this in - * a var or some such thing. The memory is owned by <this> - * object. - */ - CORBA::Object_ptr equivalent_objref (void); - - protected: - - AbstractBase (void); - AbstractBase (const AbstractBase &); - - virtual ~AbstractBase (void); - - protected: - - CORBA::Boolean is_objref_; - - private: - - AbstractBase & operator= (const AbstractBase &); - - virtual CORBA::ValueBase *_tao_to_value (void); - - private: - - TAO_Stub *concrete_stubobj_; - CORBA::Boolean is_collocated_; - TAO_Abstract_ServantBase *servant_; - CORBA::Boolean is_local_; - - /// Our equivalent CORBA::Object version - /// @todo We may at some point of time should probably cache a - /// version of CORBA::ValueBase - CORBA::Object_var equivalent_obj_; - }; -} - -TAO_Valuetype_Export CORBA::Boolean -operator<< (TAO_OutputCDR &, const CORBA::AbstractBase_ptr); - -TAO_Valuetype_Export CORBA::Boolean -operator>> (TAO_InputCDR &, CORBA::AbstractBase_ptr &); - -/// Used in generated code if CORBA::AbstractBase is an argument or return type. -namespace TAO -{ - template<> - class TAO_Valuetype_Export Arg_Traits<CORBA::AbstractBase> - : public Object_Arg_Traits_T< - CORBA::AbstractBase_ptr, - CORBA::AbstractBase_var, - CORBA::AbstractBase_out, - TAO::Objref_Traits<CORBA::AbstractBase>, - TAO::Any_Insert_Policy_Stream <CORBA::AbstractBase_ptr> - > - { - }; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "tao/Valuetype/AbstractBase.inl" -#endif /* __ACE_INLINE__) */ - -#include /**/ "ace/post.h" - -#endif /* TAO_ABSTRACTBASE_H */ diff --git a/TAO/tao/Valuetype/AbstractBase.inl b/TAO/tao/Valuetype/AbstractBase.inl deleted file mode 100644 index f3d4dfb60e6..00000000000 --- a/TAO/tao/Valuetype/AbstractBase.inl +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/OS_NS_string.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE -CORBA::AbstractBase_ptr -CORBA::AbstractBase::_nil (void) -{ - return static_cast <CORBA::AbstractBase_ptr> (0); -} - -ACE_INLINE CORBA::AbstractBase_ptr -CORBA::AbstractBase::_narrow (CORBA::AbstractBase_ptr obj - ACE_ENV_ARG_DECL_NOT_USED) -{ - return CORBA::AbstractBase::_duplicate (obj); -} - -ACE_INLINE -CORBA::Boolean -CORBA::AbstractBase::_is_objref (void) const -{ - return this->is_objref_; -} - -ACE_INLINE -TAO_Stub * -CORBA::AbstractBase::_stubobj (void) const -{ - return this->concrete_stubobj_; -} - -ACE_INLINE -CORBA::Boolean -CORBA::AbstractBase::_is_collocated (void) const -{ - return this->is_collocated_; -} - -ACE_INLINE -TAO_Abstract_ServantBase * -CORBA::AbstractBase::_servant (void) const -{ - return this->servant_; -} - -ACE_INLINE -CORBA::Boolean -CORBA::AbstractBase::_is_local (void) const -{ - return this->is_local_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp deleted file mode 100644 index a0212ddde94..00000000000 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//$Id$ -#include "tao/Valuetype/AbstractBase_Invocation_Adapter.h" -#include "tao/Valuetype/AbstractBase.h" - -ACE_RCSID (Valuetype, - AbstractBase_Invocation_Adapter, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ - AbstractBase_Invocation_Adapter::AbstractBase_Invocation_Adapter ( - CORBA::AbstractBase_ptr target, - Argument **args, - int arg_number, - const char *operation, - size_t op_len, - Collocation_Proxy_Broker *p, - Invocation_Type type, - Invocation_Mode mode) - : Invocation_Adapter (target->equivalent_objref (), - args, - arg_number, - operation, - op_len, - p, - type, - mode) - { - } -} // End namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h b/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h deleted file mode 100644 index afac495a54f..00000000000 --- a/TAO/tao/Valuetype/AbstractBase_Invocation_Adapter.h +++ /dev/null @@ -1,74 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file AbstractBase_Invocation_Adapter.h - * - * $Id$ - * - * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> - */ -//============================================================================= -#ifndef TAO_ABSTRACTBASE_INVOCATION_ADAPTER_H -#define TAO_ABSTRACTBASE_INVOCATION_ADAPTER_H - -#include /**/ "ace/pre.h" -#include "tao/Valuetype/valuetype_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Invocation_Adapter.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace CORBA -{ - class AbstractBase; - - typedef AbstractBase *AbstractBase_ptr; -} -namespace TAO -{ - class Argument; - - class Collocation_Proxy_Broker; - class Profile_Transport_Resolver; - - /** - * @class AbstractBase_Invocation_Adapter - * - * - */ - class TAO_Valuetype_Export AbstractBase_Invocation_Adapter - : public Invocation_Adapter - { - public: - AbstractBase_Invocation_Adapter ( - CORBA::AbstractBase_ptr target, - Argument **args, - int arg_number, - const char *operation, - size_t op_len, - Collocation_Proxy_Broker *cpb, - TAO::Invocation_Type type = TAO_TWOWAY_INVOCATION, - TAO::Invocation_Mode mode = TAO_SYNCHRONOUS_INVOCATION); - - private: - // Don't allow default initializations - AbstractBase_Invocation_Adapter (void); - - // Disallow copying and assignment. - AbstractBase_Invocation_Adapter (const AbstractBase_Invocation_Adapter &); - AbstractBase_Invocation_Adapter & operator= ( - const AbstractBase_Invocation_Adapter &); - - }; -} // End namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_INVOCATION_ADAPTER_H */ diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp deleted file mode 100644 index ff9f03fa562..00000000000 --- a/TAO/tao/Valuetype/AbstractBase_T.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// $Id$ - -#ifndef TAO_ABSTRACT_BASE_T_CPP -#define TAO_ABSTRACT_BASE_T_CPP - -#include "tao/Valuetype/AbstractBase_T.h" -#include "tao/Valuetype/AbstractBase.h" -#include "tao/Stub.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -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::is_nil (obj)) - { - return T::_nil (); - } - - CORBA::Boolean const is_it = - obj->_is_a ( - repo_id - ACE_ENV_ARG_PARAMETER - ); - ACE_CHECK_RETURN (T::_nil ()); - - if (is_it == false) - { - return T::_nil (); - } - - return - AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, - repo_id, - pbf - ACE_ENV_ARG_PARAMETER); - } - - template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - Proxy_Broker_Factory pbf) - { - T *proxy = 0; - - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY - { - proxy = - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - obj, - 0, - pbf - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - } - ACE_CATCHANY - { - // Consume and return proxy - return proxy; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (proxy); - - return proxy; - } - - template<typename T> T * - AbstractBase_Narrow_Utils<T>::unchecked_narrow ( - CORBA::AbstractBase_ptr obj, - const char *, - Proxy_Broker_Factory pbf - ACE_ENV_ARG_DECL) - { - if (CORBA::is_nil (obj)) - { - return T::_nil (); - } - - T_ptr proxy = T::_nil (); - - if (obj->_is_objref ()) - { - TAO_Stub* stub = obj->_stubobj (); - - bool const collocated = - !CORBA::is_nil (stub->servant_orb_var ().in ()) - && stub->optimize_collocation_objects () - && obj->_is_collocated () - && pbf != 0; - - ACE_NEW_THROW_EX (proxy, - T (obj->_stubobj (), - collocated ? 1 : 0, - obj->_servant ()), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (proxy); - } - else - { - proxy = dynamic_cast<T *> (obj); - proxy->_add_ref (); - } - - return proxy; - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* TAO_ABSTRACT_BASE_T_CPP */ diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h deleted file mode 100644 index dced03cf334..00000000000 --- a/TAO/tao/Valuetype/AbstractBase_T.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- 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 */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace CORBA -{ - class AbstractBase; - typedef AbstractBase *AbstractBase_ptr; -} - -namespace TAO -{ - template<typename T> - class AbstractBase_Narrow_Utils - { - public: - typedef T *T_ptr; - - 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); - - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - const char *repo_id, - Proxy_Broker_Factory - ACE_ENV_ARG_DECL); - }; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Valuetype/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" -#endif /*TAO_ABSTRACTBASE_T_H*/ diff --git a/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h b/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h deleted file mode 100644 index 321fa834aba..00000000000 --- a/TAO/tao/Valuetype/Bounded_Valuetype_Allocation_Traits_T.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef guard_bounded_valuetype_allocation_traits_hpp -#define guard_bounded_valuetype_allocation_traits_hpp -/** - * @file - * - * @brief Details can be found in the documentation for - * TAO::details::generic_sequence - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#include "tao/Basic_Types.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ -namespace details -{ - -template<typename T, class ref_traits, CORBA::ULong MAX, bool dummy> -struct bounded_valuetype_allocation_traits -{ - typedef T value_type; - typedef ref_traits valuetype_traits; - - inline static CORBA::ULong default_maximum() - { - return MAX; - } - - inline static value_type * default_buffer_allocation() - { - return allocbuf(MAX); - } - - inline static value_type * allocbuf(CORBA::ULong /* maximum */) - { - value_type * buffer = new value_type[MAX]; - // no throw - valuetype_traits::zero_range(buffer, buffer + MAX); - - return buffer; - } - - inline static void freebuf(value_type * buffer) - { - valuetype_traits::release_range(buffer, buffer + MAX); - delete[] buffer; - } - - inline static CORBA::ULong maximum() - { - return MAX; - } -}; - -} // namespace details -} // namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // guard_bounded_valuetype_allocation_traits_hpp diff --git a/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h deleted file mode 100644 index ef96347f10e..00000000000 --- a/TAO/tao/Valuetype/Bounded_Valuetype_Sequence_T.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef guard_bounded_valuetype_sequence_hpp -#define guard_bounded_valuetype_sequence_hpp -/** - * @file - * - * @brief Implement bounded sequences for object references. - * - * $Id$ - * - * @author Carlos O'Ryan - */ -#include "Bounded_Valuetype_Allocation_Traits_T.h" -#include "Valuetype_Traits_T.h" -#include "tao/Generic_Sequence_T.h" -#include "Valuetype_Sequence_Element_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ - -template<typename object_t, typename object_t_var, CORBA::ULong MAX> -class bounded_valuetype_sequence -{ -public: - typedef object_t object_type; - typedef object_type * value_type; - typedef value_type const const_value_type; - typedef object_t_var object_type_var; - - typedef details::valuetype_traits<object_type,object_type_var,true> element_traits; - typedef details::bounded_reference_allocation_traits<value_type,element_traits,MAX,true> allocation_traits; - - typedef details::valuetype_sequence_element<element_traits> element_type; - typedef element_type subscript_type; - typedef value_type const & const_subscript_type; - - typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; - - inline bounded_valuetype_sequence() - : impl_() - {} - inline bounded_valuetype_sequence( - CORBA::ULong length, - value_type * data, - CORBA::Boolean release) - : impl_(MAX, length, data, release) - {} - - /* Use default ctor, operator= and dtor */ - inline CORBA::ULong maximum() const { - return impl_.maximum(); - } - inline CORBA::Boolean release() const { - return impl_.release(); - } - inline CORBA::ULong length() const { - return impl_.length(); - } - - inline void length(CORBA::ULong length) { - implementation_type::range::check_length(length, MAX); - impl_.length(length); - } - inline value_type const & operator[](CORBA::ULong i) const { - return impl_[i]; - } - inline element_type operator[](CORBA::ULong i) { - return element_type(impl_[i], release()); - } - inline value_type const * get_buffer() const { - return impl_.get_buffer(); - } - inline void replace( - CORBA::ULong length, - value_type * data, - CORBA::Boolean release = false) { - impl_.replace(MAX, length, data, release); - } - inline value_type * get_buffer(CORBA::Boolean orphan = false) { - return impl_.get_buffer(orphan); - } - inline void swap(bounded_valuetype_sequence & rhs) throw() { - impl_.swap(rhs.impl_); - } - - static value_type * allocbuf(CORBA::ULong maximum) - { - return implementation_type::allocbuf(maximum); - } - static void freebuf(value_type * buffer) - { - implementation_type::freebuf(buffer); - } - - -private: - implementation_type impl_; -}; - - - template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX> - bool marshal_sequence(stream & strm, const TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> & source) { - typedef typename TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX>::object_type seq_object_t; - const ::CORBA::ULong length = source.length (); - if (!(strm << length)) { - return false; - } - for(CORBA::ULong i = 0; i < length; ++i) { - if (!TAO::Objref_Traits<seq_object_t>::marshal (source[i], strm)) { - return false; - } - } - return true; - } - - template <typename stream, typename object_t, typename object_t_var, CORBA::ULong MAX> - bool demarshal_sequence(stream & strm, TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> & target) { - typedef TAO::bounded_valuetype_sequence<object_t, object_t_var, MAX> sequence; - ::CORBA::ULong new_length = 0; - if (!(strm >> new_length)) { - return false; - } - if ((new_length > strm.length()) || (new_length > target.maximum ())) { - return false; - } - sequence tmp; - tmp.length(new_length); - typename sequence::value_type * buffer = tmp.get_buffer(); - for(CORBA::ULong i = 0; i < new_length; ++i) { - if (!(strm >> buffer[i])) { - return false; - } - } - tmp.swap(target); - return true; - } - -} // namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - - -#endif // guard_bounded_valuetype_sequence_hpp diff --git a/TAO/tao/Valuetype/Sequence_T.h b/TAO/tao/Valuetype/Sequence_T.h deleted file mode 100644 index db9c2c48aa2..00000000000 --- a/TAO/tao/Valuetype/Sequence_T.h +++ /dev/null @@ -1,6 +0,0 @@ -// $Id$ -// - -#include "tao/Valuetype/Bounded_Valuetype_Sequence_T.h" -#include "tao/Valuetype/Unbounded_Valuetype_Sequence_T.h" - diff --git a/TAO/tao/Valuetype/StringValue.pidl b/TAO/tao/Valuetype/StringValue.pidl deleted file mode 100644 index fd31cd3a930..00000000000 --- a/TAO/tao/Valuetype/StringValue.pidl +++ /dev/null @@ -1,23 +0,0 @@ -// -*- IDL -*- -// -// $Id$ - -// ================================================================ -// Standard Value Box Definitions -// as specified in OMG document formal/01-12-35 -// ================================================================ - - -#ifndef TAO_CORBA_STRING_VALUE_IDL -#define TAO_CORBA_STRING_VALUE_IDL - -#pragma prefix "omg.org" - -module CORBA -{ - valuetype StringValue string; - valuetype WStringValue wstring; - -}; - -#endif /* TAO_CORBA_STRING_VALUE_IDL */ diff --git a/TAO/tao/Valuetype/TAO_Valuetype.pc.in b/TAO/tao/Valuetype/TAO_Valuetype.pc.in deleted file mode 100644 index 2358de06bdd..00000000000 --- a/TAO/tao/Valuetype/TAO_Valuetype.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: TAO_Valuetype -Description: TAO Valuetype Library -Requires: TAO_AnyTypeCode, TAO -Version: @VERSION@ -Libs: -L${libdir} -lTAO_Valuetype -Cflags: -I${includedir} diff --git a/TAO/tao/Valuetype/TAO_Valuetype.rc b/TAO/tao/Valuetype/TAO_Valuetype.rc deleted file mode 100644 index fe7afb3c6f9..00000000000 --- a/TAO/tao/Valuetype/TAO_Valuetype.rc +++ /dev/null @@ -1,30 +0,0 @@ -#include "..\Version.h" - -1 VERSIONINFO - FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 - PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 - FILEFLAGSMASK 0x3fL - FILEFLAGS 0x0L - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "FileDescription", "Valuetype\0" - VALUE "FileVersion", TAO_VERSION "\0" - VALUE "InternalName", "TAO_ValuetypeDLL\0" - VALUE "LegalCopyright", "\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "TAO_Valuetype.DLL\0" - VALUE "ProductName", "TAO\0" - VALUE "ProductVersion", TAO_VERSION "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h b/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h deleted file mode 100644 index d407e683109..00000000000 --- a/TAO/tao/Valuetype/Unbounded_Valuetype_Allocation_Traits_T.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef guard_unbounded_valuetype_allocation_traits_hpp -#define guard_unbounded_valuetype_allocation_traits_hpp -/** - * @file - * - * @brief Details can be found in the documentation for - * TAO::details::generic_sequence - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#include "tao/Basic_Types.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ -namespace details -{ - -template<typename T, class ref_traits, bool dummy> -struct unbounded_valuetype_allocation_traits -{ - typedef T value_type; - typedef ref_traits valuetype_traits; - - inline static CORBA::ULong default_maximum() - { - return 0; - } - - inline static value_type * default_buffer_allocation() - { - return 0; - } - - inline static value_type * allocbuf(CORBA::ULong maximum) - { - value_type * buffer = new value_type[maximum + 1]; - reinterpret_cast<value_type**>(buffer)[0] = buffer + maximum + 1; - - // no throw - valuetype_traits::zero_range(buffer + 1, buffer + maximum + 1); - - return buffer + 1; - } - - inline static void freebuf(value_type * buffer) - { - if(buffer != 0) - { - value_type * begin = buffer - 1; - value_type * end = reinterpret_cast<value_type*>(*begin); - valuetype_traits::release_range(buffer, end); - - buffer = begin; - } - delete[] buffer; - } -}; - -} // namespace details -} // namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // guard_unbounded_valuetype_allocation_traits_hpp diff --git a/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h b/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h deleted file mode 100644 index 9695f8c940e..00000000000 --- a/TAO/tao/Valuetype/Unbounded_Valuetype_Sequence_T.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifndef guard_unbounded_valuetype_sequence_hpp -#define guard_unbounded_valuetype_sequence_hpp -/** - * @file - * - * @brief Implement unbounded sequences for value types. - * - * $Id$ - * - * @author Carlos O'Ryan - */ -#include "Unbounded_Valuetype_Allocation_Traits_T.h" -#include "Valuetype_Traits_T.h" -#include "tao/Generic_Sequence_T.h" -#include "Valuetype_Sequence_Element_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ - -template<typename object_t, typename object_t_var> -class unbounded_valuetype_sequence -{ -public: - typedef object_t object_type; - typedef object_type * value_type; - typedef value_type const const_value_type; - - typedef details::valuetype_traits<object_type,object_t_var,true> element_traits; - typedef details::unbounded_reference_allocation_traits<value_type,element_traits,true> allocation_traits; - - typedef details::valuetype_sequence_element<element_traits> element_type; - typedef element_type subscript_type; - typedef value_type const & const_subscript_type; - - typedef details::generic_sequence<value_type, allocation_traits, element_traits> implementation_type; - - inline unbounded_valuetype_sequence() - : impl_() - {} - inline explicit unbounded_valuetype_sequence(CORBA::ULong maximum) - : impl_(maximum) - {} - inline unbounded_valuetype_sequence( - CORBA::ULong maximum, - CORBA::ULong length, - value_type * data, - CORBA::Boolean release) - : impl_(maximum, length, data, release) - {} - - /* Use default ctor, operator= and dtor */ - inline CORBA::ULong maximum() const { - return impl_.maximum(); - } - inline CORBA::Boolean release() const { - return impl_.release(); - } - inline CORBA::ULong length() const { - return impl_.length(); - } - - inline void length(CORBA::ULong length) { - impl_.length(length); - } - inline value_type const & operator[](CORBA::ULong i) const { - return impl_[i]; - } - inline element_type operator[](CORBA::ULong i) { - return element_type(impl_[i], release()); - } - inline value_type const * get_buffer() const { - return impl_.get_buffer(); - } - inline void replace( - CORBA::ULong maximum, - CORBA::ULong length, - value_type * data, - CORBA::Boolean release = false) { - impl_.replace(maximum, length, data, release); - } - inline value_type * get_buffer(CORBA::Boolean orphan = false) { - return impl_.get_buffer(orphan); - } - inline void swap(unbounded_valuetype_sequence & rhs) throw() { - impl_.swap(rhs.impl_); - } - - static value_type * allocbuf(CORBA::ULong maximum) - { - return implementation_type::allocbuf(maximum); - } - static void freebuf(value_type * buffer) - { - implementation_type::freebuf(buffer); - } - - -private: - implementation_type impl_; -}; - - template <typename stream, typename object_t, typename object_t_var> - bool marshal_sequence(stream & strm, const TAO::unbounded_valuetype_sequence<object_t, object_t_var> & source) { - ::CORBA::ULong const length = source.length (); - if (!(strm << length)) { - return false; - } - for(CORBA::ULong i = 0; i < length; ++i) { - if (!(strm << source[i])) { - return false; - } - } - return true; - } - - template <typename stream, typename object_t, typename object_t_var> - bool demarshal_sequence(stream & strm, TAO::unbounded_valuetype_sequence <object_t, object_t_var> & target) { - typedef typename TAO::unbounded_valuetype_sequence <object_t, object_t_var> sequence; - ::CORBA::ULong new_length = 0; - if (!(strm >> new_length)) { - return false; - } - if (new_length > strm.length()) { - return false; - } - sequence tmp(new_length); - tmp.length(new_length); - typename sequence::value_type * buffer = tmp.get_buffer(); - for(CORBA::ULong i = 0; i < new_length; ++i) { - if (!(strm >> buffer[i])) { - return false; - } - } - tmp.swap(target); - return true; - } - -} // namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - - -#endif // guard_unbounded_valuetype_sequence_hpp diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp deleted file mode 100644 index dce7528a6f6..00000000000 --- a/TAO/tao/Valuetype/ValueBase.cpp +++ /dev/null @@ -1,918 +0,0 @@ -// $Id$ - -#include "tao/AnyTypeCode/Null_RefCount_Policy.h" -#include "tao/AnyTypeCode/Alias_TypeCode_Static.h" -#include "tao/AnyTypeCode/Value_TypeCode_Static.h" -#include "tao/AnyTypeCode/TypeCode_Constants.h" - -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/ValueFactory.h" - -#include "tao/CDR.h" -#include "tao/ORB.h" -#include "tao/ORB_Core.h" -#include "tao/debug.h" -#include "ace/OS_NS_string.h" -#include "ace/CORBA_macros.h" - -#if !defined (__ACE_INLINE__) -# include "tao/Valuetype/ValueBase.inl" -#endif /* ! __ACE_INLINE__ */ - - -ACE_RCSID (Valuetype, - ValueBase, - "$Id$") - - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// Static operations in namespace CORBA. - -void -CORBA::add_ref (CORBA::ValueBase *val) -{ - if (val) - { - val->_add_ref (); - } -} - -void -CORBA::remove_ref (CORBA::ValueBase *val) -{ - if (val) - { - val->_remove_ref (); - } -} - -// *********************************************************************** - -TAO_ChunkInfo::TAO_ChunkInfo(CORBA::Boolean do_chunking, - CORBA::Long init_level) - : chunking_(do_chunking), - value_nesting_level_(init_level), - chunk_size_pos_ (0), - length_to_chunk_octets_pos_ (0), - chunk_octets_end_pos_ (0) -{ -} - -CORBA::ValueBase::ValueBase (void) - : is_truncatable_(0), - chunking_(0) -{ -} - -CORBA::ValueBase::ValueBase (const ValueBase& val) - : is_truncatable_(val.is_truncatable_), - chunking_(val.chunking_) -{ -} - -CORBA::ValueBase::~ValueBase (void) -{ -} - -CORBA::ValueBase* -CORBA::ValueBase::_downcast (CORBA::ValueBase *vt) -{ - // Every vt is a CORBA::ValueBase :-). - return vt; -} - -void -CORBA::ValueBase::_tao_any_destructor (void *x) -{ - CORBA::ValueBase *tmp = static_cast<CORBA::ValueBase *> (x); - CORBA::remove_ref (tmp); -} - -// OBV marshaling in principle: -// _tao_marshal () is called from the CDR operator<< () -// to marshal a valuetype. To marshal the state -// it calls (virtual) _tao_marshal_v () (IDL generated) on itself -// which 'jumps' to the most derived valuetype class. This function -// further calls (inline) _tao_marshal_state, which is generated from -// IDL too and does the marshaling of state members and base classes -// (before, if any) actually. -// Fragmentation (chunking) needs some cooperation with the CDR stream. -// It needs to keep track of the state we're in: -// (outside chunk, beginning of chunk - no data, inside chunk and -// the nesting level of valuetypes. (The chunks itself are not nested.)) - -// (see CORBA 2.3 GIOP 15.3.4) - -// %! yet much to do ... look for +++ ! - - - // 1. Is 'this' yet marshalled ? (->1a) - // If not then mark 'this' as marshalled. (->2) +++ - // Or is it null ? (write null_ref and return ok) - // 1a. Put indirection and return successfull. - - // 2. if (chunking) and we are in a chunk (look in strm), - // end the chunk by writing its length at its start. - // This is the responsibility of the CDR stream. - // But if nothing is writtern in this chunk yet, - // we want to overwrite the place of the dummy blocksize-tag - // with our <value-tag>. - // Increase the nesting level of valuetypes. - - // 3. Build <value-tag>, which states if chunking is used - // and if type information ((list of) repository id(s)) - // is provided. The latter is necessary if the formal_type_id - // is unequal the 'true derived' type of this object. - - // 4. Marshal type information. - - // 5. if (chunking) let room for a blocksize-tag. (i.e. write Long) - - // 6. Now marshal state members. (%! Problem when state is empty - // and chunked encoding is used.) - - // 7. if (chunking) let strm overwrite the last blocksize tag - // with its concrete value. - - // 8. if (chunking) write an end tag, or (optimization) let the CDR - // care for collecting all end tags of nested values (e.g. linked - // list), so that only one end tag at all must be written. - -CORBA::Boolean -CORBA::ValueBase::_tao_marshal (TAO_OutputCDR &strm, - const CORBA::ValueBase *this_, - ptrdiff_t formal_type_id) -{ - if ( ! write_special_value (strm, this_)) - { - return write_value (strm, this_, formal_type_id); - } - - return true; -} - - -CORBA::Boolean -CORBA::ValueBase::_tao_unmarshal (TAO_InputCDR &strm, - CORBA::ValueBase *&new_object) -{ - // This is for the special case only that one unmarshals in order - // to assign the newly created object directly to a ValueBase pointer. - // Implementation is like a specialized one (in TC.cpp, if T.idl is source). - // basically do: - // ValueBase::_tao_unmarshal_pre () - // (Gets factory or possible a null or an existing object. - // Then the job is done. On an existing (backreferenced) object - // do a cast and a type check) - // new_object = factory->create_for_unmarshal () - // (with apropriate cast) - // new_object->_tao_unmarshal_v () - // new_object->_tao_unmarshal_post () - - CORBA::Boolean const retval = - CORBA::ValueBase::_tao_unmarshal_pre (strm, - new_object, - 0); - - if (!retval) - { - return false; - } - - if (new_object != 0) - { - if (!new_object->_tao_unmarshal_v (strm)) - return false; - } - - return retval; -} - - -CORBA::Boolean -CORBA::ValueBase::_tao_unmarshal_pre (TAO_InputCDR &strm, - CORBA::ValueBase *&valuetype, - const char * const repo_id) -{ - // Value factories are reference counted, when we get a new value factory - // from the ORB, its reference count is increased. - CORBA::ValueFactory_var factory; - - // %! yet much to do ... look for +++ ! - - // 1. Get the <value-tag> (else it may be <indirection-tag> or <null-ref>). - // Is object yet unmarshalled (<indirection-tag> is set) ? (->1a) - // Is <null-ref> given ? Set 0 and return ok. - // 1a. Lookup the real address in memory, which should be aligned +++ - // to CORBA::ValueBase. Its possible at this point that worse - // type mismatch gets by undetected, if the CDR stream fakes. - // So the type should be checked ... +++ - - // 2. Now at this point it must be a <value-tag> (error else). - // if (chunking) check that any last chunk ends with matching - // size. If not raise marshal exception. - // Increase the nesting level of valuetypes. - - // 3. if (chunking) read and record the blocksize-tag. - - // 4. Unmarshal type information and lookup factory. - // If no type information is given in the CDR encoding, as told - // from the <value-tag>, then use the repository id parameter - // (it _must_ be right). - - CORBA::Long valuetag; - Repository_Id_List ids; - - if (! strm.read_long(valuetag)) - return false; - - if (TAO_OBV_GIOP_Flags::is_indirection_tag (valuetag)) - { - //@@TODO: read indirection value. - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO does not currently support valuetype indirecton\n"))); - return false; - } - else if (TAO_OBV_GIOP_Flags::is_null_ref (valuetag)) - { - // null reference is unmarshalled. - valuetype = 0; - return true; - } - else if (TAO_OBV_GIOP_Flags::has_single_type_info (valuetag)) - { - ACE_CString id; - if (! strm.read_string(id)) - return false; - ids.push_back (id); - } - else if (TAO_OBV_GIOP_Flags::has_list_type_info (valuetag)) - { - if (! read_repository_ids(strm, ids)) - return false; - } - else if (TAO_OBV_GIOP_Flags::has_no_type_info (valuetag)) - { - ids.push_back (repo_id); - } - else - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) unknown value tag: %x\n"), valuetag)); - return false; - } - - TAO_ORB_Core *orb_core = strm.orb_core (); - - if (orb_core == 0) - { - orb_core = TAO_ORB_Core_instance (); - - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_WARNING, - "TAO (%P|%t) WARNING: extracting valuetype using " - "default ORB_Core\n")); - } - } - - CORBA::Boolean require_truncation = false; - CORBA::Boolean const chunking = TAO_OBV_GIOP_Flags::is_chunked (valuetag); - - CORBA::ULong const num_ids = ids.size (); - // Find the registered factory for this unmarshalling valuetype. If any - // factory for the valuetype in its truncatable derivation hierarchy - // is registered, the factory is used to create value for unmarshalling. - for (CORBA::ULong i = 0; i < num_ids; ++i) - { - factory = orb_core->orb ()->lookup_value_factory (ids[i].c_str ()); - if (factory.in() != 0) - { - if (i != 0 && chunking) - { - require_truncation = true; - } - break; - } - } - - if (factory.in() == 0) - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) OBV factory is null, id = %s\n"), repo_id)); - } - ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::OMGVMCID | 1, - CORBA::COMPLETED_MAYBE), - false); - } - - - valuetype = factory->create_for_unmarshal (); - - if (require_truncation) - valuetype->truncation_hook (); - - if (valuetype == 0) - { - return false; // %! except.? - } - - valuetype->chunking_ = chunking; - - return true; -} - -CORBA::Boolean -CORBA::ValueBase::_tao_unmarshal_post (TAO_InputCDR &) -{ - // (... called from T::_tao_unmarshal) - // 7. if (chunking) check the last blocksize tag for correct value. +++ - // And if we're gonna to truncate, skip all the state of the more - // derived classes. (But it might need to be accessed again, - // if there are embedded objects which are referenced later - // in this CDR encoding stream.) - - // 8. if (chunking) there must be some end tag. Let the CDR stream deal - // with this (and decrease the nesting level of valuetypes). - // Also the CDR stream must check for eventually outstanding end tags - // at the end of the stream which have to cause a marshal - // exception there. - - return true; -} - - -CORBA::Boolean -CORBA::ValueBase::_tao_validate_box_type (TAO_InputCDR &strm, - const char * const repo_id_expected, - CORBA::Boolean & null_object) -{ - CORBA::Long value_tag; - - // todo: no handling for indirection yet - - if (!strm.read_long (value_tag)) - { - return false; - } - - if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag)) - { // ok, null reference unmarshaled - null_object = true; - return true; - } - null_object = false; - - if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag)) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("!CORBA::ValueBase::_tao_validate_box_type ") - ACE_TEXT ("not value_tag\n"))); - return false; - } - - if (TAO_OBV_GIOP_Flags::has_codebase_url (value_tag)) - { // Demarshal the codebase url (but we won't be using it). - - CORBA::String_var codebase_url; - - if (!strm.read_string (codebase_url.inout ())) - { - return false; - } - } - - if (TAO_OBV_GIOP_Flags::has_no_type_info (value_tag)) - { // No type information so assume it is the correct type. - return true; - } - - if (TAO_OBV_GIOP_Flags::has_single_type_info (value_tag)) - { // Demarshal the repository id and check if it is the expected one. - - CORBA::String_var repo_id_stream; - - if (!strm.read_string (repo_id_stream.inout ())) - { - return false; - } - - if (!ACE_OS::strcmp (repo_id_stream.in (), repo_id_expected)) - { // Repository ids matched as expected - return true; - } - } - - if (TAO_OBV_GIOP_Flags::has_list_type_info (value_tag)) - { // Don't know how to handle a repository id list. It does not - // make sense for a value box anyway. - return false; - } - - return false; -} - - -// =================== methods for chunking ==================== - - -CORBA::Boolean -CORBA::ValueBase::write_special_value(TAO_OutputCDR &strm, - const CORBA::ValueBase *value) -{ - // If the 'value' is null then write the null value to the stream. - if (value == 0) - { - return strm.write_long (TAO_OBV_GIOP_Flags::Null_tag); - } - //@@TODO: Check if the value is already written to stream. If it is then - // put indirection and return successful, otherwise does nothing - // and returns false. - else - { - // value not handled by this method - other code will write the value. - return false; - } -} - - -CORBA::Boolean -CORBA::ValueBase::write_value(TAO_OutputCDR &strm, - const CORBA::ValueBase * value, - ptrdiff_t formal_type_id) -{ - if (! value->write_value_header (strm, formal_type_id)) - return false; - - if (! value->_tao_marshal_v (strm)) - return false; - - return true; -} - - -CORBA::Boolean -CORBA::ValueBase::write_value_header(TAO_OutputCDR &strm, - ptrdiff_t formal_type_id) const -{ -#if defined (TAO_HAS_OPTIMIZED_VALUETYPE_MARSHALING) - // this case allows TAO to avoid marshaling the typeID for values - // where the actual type matches the formal type (ie not a derived - // type). - // - // I would much prefer that there be a way to have a -ORB option to - // control this behavior, but for now there is no reference to the - // ORB Core available during marshaling (there is during unmarshaling) - // and no other way to communicate such configuration values. - - CORBA::Boolean const is_formal_type = - this->_tao_match_formal_type (formal_type_id); -#else - // Unfortunately, all versions of tao prior to TAO 1.5.2 did not - // support unmarshaling of valuetypes that did not explicitly - // marshal the type id. At least it is benign to always encode the - // typecode value, even if it can be a little verbose. - CORBA::Boolean const is_formal_type = - false; - ACE_UNUSED_ARG (formal_type_id); -#endif /* TAO_HAS_OPTIMIZED_VALUETYPE_MARSHALING */ - - // Get the list of repository ids for this valuetype. - Repository_Id_List repository_ids; - this->_tao_obv_truncatable_repo_ids (repository_ids); - CORBA::Long const num_ids = static_cast <CORBA::Long> (repository_ids.size ()); - - // Build <value-tag>, which states if chunking is used - // and if type information ((list of) repository id(s)) - // is provided. The latter is necessary if the formal_type_id - // is unequal the 'true derived' type of this object. - CORBA::Long valuetag = TAO_OBV_GIOP_Flags::Value_tag_base; - - // Truncatable value type, must use chunking and list all repository - // ids in its "truncatable" derivation hierarchy. - if (this->is_truncatable_ || this->chunking_) - valuetag |= TAO_OBV_GIOP_Flags::Chunking_tag_sigbits; - - if (!is_formal_type || this->is_truncatable_) - valuetag |= TAO_OBV_GIOP_Flags::Type_info_single; - - if (num_ids > 1) - valuetag |= TAO_OBV_GIOP_Flags::Type_info_list; - - // Write <value-tag>. - if (!strm.write_long (valuetag)) - return false; - - if (num_ids > 1 && !strm.write_long (num_ids)) - return false; - - if (this->is_truncatable_ || - !is_formal_type || - num_ids > 1) - { - // Marshal type information. - for( CORBA::Long i = 0; i < num_ids; ++i ) - { - if (! strm.write_string (repository_ids[i])) - return false; - } - } - - return true; -} - -// this method is called by the IDL generated _tao_marshal_state() method. -CORBA::Boolean -TAO_ChunkInfo::start_chunk(TAO_OutputCDR &strm) -{ - // If chunking, reserve the space for the chunk size of next chunk - // and increase the nesting level. - if (this->chunking_) - { - if (! reserve_chunk_size(strm)) - return false; - this->value_nesting_level_ ++; - } - return true; -} - -// this method is called by the IDL generated _tao_marshal_state() method. -CORBA::Boolean -TAO_ChunkInfo::end_chunk(TAO_OutputCDR &strm) -{ - if (this->chunking_) - { - // Write actual chunk size at the reserved chunk size place. - if (! this->write_previous_chunk_size(strm)) - return false; - - // Write an end tag which is negation of value_nesting_level_. - if (! strm.write_long(- this->value_nesting_level_)) - return false; - - // -- this->value_nesting_level_; - if ( -- this->value_nesting_level_ == 0 ) - { - // ending chunk for outermost value - this->chunking_ = false; - } - } - return true; -} - - -CORBA::Boolean -TAO_ChunkInfo::write_previous_chunk_size(TAO_OutputCDR &strm) -{ - if (this->chunk_size_pos_ != 0) - { - // Calculate the chunk size. - CORBA::Long const chunk_size = strm.total_length () - this->length_to_chunk_octets_pos_; - - // This should not happen since this is called in end_chunk() and - // the idl generated code always have the matched start_chunk() and - // end_chunk() pair. There is always data written to the stream between - // the start_chunk() and end_chunk() calls. - if (chunk_size == 0) - return false; - - // Write the actual chunk size to the reserved chunk size position - // in the stream. - if (!strm.replace (chunk_size, this->chunk_size_pos_)) - return false; - - // We finish writing the actual chunk size, now we need reset the state. - this->chunk_size_pos_ = 0; - this->length_to_chunk_octets_pos_ = 0; - } - - return true; -} - - -CORBA::Boolean -TAO_ChunkInfo::reserve_chunk_size(TAO_OutputCDR &strm) -{ - // This is called in the start_chunk(). - // Reserve the chunk size the first time the start_chunk () is called - // if there are several start_chunk () called continuously without - // calling end_chunk (). This could happen in the _tao_marshal_state() - // in the most derived valuetype. - - if (this->chunk_size_pos_ == 0) - { - // Align the wr_ptr before we reserve the space for chunk size. - strm.align_write_ptr (ACE_CDR::LONG_SIZE); - // Remember begin of the chunk (at chunk size position) that is needed - // when we write back actual chunk size to the stream. - this->chunk_size_pos_ = strm.current ()->wr_ptr (); - - // Insert four bytes here as a place-holder, we need to go back - // later and write the actual size. - if (! strm.write_long (0)) - return false; - - // Remember length before writing chunk data. This is used to calculate - // the actual size of the chunk. - this->length_to_chunk_octets_pos_ = strm.total_length (); - } - - return true; -} - -CORBA::Boolean -TAO_ChunkInfo::handle_chunking (TAO_InputCDR &strm) -{ - if (!this->chunking_) - return true; - - char* the_rd_ptr = strm.start()->rd_ptr (); - - //This case could happen if a handle_chunking() reads a chunk size - //and then calls the handle_chunking() again without reading the chunk data. - //The handle_chunking() called continuously without reading the chunk data - //only happens at the beginning of _tao_unmarshal_state() in a valuetype - //that has parents. - if (the_rd_ptr < this->chunk_octets_end_pos_) - { - this->value_nesting_level_ ++; - return true; - } - - //Safty check if reading is out of range of current chunk. - if (this->chunk_octets_end_pos_ != 0 && the_rd_ptr > this->chunk_octets_end_pos_) - return false; - - // Read a long value that might be an endtag, the chunk size or the value tag - // of the nested valuetype. - CORBA::Long tag; - if (!strm.read_long(tag)) - return false; - - if (tag < 0) - { - // tag is an end tag - if (-tag > this->value_nesting_level_) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%P|%t) received end tag %d > value_nesting_level %d\n"), - -tag, this->value_nesting_level_), - false); - } - this->value_nesting_level_ = - tag; - this->value_nesting_level_--; - - - this->chunk_octets_end_pos_ = 0; - - // Continue reading so that we can read the outmost endtag. This would - // simplify the implementation in the derived valuetype. - if (this->value_nesting_level_ > 0) - { - this->handle_chunking(strm); - } - } - else if (tag < TAO_OBV_GIOP_Flags::Value_tag_base) - { - // Read the chunk size of another chunk. - this->chunk_octets_end_pos_ = strm.rd_ptr () + tag; - this->value_nesting_level_ ++; - } - else // (tag >= 0x7fffff00) - { - // This should not happen since the valuetag of the nested values are always - // unmarshalled in the ValueBase::_tao_unmarshal_pre(). - return false; - } - - return true; -} - - -CORBA::Boolean -TAO_ChunkInfo::skip_chunks (TAO_InputCDR &strm) -{ - if (!this->chunking_) - return true; - - // This function is called after reading data of the truncated parent and - // skips the remaining chunks until the outmost endtag (-1). - // The tag read here is suppoused to be an endtag. - CORBA::Long tag; - if (!strm.read_long(tag)) - return false; - - // end of the whole valuetype. - if (tag == -1) - return true; - else if (tag < 0) - { - // continue skip the chunk. - return this->skip_chunks (strm); - } - else if (tag < TAO_OBV_GIOP_Flags::Value_tag_base) - { - // Read the chunk size and move forward to skip the data. - ACE_Message_Block* current = const_cast<ACE_Message_Block*>(strm.start ()); - current->rd_ptr (tag); - return this->skip_chunks (strm); - } - else - return false; -} - -CORBA::Boolean -CORBA::ValueBase::read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids) -{ - CORBA::Long num_ids; - if (!strm.read_long(num_ids)) - return false; - - if (num_ids == TAO_OBV_GIOP_Flags::Indirection_tag) - { - //@@TODO: read indirection repository ids and return true. - return false; - } - else - { - //@@TODO: map repository id for indirection - for (CORBA::Long i = 0; i < num_ids; i ++) - { - ACE_CString id; - if (! strm.read_string(id)) - return false; - ids.push_back (id); - } - } - - return true; -} - - -void -CORBA::ValueBase::truncation_hook () -{ -#if defined (ACE_HAS_EXCEPTIONS) - ACE_THROW (CORBA::INTERNAL ()); -#else - ACE_OS::abort (); -#endif /* ACE_HAS_EXCEPTIONS */ -} - - -// ================== Typecode initializations ================== - -namespace TAO -{ - namespace TypeCode - { - char const tc_value_base_id[] = "IDL:omg.org/CORBA/ValueBase:1.0"; - char const tc_value_base_name[] = "ValueBase"; - Value<char const *, - CORBA::TypeCode_ptr const *, - Value_Field<char const *, CORBA::TypeCode_ptr const *> const *, - TAO::Null_RefCount_Policy> tc_ValueBase (CORBA::tk_value, - tc_value_base_id, - tc_value_base_name, - CORBA::VM_NONE, - &CORBA::_tc_null, - 0, // Field array - 0); // Field count - - char const tc_event_base_id[] = "IDL:omg.org/CORBA/EventBase:1.0"; - char const tc_event_base_name[] = "EventBase"; - Value<char const *, - CORBA::TypeCode_ptr const *, - Value_Field<char const *, CORBA::TypeCode_ptr const *> const *, - TAO::Null_RefCount_Policy> tc_EventBase (CORBA::tk_event, - tc_event_base_id, - tc_event_base_name, - CORBA::VM_NONE, - &CORBA::_tc_null, - 0, // Field array - 0); // Field count - } -} - -namespace CORBA -{ - TypeCode_ptr const _tc_ValueBase = &TAO::TypeCode::tc_ValueBase; - TypeCode_ptr const _tc_EventBase = &TAO::TypeCode::tc_EventBase; -} - -// member functions for CORBA::DefaultValueRefCountBase ============ - -// destructor -CORBA::DefaultValueRefCountBase::~DefaultValueRefCountBase (void) -{ -} - -void -CORBA::DefaultValueRefCountBase::_add_ref (void) -{ - this->_tao_add_ref (); -} - -void -CORBA::DefaultValueRefCountBase::_remove_ref (void) -{ - this->_tao_remove_ref (); -} - -CORBA::ULong -CORBA::DefaultValueRefCountBase::_refcount_value (void) -{ - return this->_tao_refcount_value (); -} - -// =========================================================== - -CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase (void) - : refcount_ (1) -{ -} - - -// Copy constructor -CORBA::DefaultValueRefCountBase::DefaultValueRefCountBase - (const DefaultValueRefCountBase& rhs) - : ValueBase (rhs), - refcount_ (1) - -{ -} - - -void -CORBA::DefaultValueRefCountBase::_tao_add_ref (void) -{ - ++this->refcount_; -} - -void -CORBA::DefaultValueRefCountBase::_tao_remove_ref (void) -{ - CORBA::ULong const new_count = --this->refcount_; - - if (new_count == 0) - delete this; -} - -CORBA::ULong -CORBA::DefaultValueRefCountBase::_tao_refcount_value (void) -{ - return this->refcount_.value (); -} - -// =========================================================== - -CORBA::Boolean -operator<< (TAO_OutputCDR &strm, - CORBA::ValueBase *_tao_valuetype) -{ - return CORBA::ValueBase::_tao_marshal ( - strm, - _tao_valuetype, - reinterpret_cast<ptrdiff_t> (&CORBA::ValueBase::_downcast) - ); -} - -CORBA::Boolean -operator>> (TAO_InputCDR &strm, - CORBA::ValueBase *&_tao_valuetype) -{ - return CORBA::ValueBase::_tao_unmarshal (strm, - _tao_valuetype); -} - -// =============== Template Specializations ===================== -namespace TAO -{ - void - Value_Traits<CORBA::ValueBase>::add_ref ( - CORBA::ValueBase *p) - { - CORBA::add_ref (p); - } - - void - Value_Traits<CORBA::ValueBase>::remove_ref ( - CORBA::ValueBase * p) - { - CORBA::remove_ref (p); - } - - void - Value_Traits<CORBA::ValueBase>::release ( - CORBA::ValueBase * p) - { - CORBA::remove_ref (p); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h deleted file mode 100644 index 6918787b738..00000000000 --- a/TAO/tao/Valuetype/ValueBase.h +++ /dev/null @@ -1,371 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ValueBase.h - * - * $Id$ - * - * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> - */ -//============================================================================= - -#ifndef TAO_VALUEBASE_H -#define TAO_VALUEBASE_H - -#include /**/ "ace/pre.h" - -#include "tao/Valuetype/valuetype_export.h" -#include "tao/orbconf.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Valuetype/Value_CORBA_methods.h" -#include "tao/Valuetype/Value_VarOut_T.h" - -#include "tao/Object_Argument_T.h" -#include "tao/Arg_Traits_T.h" -#include "tao/Any_Insert_Policy_T.h" - -#include "ace/Basic_Types.h" -#include "ace/CORBA_macros.h" -#include "ace/Synch_Traits.h" -#include "ace/Thread_Mutex.h" -#include "ace/Atomic_Op.h" -#include "ace/Null_Mutex.h" -#include "ace/Vector_T.h" - -#if defined (TAO_EXPORT_MACRO) -#undef TAO_EXPORT_MACRO -#endif -#define TAO_EXPORT_MACRO TAO_Valuetype_Export - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_Valuetype_Export TAO_ChunkInfo -{ -public: - TAO_ChunkInfo(CORBA::Boolean do_chunking = 0, CORBA::Long init_level = 0); - - /// Methods to support chunking. - /// Note: These methods are called for both chunking and non-chunking - /// valuetype. These methods checks the chunking_ flag. If it's - /// set to be false the methods return true rightaway. - - /// Methods for marshalling a valuetype. - - /// This is called in the _tao_marshal_state (). This method reserves - /// space for the chunk size of the next chunk and also increments the - /// nesting level. The reservasion actually occurs the first time that - /// the start_chunk is called if there are multiple continuous start_chunk() - /// calls without the close_chunk() called in between. - CORBA::Boolean start_chunk(TAO_OutputCDR &strm); - - /// This is called in the _tao_marshal_state (). This method writes the - /// actual chunk size to the reserved chunk size space and writes an end - /// tag with the negation value of current nesting level. A start_chunk() - /// needs an end_chunk() to close the current chunk. It's also needed for - /// writing the outmost endtag to the stream. - CORBA::Boolean end_chunk(TAO_OutputCDR &strm); - - /// Methods for unmarshalling a valuetype. - - /// This is called in the _tao_unmarshal_state () to read the chunk - /// size or an end tag. - CORBA::Boolean handle_chunking (TAO_InputCDR &strm); - /// This is called in the _tao_unmarshal_state () to skip the rest - /// chunks until the outmost endtag (-1) if the value is truncated - /// to its truncatable parent. - CORBA::Boolean skip_chunks (TAO_InputCDR &strm); - /// This is called in end_chunk(). It writes the actual chunk size to the - /// reserved chunk size space. - CORBA::Boolean write_previous_chunk_size(TAO_OutputCDR &strm); - /// Reserve space for chunk size. The memory in the stream will be - /// overwritten after all the chunk data is written. This method - /// only allows the reservasion being made once if the reserved - /// space has not been overwritten. - CORBA::Boolean reserve_chunk_size(TAO_OutputCDR &strm); - - /// A flag to indicate that this instance is actually involved in a chunked - /// or truncatable valuetype. - CORBA::Boolean chunking_; - - /// The level of nesting valuetypes. - CORBA::Long value_nesting_level_; - /// The starting position of the size of current chunk. - char* chunk_size_pos_; - /// The length of CDR stream from the begining to the current - /// chunk data starting position. Used to calculate the chunk size - /// across multiple chained ACE_Message_Blocks. - size_t length_to_chunk_octets_pos_; - /// The end position of current chunk. - char* chunk_octets_end_pos_; -}; - -namespace CORBA -{ - class ValueFactoryBase; - typedef ValueFactoryBase *ValueFactory; - - class ValueBase; - - typedef TAO_Value_Var_T<ValueBase> ValueBase_var; - typedef TAO_Value_Out_T<ValueBase> ValueBase_out; - - /** - * @class ValueBase - * - * @brief Abstract baseclass for Valuetypes - * - * @see CORBA 2.3 - Section 20.17.5 - */ - class TAO_Valuetype_Export ValueBase - { - public: - friend class TAO_ChunkInfo; - - typedef ValueBase* _ptr_type; - typedef ValueBase_var _var_type; - typedef ValueBase_out _out_type; - - typedef ACE_Vector < ACE_CString > Repository_Id_List; - - // Reference counting. - /// %! virtual CORBA::ValueBase* _copy_value (void) = 0; - - virtual void _add_ref (void) = 0; - virtual void _remove_ref (void) = 0; - virtual CORBA::ULong _refcount_value (void) = 0; - - // dynamic casting - static CORBA::ValueBase* _downcast (CORBA::ValueBase *); - - /// Used in the implementation of CORBA::Any - static void _tao_any_destructor (void *); - - /// TAO extension - - /// Return the repository id of this valuetype. - virtual const char * _tao_obv_repository_id (void) const = 0; - - /// Give the list of the RepositoryIds in the valuetype "truncatable" - /// inheritance hierarchy. List the id of this valuetype as first - /// RepositoryID and go up the "truncatable" derivation hierarchy. - /// Note the truncatable repo ids only list the truncatable base types - /// to which this type is safe to truncate, not all its parents. - virtual void _tao_obv_truncatable_repo_ids (Repository_Id_List &) const = 0; - - // TAO internal -------------------------- - - /// Marshal a valuetype (see operator<< in tao_idl generated file - /// how it is called) - static CORBA::Boolean _tao_marshal (TAO_OutputCDR &strm, - const ValueBase *_this, - ptrdiff_t formal_type_id = 0); - - /// Unmarshal a valuetype, if formal type is a pointer to - /// ValueBase - static CORBA::Boolean _tao_unmarshal (TAO_InputCDR &strm, - ValueBase *&new_object); - - // static CORBA::Boolean - // T::_tao_unmarshal (TAO_InputCDR &, ValueBase *&_this) - // is typespecific for valuetype T and generated from tao_idl - // Use this for unmarshaling. - - /// Both used internally and are called from T::_tao_unmarshal () - static CORBA::Boolean _tao_unmarshal_pre (TAO_InputCDR &strm, - ValueBase *&, - const char * const repo_id); - - CORBA::Boolean _tao_unmarshal_post (TAO_InputCDR &strm); - - /// Check repository id for value box type against what is - /// in the CDR stream. - static CORBA::Boolean _tao_validate_box_type ( - TAO_InputCDR &strm, - const char * const repo_id_expected, - CORBA::Boolean & null_object); - - public: // otherwise these cannot be called from a static function - - /// during marshal jump to the most derived part - virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) const = 0; - - /// called after obtaining the fresh object from create_for_unmarshal () - virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &) = 0; - - /// Notify the truncated parent valuetype to skip the rest of the chunks - /// when unmarshalling a value from its derived valuetype. - /// This is called when the factory for the most derived valuetype (in - /// the repository id list) does not exist and a truncated parent factory - /// is registered. - virtual void truncation_hook (); - - protected: - ValueBase (void); - ValueBase (const ValueBase&); - virtual ~ValueBase (void); - - /// This flag is set to be true when the valuetype defined - /// in the idl has the truncatable parent. - CORBA::Boolean is_truncatable_; - - /// This flag is set to be true when marshalling uses chunking. - /// According to spec, the truncatable valuetype should use chunking - /// and it can be used for marshalling large valuetype. In current - /// implementation, we just use chunking for the truncatable valuetype. - CORBA::Boolean chunking_; - - /// Compare the supplied formal type identifier with our actual type. - /// This is used during marshaling of valuetypes to detect when it is - /// appropriate to not explicitly marshal the typecode for the value. - virtual CORBA::Boolean _tao_match_formal_type (ptrdiff_t ) const = 0; - - private: - /// Write some special values such as null value or indirection value. - static CORBA::Boolean write_special_value(TAO_OutputCDR &strm, const CORBA::ValueBase * value); - /// Write whole value. - static CORBA::Boolean write_value(TAO_OutputCDR &strm, - const CORBA::ValueBase * value, - ptrdiff_t formal_type_id); - - /// Write the header of the value which includes the valuetag, number of - /// repository ids and list of repository ids. - CORBA::Boolean write_value_header(TAO_OutputCDR &strm, - ptrdiff_t formal_type_id) const; - - /// Read the repository ids from the CDR input stream. - static CORBA::Boolean read_repository_ids(ACE_InputCDR& strm, Repository_Id_List& ids); - - private: - ValueBase & operator= (const ValueBase &); - -#ifdef SUN_CC_HAS_PVFC_BUG - // Need ugly fix for sun cc "pure virtual function called" bug. - private: - unsigned long tao_sun_cc_pvfc_bug_fix_; - -#endif /* SUN_CC_HAS_PVFC_BUG */ - - }; // ValueBase - - /// Valuetype-related type codes. - extern TAO_Valuetype_Export TypeCode_ptr const _tc_ValueBase; - extern TAO_Valuetype_Export TypeCode_ptr const _tc_EventBase; - - /** - * @class DefaultValueRefCountBase - * - * @brief Default mix-in for reference count of a valuetype. - * - * Default mix-in for reference count of a valuetype. - */ - class TAO_Valuetype_Export DefaultValueRefCountBase - : public virtual ValueBase - { - public: - virtual void _add_ref (void); - virtual void _remove_ref (void); - virtual CORBA::ULong _refcount_value (void); - - /// The _tao variants are inline for fast access from T_var - /// (if valuetype T is compiled with optimization for that.) %! (todo) - void _tao_add_ref (void); - void _tao_remove_ref (void); - CORBA::ULong _tao_refcount_value (void); - - protected: - DefaultValueRefCountBase (void); - DefaultValueRefCountBase (const DefaultValueRefCountBase&); - virtual ~DefaultValueRefCountBase (); - - private: - void operator= (const DefaultValueRefCountBase &); - - private: // data - /// Reference counter. - ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_; - }; // DefaultValueRefCountBase - - // which lock has the lowest memory overhead ? - // %! todo refcountbase w/o locking (now memory overhead) - // $! todo: debug aids for refcounts - -} // End CORBA namespace - -/** - * @namespace TAO_OBV_GIOP_Flags - * - * @brief TAO_OBV_GIOP_Flags - * - * @see CORBA 2.3 -- Section 15.3.4 - */ -namespace TAO_OBV_GIOP_Flags -{ - const CORBA::Long Value_tag_base = 0x7fffff00L; - const CORBA::Long Value_tag_sigbits = 0xffffff00L; - const CORBA::Long Codebase_url = 1; - const CORBA::Long Type_info_sigbits = 0x00000006L; - const CORBA::Long Type_info_none = 0; - const CORBA::Long Type_info_single = 2; - const CORBA::Long Type_info_list = 6; - const CORBA::Long Chunking_tag_sigbits = 0x00000008L; - const CORBA::Long Indirection_tag = 0x7fffffffL; - const CORBA::Long Null_tag = 0x00000000L; - - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_null_ref (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_value_tag (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_codebase_url (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_no_type_info (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_single_type_info (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean has_list_type_info (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_chunked (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_indirection_tag (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_indirection (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_block_size (CORBA::Long); - TAO_NAMESPACE_INLINE_FUNCTION CORBA::Boolean is_end_tag (CORBA::Long); -} - -TAO_Valuetype_Export CORBA::Boolean -operator<< (TAO_OutputCDR&, const CORBA::ValueBase *); - -TAO_Valuetype_Export CORBA::Boolean -operator>> (TAO_InputCDR&, CORBA::ValueBase *&); - -/// Used in generated code if CORBA::ValueBase is an argument or return type. -namespace TAO -{ - template<> - class TAO_Valuetype_Export Arg_Traits<CORBA::ValueBase> - : public Object_Arg_Traits_T<CORBA::ValueBase *, - CORBA::ValueBase_var, - CORBA::ValueBase_out, - TAO::Value_Traits<CORBA::ValueBase>, - TAO::Any_Insert_Policy_Stream <CORBA::ValueBase *> > - { - }; - - template<> - struct TAO_Valuetype_Export Value_Traits<CORBA::ValueBase> - { - static void add_ref (CORBA::ValueBase *); - static void remove_ref (CORBA::ValueBase *); - - // For INOUT value type arguments, so they can use the same set - // of arg classes as interfaces. - static void release (CORBA::ValueBase *); - }; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (__ACE_INLINE__) -# include "tao/Valuetype/ValueBase.inl" -#endif /* __ACE_INLINE__*/ - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUEBASE_H */ diff --git a/TAO/tao/Valuetype/ValueBase.inl b/TAO/tao/Valuetype/ValueBase.inl deleted file mode 100644 index d51a47bab83..00000000000 --- a/TAO/tao/Valuetype/ValueBase.inl +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -// Detection of flags in the CDR Stream - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_null_ref (CORBA::Long tag) -{ - return (tag == Null_tag); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_value_tag (CORBA::Long tag) -{ - return ((tag & Value_tag_sigbits) == 0x7FFFFF00L); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags:: has_codebase_url (CORBA::Long tag) -{ - return (CORBA::Boolean) (tag & Codebase_url); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::has_no_type_info (CORBA::Long tag) -{ - return ((tag & Type_info_sigbits) == Type_info_none); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::has_single_type_info (CORBA::Long tag) -{ - return ((tag & Type_info_sigbits) == Type_info_single); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::has_list_type_info (CORBA::Long tag) -{ - return ((tag & Type_info_sigbits) == Type_info_list); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags:: is_chunked (CORBA::Long tag) -{ - return (CORBA::Boolean) (tag & 8); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_indirection_tag (CORBA::Long tag) -{ - return (static_cast<unsigned>(tag) == 0xFFFFFFFFL); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_indirection (CORBA::Long value) -{ - return (0x80000000L < static_cast<unsigned>(value) && - static_cast<unsigned>(value) <= (0xFFFFFFFFL - 4)); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_block_size (CORBA::Long value) -{ - return (0 < static_cast<unsigned>(value) && - static_cast<unsigned>(value) < 0x7FFFFF00L); -} - -ACE_INLINE CORBA::Boolean -TAO_OBV_GIOP_Flags::is_end_tag (CORBA::Long tag) -{ - return (0x80000000L < (unsigned)tag); -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/ValueFactory.cpp b/TAO/tao/Valuetype/ValueFactory.cpp deleted file mode 100644 index 473780b8790..00000000000 --- a/TAO/tao/Valuetype/ValueFactory.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "tao/Valuetype/ValueFactory.h" -#include "ace/Guard_T.h" - -ACE_RCSID (Valuetype, - ValueFactory, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -// Static operations in namespace CORBA. - -void -CORBA::add_ref (CORBA::ValueFactoryBase *val) -{ - if (val) - { - val->_add_ref (); - } -} - -void -CORBA::remove_ref (CORBA::ValueFactoryBase *val) -{ - if (val) - { - val->_remove_ref (); - } -} - -// =========================================================== - -CORBA::ValueFactoryBase::ValueFactoryBase (void) - : _tao_reference_count_ (1) -{ -} - -CORBA::ValueFactoryBase::~ValueFactoryBase (void) -{ -} - -void -CORBA::ValueFactoryBase::_add_ref (void) -{ - ++this->_tao_reference_count_; -} - -void -CORBA::ValueFactoryBase::_remove_ref (void) -{ - const CORBA::ULong new_count = --this->_tao_reference_count_; - - if (new_count == 0) - delete this; -} - -// No-op. This should never be called, but it can't be pure virtual. -CORBA::AbstractBase * -CORBA::ValueFactoryBase::create_for_unmarshal_abstract (void) -{ - return 0; -} - -// =============== Template Specializations ===================== -namespace TAO -{ - using namespace CORBA; - - void - Value_Traits<ValueFactoryBase>::add_ref (ValueFactoryBase *p) - { - CORBA::add_ref (p); - } - - void - Value_Traits<ValueFactoryBase>::remove_ref (ValueFactoryBase * p) - { - CORBA::remove_ref (p); - } - - void - Value_Traits<ValueFactoryBase>::release (ValueFactoryBase * p) - { - CORBA::remove_ref (p); - } -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/ValueFactory.h b/TAO/tao/Valuetype/ValueFactory.h deleted file mode 100644 index 0935bba77a4..00000000000 --- a/TAO/tao/Valuetype/ValueFactory.h +++ /dev/null @@ -1,134 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ValueFactory.h - * - * $Id$ - * - * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> - */ -//============================================================================= - -#ifndef TAO_VALUEFACTORY_H -#define TAO_VALUEFACTORY_H - -#include /**/ "ace/pre.h" - -#include "tao/Valuetype/valuetype_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Valuetype/Value_VarOut_T.h" - -#include "tao/Environment.h" -#include "tao/Basic_Types.h" -#include "tao/orbconf.h" -#include "ace/Synch_Traits.h" -#include "ace/Thread_Mutex.h" -#include "ace/Null_Mutex.h" -#include "ace/CORBA_macros.h" -#include "ace/Atomic_Op.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace CORBA -{ - class AbstractBase; - typedef AbstractBase *AbstractBase_ptr; - - class ValueBase; - - class ValueFactoryBase; - - extern TAO_Valuetype_Export void add_ref (ValueFactoryBase *); - extern TAO_Valuetype_Export void remove_ref (ValueFactoryBase *); - - typedef TAO_Value_Var_T<ValueFactoryBase> - ValueFactoryBase_var; - - typedef ValueFactoryBase_var ValueFactory_var; - - class TAO_Valuetype_Export ValueFactoryBase - { - public: - ValueFactoryBase (void); - virtual ~ValueFactoryBase (void); - - // non-virtual is non-standard - void _add_ref (void); - void _remove_ref (void); - - // private: %! - /// In a derived class T use return type TAO_OBV_CREATE_RETURN_TYPE (T) - /// (see at definition below) - virtual CORBA::ValueBase * create_for_unmarshal ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) = 0; - - // Not pure virtual because this will be overridden only by valuetypes - // that support an abstract interface. - virtual CORBA::AbstractBase_ptr create_for_unmarshal_abstract (void); - - private: - /// Reference counter. - ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> _tao_reference_count_; - }; - -} // End CORBA namespace - -namespace TAO -{ - /** - * @brief Specializations needed for using with Value_Var_T - */ - template<> - struct TAO_Valuetype_Export Value_Traits<CORBA::ValueFactoryBase> - { - static void add_ref (CORBA::ValueFactoryBase *); - static void remove_ref (CORBA::ValueFactoryBase *); - - // For INOUT value type arguments, so they can use the same set - // of arg classes as interfaces. - static void release (CORBA::ValueFactoryBase *); - }; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -// Use this macro for writing code that is independent from -// the compiler support of covariant return types of pointers to -// virtual inherited classes. -// (e.g. in egcs-2.90.29 980515 (egcs-1.0.3 release) its not yet implemented) -// (But it is TAO specific and at the moment the covariant case is not -// elaborated --- its just a suggestion.) - -#ifdef TAO_HAS_OBV_COVARIANT_RETURN -# define TAO_OBV_CREATE_RETURN_TYPE(TYPE) TYPE * -#else /* TAO_HAS_OBV_COVARIANT_RETURN */ -# define TAO_OBV_CREATE_RETURN_TYPE(TYPE) CORBA::ValueBase * -#endif /* TAO_HAS_OBV_COVARIANT_RETURN */ - -// (The obtaining of the repository id is currently not yet like the OMG way. %!) -// -// Macro for on the fly registration of a factory (with type Factory). -// The repository id is taken from the static repository id of the -// valuetype via tao_repository_id () of the specialized factory. -// It forgets the pre-registered factory (if any) and the reference -// to the newly created one. (A new reference could be obtained with -// orb->lookup_value_factory (char * repo_id) .) - -#define TAO_OBV_REGISTER_FACTORY(FACTORY, VALUETYPE) \ - { CORBA::ValueFactory factory = new FACTORY; \ - CORBA::ValueFactory prev_factory = \ - TAO_ORB_Core_instance ()->orb ()->register_value_factory (\ - VALUETYPE::_tao_obv_static_repository_id (),\ - factory); \ - if (prev_factory) prev_factory->_remove_ref (); \ - factory->_remove_ref (); } - - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUEFACTORY_H */ diff --git a/TAO/tao/Valuetype/ValueFactory_Map.cpp b/TAO/tao/Valuetype/ValueFactory_Map.cpp deleted file mode 100644 index f33af298e5e..00000000000 --- a/TAO/tao/Valuetype/ValueFactory_Map.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "tao/Valuetype/ValueFactory_Map.h" -#include "tao/Valuetype/ValueFactory.h" -#include "tao/CORBA_String.h" -#include "tao/TAO_Singleton.h" - - -ACE_RCSID (Valuetype, - ValueFactory_Map, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_ValueFactory_Map::TAO_ValueFactory_Map (void) - : map_ (TAO_DEFAULT_VALUE_FACTORY_TABLE_SIZE) -{ -} - -TAO_ValueFactory_Map::~TAO_ValueFactory_Map (void) -{ - // Initialize an iterator. We need to go thru each entry and free - // up storage allocated to hold the external ids and invoke - // _remove_ref () on the internal ids. - FACTORY_MAP_MANAGER::ITERATOR iterator (this->map_); - - for (FACTORY_MAP_MANAGER::ENTRY *entry = 0; - iterator.next (entry) != 0; - iterator.advance ()) - { - // We had allocated memory and stored the string. So we free the - // memory. - CORBA::string_free ((char *) entry->ext_id_); - entry->ext_id_ = 0; - entry->int_id_->_remove_ref (); - entry->int_id_ = 0; - } -} - -int -TAO_ValueFactory_Map::rebind (const char *repo_id, - CORBA::ValueFactory &factory) -{ - ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1); - - const char *prev_repo_id = 0; - CORBA::ValueFactory prev_factory = 0; - int const ret = this->map_.rebind (CORBA::string_dup (repo_id), - factory, - prev_repo_id, - prev_factory); - - if (ret > -1) // ok, no error - { - factory->_add_ref (); // The map owns one reference. - - if (ret == 1) // there was a previous factory - { - factory = prev_factory; - CORBA::string_free (const_cast<char*> (prev_repo_id)); - } - } - - return ret; -} - -int -TAO_ValueFactory_Map::unbind (const char *repo_id, - CORBA::ValueFactory &factory) -{ - ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1); - - FACTORY_MAP_MANAGER::ENTRY *prev_entry = 0; - int ret = this->map_.find (repo_id, - prev_entry); - if (ret == 0) // there was a matching factory - { - // set factory to the previous factory, - factory = prev_entry->int_id_; - char *temp = const_cast<char *> (prev_entry->ext_id_); - ret = this->map_.unbind (prev_entry); - - if (ret == 0) - { - CORBA::string_free (temp); - } - } - - return ret; -} - -// %! perhaps inline -int -TAO_ValueFactory_Map::find (const char *repo_id, - CORBA::ValueFactory &factory) -{ - ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, guard, this->mutex_, -1); - - int const ret = this->map_.find (repo_id, - factory); - if (ret > -1) - { - factory->_add_ref (); // The caller gets one reference as gift. - } - - return ret; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - diff --git a/TAO/tao/Valuetype/ValueFactory_Map.h b/TAO/tao/Valuetype/ValueFactory_Map.h deleted file mode 100644 index af10d7c27ae..00000000000 --- a/TAO/tao/Valuetype/ValueFactory_Map.h +++ /dev/null @@ -1,92 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ValueFactory_Map.h - * - * $Id$ - * - * @author Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> - */ -//============================================================================= - - -#ifndef TAO_VALUEFACTORY_MAP_H -#define TAO_VALUEFACTORY_MAP_H - -#include /**/ "ace/pre.h" - -#include "tao/orbconf.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Thread_Mutex.h" -#include "ace/Null_Mutex.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace CORBA -{ - class ValueFactoryBase; - typedef ValueFactoryBase *ValueFactory; -} - -class TAO_ValueFactory_Map -{ -public: - - TAO_ValueFactory_Map (void); - ~TAO_ValueFactory_Map (void); - - /** - * Associate the factory (int_id) with the repo_id (ext_id). - * Invokes _add_ref () on the factory. - * If previous factory had been bind with this repo_id, this one is - * returned in factory (and the caller holds a reference). - * Returns -1 on failure, 0 on success and 1 if a previous factory - * is found (and returned in factory). - */ - int rebind (const char *repo_id, - CORBA::ValueFactory &factory); - - /// Removes entry for repo_id from the map and sets factory to - /// the tied one. - int unbind (const char *repo_id, - CORBA::ValueFactory &factory); - - /** - * Lookup a matching factory for repo_id. - * Invokes _add_ref () on the factory if found. - * Returns -1 on failure and 0 on success. - */ - int find (const char *repo_id, - CORBA::ValueFactory &factory); - - void dump (void); - - /// Return singleton instance of this class. - static TAO_ValueFactory_Map * instance (void); - -private: - - /// The hash table data structure. - typedef ACE_Hash_Map_Manager_Ex<const char *, - CORBA::ValueFactory, - ACE_Hash<const char *>, - ACE_Equal_To<const char *>, - ACE_SYNCH_NULL_MUTEX> - FACTORY_MAP_MANAGER; - FACTORY_MAP_MANAGER map_; - - /// synchronization of the map - TAO_SYNCH_MUTEX mutex_; -}; /* TAO_ValueFactory_Map */ - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUEFACTORY_MAP_H */ diff --git a/TAO/tao/Valuetype/Value_CORBA_methods.h b/TAO/tao/Valuetype/Value_CORBA_methods.h deleted file mode 100644 index dde1c2837b7..00000000000 --- a/TAO/tao/Valuetype/Value_CORBA_methods.h +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Value_CORBA_methods.h - * - * $Id$ - * - * Declarations of common ValueType methods in the CORBA namespace. - * - * @author Ossama Othman <ossama@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef TAO_VALUETYPE_CORBA_METHODS_H -#define TAO_VALUETYPE_CORBA_METHODS_H - -#include /**/ "ace/pre.h" - -#include "tao/Valuetype/valuetype_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Basic_Types.h" - -#if defined (TAO_EXPORT_MACRO) -#undef TAO_EXPORT_MACRO -#endif -#define TAO_EXPORT_MACRO TAO_Valuetype_Export - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - - -namespace CORBA -{ - class ValueBase; - - extern TAO_Valuetype_Export void add_ref (ValueBase *); - extern TAO_Valuetype_Export void remove_ref (ValueBase *); - - class AbstractBase; - typedef AbstractBase *AbstractBase_ptr; - - extern TAO_Valuetype_Export Boolean is_nil (AbstractBase_ptr); - extern TAO_Valuetype_Export void release (AbstractBase_ptr); - - -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUETYPE_CORBA_METHODS_H */ diff --git a/TAO/tao/Valuetype/Value_VarOut_T.cpp b/TAO/tao/Valuetype/Value_VarOut_T.cpp deleted file mode 100644 index feb061920c7..00000000000 --- a/TAO/tao/Valuetype/Value_VarOut_T.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// $Id$ - -#ifndef TAO_VALUE_VAROUT_T_CPP -#define TAO_VALUE_VAROUT_T_CPP - -#include "tao/Valuetype/Value_VarOut_T.h" -#include "tao/Valuetype/Value_CORBA_methods.h" - -#include <algorithm> /* For std::swap<>() */ - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -template <typename T> -TAO_Value_Var_T<T>::TAO_Value_Var_T (void) - : ptr_ (0) -{} - -template <typename T> -TAO_Value_Var_T<T>::TAO_Value_Var_T (T * p) - : ptr_ (p) -{} - -template <typename T> -TAO_Value_Var_T<T>::TAO_Value_Var_T (const T * p) - : ptr_ (const_cast<T *> (p)) -{} - -template <typename T> -TAO_Value_Var_T<T>::TAO_Value_Var_T (const TAO_Value_Var_T<T> & p) - : TAO_Base_var () -{ - TAO::Value_Traits<T>::add_ref (p.ptr ()); - this->ptr_ = p.ptr (); -} - -template <typename T> -TAO_Value_Var_T<T>::~TAO_Value_Var_T (void) -{ - TAO::Value_Traits<T>::remove_ref (this->ptr_); -} - -template <typename T> -TAO_Value_Var_T<T> & -TAO_Value_Var_T<T>::operator= (T * p) -{ - if (this->ptr_ != p) - { - // This constructor doesn't increase the reference count so we - // we must check for self-assignment. Otherwise the reference - // count would be prematurely decremented upon exiting this - // scope. - TAO_Value_Var_T<T> tmp (p); - std::swap (this->ptr_, tmp.ptr_); - } - - return *this; -} - -template <typename T> -TAO_Value_Var_T<T> & -TAO_Value_Var_T<T>::operator= (const TAO_Value_Var_T<T> & p) -{ - TAO_Value_Var_T<T> tmp (p); - std::swap (this->ptr_, tmp.ptr_); - - return *this; -} - -template <typename T> -TAO_Value_Var_T<T>::operator const T * () const -{ - return this->ptr_; -} - -template <typename T> -TAO_Value_Var_T<T>::operator T *& () -{ - return this->ptr_; -} - -template <typename T> -T * -TAO_Value_Var_T<T>::operator-> (void) const -{ - return this->ptr_; -} - -template <typename T> -T * -TAO_Value_Var_T<T>::in (void) const -{ - return this->ptr_; -} - -template <typename T> -T *& -TAO_Value_Var_T<T>::inout (void) -{ - return this->ptr_; -} - -template <typename T> -T *& -TAO_Value_Var_T<T>::out (void) -{ - TAO::Value_Traits<T>::remove_ref (this->ptr_); - this->ptr_ = 0; - return this->ptr_; -} - -template <typename T> -T * -TAO_Value_Var_T<T>::_retn (void) -{ - T * tmp = this->ptr_; - this->ptr_ = 0; - return tmp; -} - -template <typename T> -T * -TAO_Value_Var_T<T>::ptr (void) const -{ - return this->ptr_; -} - -// ************************************************************* - -template <typename T> -TAO_Value_Out_T<T>::TAO_Value_Out_T (T *& p) - : ptr_ (p) -{ - this->ptr_ = 0; -} - -template <typename T> -TAO_Value_Out_T<T>::TAO_Value_Out_T (TAO_Value_Var_T<T> & p) - : ptr_ (p.out ()) -{ - TAO::Value_Traits<T>::remove_ref (this->ptr_); - this->ptr_ = 0; -} - -template <typename T> -TAO_Value_Out_T<T>::TAO_Value_Out_T (const TAO_Value_Out_T<T> & p) - : ptr_ (const_cast<TAO_Value_Out_T<T> &> (p).ptr_) -{} - -template <typename T> -TAO_Value_Out_T<T> & -TAO_Value_Out_T<T>::operator= (const TAO_Value_Out_T<T> & p) -{ - this->ptr_ = const_cast<TAO_Value_Out_T<T> &> (p).ptr_; - return *this; -} - -template <typename T> -TAO_Value_Out_T<T> & -TAO_Value_Out_T<T>::operator= (T * p) -{ - this->ptr_ = p; - return *this; -} - -template <typename T> -TAO_Value_Out_T<T>::operator T *& () -{ - return this->ptr_; -} - -template <typename T> -T *& -TAO_Value_Out_T<T>::ptr (void) -{ - return this->ptr_; -} - -template <typename T> -T * -TAO_Value_Out_T<T>::operator-> (void) -{ - return this->ptr_; -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif /* TAO_VALUE_VAROUT_T_CPP */ diff --git a/TAO/tao/Valuetype/Value_VarOut_T.h b/TAO/tao/Valuetype/Value_VarOut_T.h deleted file mode 100644 index 64ea98bd97e..00000000000 --- a/TAO/tao/Valuetype/Value_VarOut_T.h +++ /dev/null @@ -1,129 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Value_VarOut_T.h - * - * $Id$ - * - * @author Jeff Parsons - */ -//============================================================================= - -#ifndef TAO_VALUE_VAROUT_T_H -#define TAO_VALUE_VAROUT_T_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/varbase.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ - /** - * struct Value_Traits - * - * @brief Specialized for each valuetype in generated code. - */ - template<typename T> struct Value_Traits; -} - -/** - * @class TAO_Value_Var_T - * - * @brief Parametrized implementation of _var class for valuetypes. - * - */ -template <typename T> -class TAO_Value_Var_T : private TAO_Base_var -{ -public: - TAO_Value_Var_T (void); - TAO_Value_Var_T (T *); - TAO_Value_Var_T (const TAO_Value_Var_T<T> &); - - // (TAO extension) - TAO_Value_Var_T (const T *); - - ~TAO_Value_Var_T (void); - - TAO_Value_Var_T &operator= (T *); - TAO_Value_Var_T &operator= (const TAO_Value_Var_T<T> &); - - T * operator-> (void) const; - - operator const T * () const; - operator T *& (); - - typedef T * _in_type; - typedef T *& _inout_type; - typedef T *& _out_type; - typedef T * _retn_type; - - // in, inout, out, _retn - _in_type in (void) const; - _inout_type inout (void); - _out_type out (void); - _retn_type _retn (void); - - // (TAO extension) - T * ptr (void) const; - -private: - - // Prevent widening assignment. - TAO_Value_Var_T (const TAO_Base_var &); - void operator= (const TAO_Base_var &); - -private: - T * ptr_; -}; - -/** - * @class TAO_Value_Var_T - * - * @brief Parametrized implementation of _out class for valuetypes. - * - */ -template <typename T> -class TAO_Value_Out_T -{ -public: - TAO_Value_Out_T (T *&); - TAO_Value_Out_T (TAO_Value_Var_T<T> &); - TAO_Value_Out_T (const TAO_Value_Out_T<T> &); - - TAO_Value_Out_T &operator= (const TAO_Value_Out_T<T> &); - TAO_Value_Out_T &operator= (T *); - - operator T *& (); - T *& ptr (void); - - T * operator-> (void); - -private: - T *& ptr_; - /// Assignment from _var not allowed. - TAO_Value_Out_T &operator= (const TAO_Value_Var_T<T> &); -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "tao/Valuetype/Value_VarOut_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("Value_VarOut_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUE_VAROUT_T_H */ diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp deleted file mode 100644 index 0c58622685d..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -#include "tao/Valuetype/Valuetype_Adapter_Impl.h" -#include "tao/Valuetype/Valuetype_Adapter_Factory_Impl.h" - -#include "tao/ORB_Core.h" - -ACE_RCSID (ValueType, - Valuetype_Adapter_Factory_Impl, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_Valuetype_Adapter_Factory_Impl::~TAO_Valuetype_Adapter_Factory_Impl (void) -{ -} - -TAO_Valuetype_Adapter * -TAO_Valuetype_Adapter_Factory_Impl::create (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - TAO_Valuetype_Adapter_Impl *nva = 0; - ACE_NEW_THROW_EX (nva, - TAO_Valuetype_Adapter_Impl (), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (nva); - - return nva; -} - -// ********************************************************************* - -// Initialization and registration of dynamic service object. - -int -TAO_Valuetype_Adapter_Factory_Impl::Initializer (void) -{ - TAO_ORB_Core::valuetype_adapter_factory_name ( - "Concrete_Valuetype_Adapter_Factory" - ); - - return - ACE_Service_Config::process_directive ( - ace_svc_desc_TAO_Valuetype_Adapter_Factory_Impl - ); -} - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DEFINE ( - TAO_Valuetype_Adapter_Factory_Impl, - ACE_TEXT ("Concrete_Valuetype_Adapter_Factory"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_Valuetype_Adapter_Factory_Impl), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0 - ) - -ACE_FACTORY_DEFINE (TAO_Valuetype, TAO_Valuetype_Adapter_Factory_Impl) diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h b/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h deleted file mode 100644 index 91b8cbe6e8c..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Adapter_Factory_Impl.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Valuetype_Adapter_Factory_Impl.h - * - * $Id$ - * - * @author Kees van Marle <kvmarle@remedy.nl> - */ -//============================================================================= - - -#ifndef TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H -#define TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H - -#include /**/ "ace/pre.h" - -#include "tao/Valuetype/valuetype_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Valuetype_Adapter_Factory.h" -#include "ace/Service_Config.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -class TAO_Valuetype_Adapter; - -/** - * @class TAO_Valuetype_Adapter_Factory_Impl - * - * @brief TAO_Valuetype_Adapter_Factory_Impl. - * - * Class that creates instances of TAO_Valuetype_Adapter (one per ORB). - * This is the derived class that contains the actual implementations. - */ -class TAO_Valuetype_Export TAO_Valuetype_Adapter_Factory_Impl - : public TAO_Valuetype_Adapter_Factory -{ -public: - virtual ~TAO_Valuetype_Adapter_Factory_Impl (void); - - virtual TAO_Valuetype_Adapter * create ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC ((CORBA::SystemException)); - - // Used to force the initialization of the ORB code. - static int Initializer (void); -}; - -static int -TAO_Requires_ValueType_Initializer = - TAO_Valuetype_Adapter_Factory_Impl::Initializer (); - -TAO_END_VERSIONED_NAMESPACE_DECL - -ACE_STATIC_SVC_DECLARE (TAO_Valuetype_Adapter_Factory_Impl) -ACE_FACTORY_DECLARE (TAO_Valuetype, TAO_Valuetype_Adapter_Factory_Impl) - -#define TAO_VALUETYPE_SAFE_INCLUDE -// #include "tao/ValueType/ValueTypeC.h" -#undef TAO_VALUETYPE_SAFE_INCLUDE - -#include /**/ "ace/post.h" - -#endif /* TAO_VALUETYPE_ADAPTER_FACTORY_IMPL_H */ diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp deleted file mode 100644 index b0a61220626..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// $Id$ - -#include "tao/Valuetype/Valuetype_Adapter_Impl.h" -#include "tao/Valuetype/AbstractBase.h" -#include "tao/Valuetype/ValueBase.h" -#include "tao/Valuetype/ValueFactory_Map.h" - -#include "tao/ORB_Core.h" - - -ACE_RCSID (Valuetype, - Valuetype_Adapter_Impl, - "$Id$") - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -TAO_Valuetype_Adapter_Impl::~TAO_Valuetype_Adapter_Impl (void) -{ -} - -CORBA::Object_ptr -TAO_Valuetype_Adapter_Impl::abstractbase_to_object ( - CORBA::AbstractBase_ptr p - ) -{ - return p->_to_object (); -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::stream_to_value (TAO_InputCDR &cdr, - CORBA::ValueBase *& val) -{ - return cdr >> val; -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::stream_to_abstract_base ( - TAO_InputCDR &cdr, - CORBA::AbstractBase_ptr & obj - ) -{ - return cdr >> obj; -} - -CORBA::Long -TAO_Valuetype_Adapter_Impl::type_info_single (void) const -{ - return TAO_OBV_GIOP_Flags::Type_info_single; -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::is_type_info_implied (CORBA::Long vt) const -{ - return vt == TAO_OBV_GIOP_Flags::Value_tag_base; -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::is_type_info_single (CORBA::Long vt) const -{ - return ((vt | TAO_OBV_GIOP_Flags::Type_info_single) == vt) && - ((vt | TAO_OBV_GIOP_Flags::Type_info_list) != vt); -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::is_type_info_list (CORBA::Long vt) const -{ - return (vt | TAO_OBV_GIOP_Flags::Type_info_list) == vt; -} - -CORBA::Boolean -TAO_Valuetype_Adapter_Impl::is_value_chunked (CORBA::Long vt) const -{ - return (vt | TAO_OBV_GIOP_Flags::Chunking_tag_sigbits) == vt; -} - -int -TAO_Valuetype_Adapter_Impl::vf_map_rebind (const char *repo_id, - CORBA::ValueFactory &factory) -{ - return map_.rebind (repo_id, factory); -} - -int -TAO_Valuetype_Adapter_Impl::vf_map_unbind (const char *repo_id) - -{ - CORBA::ValueFactory fac; - return map_.unbind (repo_id, fac); -} - -CORBA::ValueFactory -TAO_Valuetype_Adapter_Impl::vf_map_find (const char *repo_id) -{ - CORBA::ValueFactory factory = 0; - (void) map_.find (repo_id, factory); - return factory; -} - -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h b/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h deleted file mode 100644 index e24f2a5a70f..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Adapter_Impl.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Valuetype_Adapter_Impl.h - * - * $Id$ - * - * @author Jeff Parsons <j.parsons@vanderbilt.edu> - */ -//============================================================================= - - -#ifndef TAO_VALUETYPE_ADAPTER_IMPL_H -#define TAO_VALUETYPE_ADAPTER_IMPL_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Config.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Valuetype/valuetype_export.h" -#include "tao/Valuetype/ValueFactory_Map.h" -#include "tao/Valuetype_Adapter.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -/** - * @class TAO_Valuetype_Adapter_Impl - * - * @brief TAO_Valuetype_Adapter_Impl. - * - * Class that adapts various functions involving the Valuetype, - * ValueFactory and AbstractInterface classes. This is a concrete class - * implementating the pure virtual methods of TAO_Valuetype_Adapter - */ -class TAO_Valuetype_Export TAO_Valuetype_Adapter_Impl - : public TAO_Valuetype_Adapter -{ -public: - - virtual ~TAO_Valuetype_Adapter_Impl (void); - - virtual CORBA::Object_ptr abstractbase_to_object ( - CORBA::AbstractBase_ptr - ); - - virtual CORBA::Boolean stream_to_value (TAO_InputCDR &, - CORBA::ValueBase *&); - - virtual CORBA::Boolean stream_to_abstract_base ( - TAO_InputCDR &, - CORBA::AbstractBase_ptr & - ); - - virtual CORBA::Long type_info_single (void) const; - - virtual CORBA::Boolean is_type_info_implied (CORBA::Long) const; - virtual CORBA::Boolean is_type_info_single (CORBA::Long) const; - virtual CORBA::Boolean is_type_info_list (CORBA::Long) const; - virtual CORBA::Boolean is_value_chunked (CORBA::Long) const; - - virtual int vf_map_rebind (const char *, - CORBA::ValueFactory &); - - virtual int vf_map_unbind (const char *); - - virtual CORBA::ValueFactory vf_map_find (const char *); - -private: - TAO_ValueFactory_Map map_; -}; - -TAO_END_VERSIONED_NAMESPACE_DECL - -#include /**/ "ace/post.h" -#endif /* TAO_VALUETYPE_ADAPTER_IMPL_H */ diff --git a/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h b/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h deleted file mode 100644 index e9631236169..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Sequence_Element_T.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef guard_valuetype_sequence_element_hpp -#define guard_valuetype_sequence_element_hpp -/** - * @file - * - * @brief Implement the type returned by operator[] in valuetype - * sequences. - * - * $Id$ - * - * @author Carlos O'Ryan - */ -#include "tao/Basic_Types.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ -namespace details -{ - -template<typename obj_ref_traits> -class valuetype_sequence_element -{ -public: - typedef typename obj_ref_traits::object_type valuetype_type; - typedef valuetype_type * value_type; - typedef valuetype_type const * const_value_type; - typedef typename obj_ref_traits::object_type_var valuetype_var; - -private: - inline valuetype_sequence_element<obj_ref_traits> & pseudo_copy_swap( - valuetype_var & rhs) - { - if (release()) - { - obj_ref_traits::release(*element_); - } - *element_ = rhs._retn(); - return *this; - } - -public: - valuetype_sequence_element( - value_type & e, CORBA::Boolean release) - : element_(&e) - , release_(release) - { - } - - valuetype_sequence_element( - valuetype_sequence_element const & rhs) - : element_(rhs.element_) - , release_(rhs.release_) - { - } - - ~valuetype_sequence_element() - { - } - - valuetype_sequence_element & operator=( - valuetype_var const & rhs) - { - valuetype_var tmp(rhs); - return pseudo_copy_swap(tmp); - } - - valuetype_sequence_element & operator=( - valuetype_sequence_element const & rhs) - { - valuetype_var tmp(obj_ref_traits::duplicate(*rhs.element_)); - return pseudo_copy_swap(tmp); - } - - valuetype_sequence_element & operator=(value_type rhs) - { - valuetype_var tmp(rhs); - return pseudo_copy_swap(tmp); - } - - inline operator value_type() - { - return *element_; - } - - inline operator const_value_type() const - { - return *element_; - } - - inline value_type operator->() - { - return *element_; - } - - inline value_type operator->() const - { - return *element_; - } - - void swap(valuetype_sequence_element & rhs) - { - std::swap(element_, rhs.element_); - std::swap(release_, rhs.release_); - } - - inline CORBA::Boolean release() const - { - return release_; - } - -private: - // This function is not implemented - valuetype_sequence_element(); - -private: - value_type * element_; - CORBA::Boolean release_; -}; - -} // namespace details -} // namespace CORBA - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // guard_valuetype_sequence_element_hpp diff --git a/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h b/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h deleted file mode 100644 index 13dfe7ad06d..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Traits_Base_T.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef valuetype_traits_base_hpp -#define valuetype_traits_base_hpp -/** - * @file - * - * @brief Base class for the valuetype traits. - * - * $Id$ - * - * @author Carlos O'Ryan - */ - -#include "tao/Objref_VarOut_T.h" - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ -namespace details -{ - -template<typename object_t, typename object_t_var> -struct valuetype_traits_base -{ - typedef object_t object_type; - typedef object_type * value_type; - typedef object_type const * const_value_type; - typedef object_t_var object_type_var; - - inline static void release(object_type * object) - { - TAO::Value_Traits<object_type>::remove_ref(object); - } - - inline static object_type * duplicate(object_type * object) - { - TAO::Value_Traits<object_type>::add_ref(object); - return object; - } - - inline static object_type * nil() - { - return 0; - } - - inline static object_type * default_initializer() - { - return nil(); - } -}; - -} // namespace details -} // namespace TAO - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // valuetype_traits_base_hpp diff --git a/TAO/tao/Valuetype/Valuetype_Traits_T.h b/TAO/tao/Valuetype/Valuetype_Traits_T.h deleted file mode 100644 index f8b5ee460be..00000000000 --- a/TAO/tao/Valuetype/Valuetype_Traits_T.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef guard_valuetype_traits_hpp -#define guard_valuetype_traits_hpp -/** - * @file - * - * @brief Implement the element manipulation traits for valuetype types. - * - * $Id$ - * - * @author Carlos O'Ryan - */ -#include "Valuetype_Traits_Base_T.h" - -#include <algorithm> -#include <functional> - -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - -namespace TAO -{ -namespace details -{ - -template<class object_t, class object_t_var, class derived> -struct valuetype_traits_decorator -{ - typedef object_t object_type; - typedef object_type * value_type; - typedef object_type const * const_value_type; - typedef object_t_var object_type_var; - - inline static void zero_range( - object_type ** begin, object_type ** end) - { - std::fill(begin, end, derived::nil()); - } - - inline static void initialize_range( - object_type ** begin, object_type ** end) - { - std::generate(begin, end, &derived::default_initializer); - } - - inline static void copy_range( - object_type ** begin, object_type ** end, object_type ** dst) - { - std::transform(begin, end, dst, &derived::duplicate); - } - - inline static void release_range( - object_type ** begin, object_type ** end) - { - std::for_each(begin, end, &derived::release); - } - - inline static object_type const * initialize_if_zero(object_type * & element) - { - if (element == 0) - { - element = derived::nil(); - } - return element; - } -}; - -template<typename object_t, typename object_t_var, bool dummy> -struct valuetype_traits - : public valuetype_traits_base<object_t, object_t_var> - , public valuetype_traits_decorator<object_t, object_t_var, valuetype_traits<object_t,object_t_var,dummy> > -{ - typedef object_t object_type; - typedef object_type * value_type; - typedef object_type const * const_value_type; - typedef object_t_var object_type_var; -}; - -} // namespace details -} // namespace CORBA - -TAO_END_VERSIONED_NAMESPACE_DECL - -#endif // guard_valuetype_traits_hpp diff --git a/TAO/tao/Valuetype/valuetype_export.h b/TAO/tao/Valuetype/valuetype_export.h deleted file mode 100644 index 851fa9a4ea2..00000000000 --- a/TAO/tao/Valuetype/valuetype_export.h +++ /dev/null @@ -1,40 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -// ------------------------------ -#ifndef TAO_VAULETYPE_EXPORT_H -#define TAO_VAULETYPE_EXPORT_H - -#include "ace/config-all.h" - -#if defined (TAO_AS_STATIC_LIBS) -# if !defined (TAO_VALUETYPE_HAS_DLL) -# define TAO_VALUETYPE_HAS_DLL 0 -# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */ -#else -# if !defined (TAO_VALUETYPE_HAS_DLL) -# define TAO_VALUETYPE_HAS_DLL 1 -# endif /* ! TAO_IORINTERCEPTOR_HAS_DLL */ -#endif - -#if defined (TAO_VALUETYPE_HAS_DLL) && (TAO_VALUETYPE_HAS_DLL == 1) -# if defined (TAO_VALUETYPE_BUILD_DLL) -# define TAO_Valuetype_Export ACE_Proper_Export_Flag -# define TAO_VALUETYPE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* TAO_VALUETYPE_BUILD_DLL */ -# define TAO_Valuetype_Export ACE_Proper_Import_Flag -# define TAO_VALUETYPE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* TAO_IORINTERCEPTOR_BUILD_DLL */ -#else /* TAO_VALUETYPE_HAS_DLL == 1 */ -# define TAO_Valuetype_Export -# define TAO_VALUETYPE_SINGLETON_DECLARATION(T) -# define TAO_VALUETYPE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* TAO_VALUETYPE_HAS_DLL == 1 */ - -#endif /* TAO_VAULETYPE_EXPORT_H */ - -// End of auto generated file. |