summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-03-25 05:59:54 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-03-25 05:59:54 +0000
commit375ac2cb534febd87e8449f448f5da3ac52bf6cd (patch)
treebef8c8a69811d862cd35e42c662ae4f9aa1cfb51
parent62611a21d480d907e04c16158b94d0456b718c77 (diff)
downloadATCD-375ac2cb534febd87e8449f448f5da3ac52bf6cd.tar.gz
*** empty log message ***
-rw-r--r--TAO/tao/TypeCode.h70
-rw-r--r--TAO/tao/Typecode.cpp3932
-rw-r--r--TAO/tao/Typecode.h661
-rw-r--r--TAO/tao/Typecode.i133
-rw-r--r--TAO/tao/Typecode_Constants.cpp480
-rw-r--r--TAO/tao/Typecode_typesC.h2
-rw-r--r--TAO/tao/append.cpp2
-rw-r--r--TAO/tao/diffs/Typecode_types.diff2
-rw-r--r--TAO/tao/skip.cpp2
9 files changed, 7 insertions, 5277 deletions
diff --git a/TAO/tao/TypeCode.h b/TAO/tao/TypeCode.h
index 49c616413a7..807738aec30 100644
--- a/TAO/tao/TypeCode.h
+++ b/TAO/tao/TypeCode.h
@@ -29,78 +29,14 @@
#include "tao/Basic_Types.h"
#include "tao/ValueModifierC.h"
#include "tao/VisibilityC.h"
+#include "tao/Typecode_typesC.h"
#include "tao/CORBA_methods.h"
#include "tao/Pseudo_VarOut_T.h"
namespace CORBA
{
- typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
- typedef TAO_Pseudo_Out_T<TypeCode, TypeCode_var> TypeCode_out;
-
- /**
- * @enum TCKind
- *
- * Kinds of @c TypeCodes in the CORBA namespace, as defined by the
- * OMG.
- */
- enum TCKind
- {
- // = Kinds of typecodes.
-
- // Do not change these enum values, or duplicate them if you need
- // to add values. They are used to index tables, and if you
- // change the values you'll need to find and update all of those
- // tables. The values are also part of the Common Data
- // Representation, and hence are part of IIOP and other ORB
- // protocols.
-
- tk_null = 0,
- tk_void = 1,
- tk_short = 2,
- tk_long = 3,
- tk_ushort = 4,
- tk_ulong = 5,
- tk_float = 6,
- tk_double = 7,
- tk_boolean = 8,
- tk_char = 9,
- tk_octet = 10,
- tk_any = 11,
- tk_TypeCode = 12,
- tk_Principal = 13,
- tk_objref = 14,
- tk_struct = 15,
- tk_union = 16,
- tk_enum = 17,
- tk_string = 18,
- tk_sequence = 19,
- tk_array = 20,
- tk_alias = 21,
- tk_except = 22,
-
- tk_longlong = 23,
- tk_ulonglong = 24,
- tk_longdouble = 25,
- tk_wchar = 26,
- tk_wstring = 27,
- tk_fixed = 28,
- tk_value = 29,
- tk_value_box = 30,
- tk_native = 31,
- tk_abstract_interface = 32,
- tk_local_interface = 33,
- tk_component = 34,
- tk_home = 35,
- tk_event = 36,
-
- // This symbol is not defined by CORBA 3.0. It's used to speed up
- // dispatch based on TCKind values, and lets many important ones
- // just be table lookups. It must always be the last enum value!!
-
- TAO_TC_KIND_COUNT
- };
-
- typedef TCKind & TCKind_out;
+ typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
+ typedef TAO_Pseudo_Out_T<TypeCode, TypeCode_var> TypeCode_out;
/**
* @class TypeCode
diff --git a/TAO/tao/Typecode.cpp b/TAO/tao/Typecode.cpp
deleted file mode 100644
index 86bd9cc8dae..00000000000
--- a/TAO/tao/Typecode.cpp
+++ /dev/null
@@ -1,3932 +0,0 @@
-// $Id$
-
-// Typecodes essentially consist of just the CDR octets that get
-// marshaled and unmarshaled, and this code knows how to parse those
-// octets and answer questions CORBA's TypeCode APIs require.
-//
-// NOTE: This isn't well tuned performance-wise. Given how much is
-// variable (byte order, alignment) it's clear tuning has its limits
-// with respect to CDR bytecode interpretation.
-//
-// THREADING NOTE: Typecodes are readonly data structures, and the
-// only mutual exclusion relates to reference counting and
-// construction.
-
-#include "Typecode.h"
-#include "Any.h"
-#include "Marshal.h"
-#include "CORBA_String.h"
-#include "CDR.h"
-#include "debug.h"
-#include "Any_Unknown_IDL_Type.h"
-#include "ORB_Constants.h"
-#include "SystemException.h"
-#include "orb_typesC.h"
-#include "ValueModifierC.h"
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) \
- || defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-# include "tao/Sequence_T.h"
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
-#include "ace/Guard_T.h"
-#include "ace/Malloc_Base.h"
-#include "ace/Null_Mutex.h"
-#include "ace/OS_NS_string.h"
-
-#if !defined (__ACE_INLINE__)
-# include "tao/Typecode.i"
-#endif /* ! __ACE_INLINE__ */
-
-
-ACE_RCSID (tao,
- Typecode,
- "$Id$")
-
-// Typecodes essentially consist of just the CDR octets that get
-// marshaled and unmarshaled, and this code knows how to parse those
-// octets and answer questions CORBA's TypeCode APIs require.
-
-CORBA::TypeCode::Bounds::Bounds (void)
- : CORBA::UserException ("IDL:omg.org/CORBA/TypeCode/Bounds:1.0",
- "Bounds")
-{
-}
-
-CORBA::TypeCode::Bounds*
-CORBA::TypeCode::Bounds::_downcast (CORBA::Exception *ex)
-{
- return dynamic_cast <CORBA::TypeCode::Bounds*> (ex);
-}
-
-CORBA::Exception *
-CORBA::TypeCode::Bounds::_alloc (void)
-{
- CORBA::Exception *retval = 0;
- ACE_NEW_RETURN (retval, ::CORBA::TypeCode::Bounds, 0);
- return retval;
-}
-
-CORBA::Exception *
-CORBA::TypeCode::Bounds::_tao_duplicate (void) const
-{
- CORBA::Exception *result;
- ACE_NEW_RETURN (result,
- CORBA::TypeCode::Bounds (*this),
- 0);
- return result;
-}
-
-void
-CORBA::TypeCode::Bounds::_raise (void) const
-{
- TAO_RAISE(*this);
-}
-
-void
-CORBA::TypeCode::Bounds::_tao_encode (TAO_OutputCDR &cdr
- ACE_ENV_ARG_DECL) const
-{
- if (cdr << this->_rep_id ())
- {
- return;
- }
-
- ACE_THROW (CORBA::MARSHAL ());
-}
-
-void
-CORBA::TypeCode::Bounds::_tao_decode (TAO_InputCDR &
- ACE_ENV_ARG_DECL_NOT_USED)
-{
-}
-
-// ****************************************************************
-
-CORBA::TypeCode::BadKind::BadKind (void)
- : CORBA::UserException ("IDL:omg.org/CORBA/TypeCode/BadKind:1.0",
- "BadKind")
-{
-}
-
-CORBA::TypeCode::BadKind*
-CORBA::TypeCode::BadKind::_downcast (CORBA::Exception *ex)
-{
- return dynamic_cast <CORBA::TypeCode::BadKind*> (ex);
-}
-
-CORBA::Exception *
-CORBA::TypeCode::BadKind::_tao_duplicate (void) const
-{
- CORBA::Exception *result;
- ACE_NEW_RETURN (result,
- CORBA::TypeCode::BadKind (*this),
- 0);
- return result;
-}
-
-void
-CORBA::TypeCode::BadKind::_raise (void) const
-{
- TAO_RAISE(*this);
-}
-
-void
-CORBA::TypeCode::BadKind::_tao_encode (TAO_OutputCDR &cdr
- ACE_ENV_ARG_DECL) const
-{
- if (cdr << this->_rep_id ())
- {
- return;
- }
-
- ACE_THROW (CORBA::MARSHAL ());
-}
-
-void
-CORBA::TypeCode::BadKind::_tao_decode (TAO_InputCDR &
- ACE_ENV_ARG_DECL_NOT_USED)
-{
-}
-
-// ****************************************************************
-
-// Constructor for CONSTANT typecodes with empty parameter lists.
-// These are only created once, and those constants are shared.
-
-CORBA::TypeCode::TypeCode (CORBA::TCKind kind)
- : length_ (0),
- buffer_ (0),
- byte_order_ (ACE_CDR_BYTE_ORDER),
- kind_ (kind),
- parent_ (0),
- tc_base_ (0),
- root_tc_base_ (0),
- refcount_ (1),
- orb_owns_ (1),
- private_state_ (new TAO::TC_Private_State (kind)),
- non_aligned_buffer_ (0),
- offset_map_ (0)
-{
-}
-
-CORBA::TypeCode::TypeCode (CORBA::TCKind kind,
- size_t length,
- const char *buffer,
- CORBA::Boolean orb_owns_tc,
- CORBA::ULong /* size */,
- CORBA::TypeCode_ptr parent)
- : length_ (length),
- kind_ (kind),
- parent_ (parent),
- refcount_ (1),
- orb_owns_ (orb_owns_tc),
- private_state_ (new TAO::TC_Private_State (kind)),
- non_aligned_buffer_ (0),
- offset_map_ (0)
-{
- // The CDR code used to interpret TypeCodes requires in-memory
- // alignments to match the "on-the-wire" alignments, simplifying
- // algorithms used to marshal/unmarshal.
- //
- // However, it's often hard to get compilers (in particular) to
- // generate data that's so aligned, since C++ doesn't provide
- // primitives giving control at that low a level. Although there
- // are ways to get that alignment which work in almost all cases, we
- // need to ensure adequate alignment in _all_ cases.
- //
- // This code exists to ensure such alignment; since the constructor
- // is intended only for use by an IDL compiler or ORB code, it's not
- // currently a priority to ensure the allocated code is freed.
-
- // TAO comments:
-
- // For free standing typecodes, we choose to always make a copy of
- // the buffer passed in. That way, our destructor doesn't have to
- // deal with the case where the buffer was either allocated in which
- // case it must be freed or the case where our buffer just points to
- // the buffer passed in.
-
- if (this->parent_ == 0)
- {
- // Allocate a buffer to hold the encapsulated stream. We
- // allocate extra space since we need a buffer that is aligned
- // on a 4 byte word boundary. As a result, it is quite possible
- // that we may start accessing the buffer from a position
- // shifted to the right in the allocated buffer. As a result,
- // during destruction, we do not want part of the allocated heap
- // to remain dangling. Hence we save a handle to the original
- // allocated buffer.
-
- // *NOTE* that the buffer parameter is simply our encapsulation. It
- // does not contain our TypeCode::kind () and the length. These are
- // passed as separate parameters. However, in case of indirected
- // offset value for the indirection will effectively point to the
- // typecodes, the tk_kind field in our CDR representation. Hence,
- // we introduce a new field called tc_base_ which represents the
- // start of our CDR representation. The buffer_ data member will
- // point to our encapsulation.
-
- // @@ The typecode buffer contain the encapsulation byte order
- // in the first byte...
- const CORBA::Octet *ptr =
- reinterpret_cast <const CORBA::Octet *> (buffer);
- this->byte_order_ = *ptr;
-
- // allocate a buffer which will accomodate our entire encapsulation
- // plus 4 bytes for our tk_kind value and 4 bytes for our encapsulation
- // length. The extra MAX_ALIGNMENT bytes are necessary to ensure
- // that we will get a properly aligned buffer.
-
- static const size_t lsize = sizeof (CORBA::ULong);
- ACE_NEW (this->non_aligned_buffer_,
- char [this->length_ + lsize + lsize + ACE_CDR::MAX_ALIGNMENT]);
-
- char* start = ACE_ptr_align_binary (this->non_aligned_buffer_,
- ACE_CDR::MAX_ALIGNMENT);
-
- // length_ is of size_t which, on 64-bit platforms, is 64 bits.
- // The value to be copied is expected to be 32-bit. We will cast
- // the value down to a CORBA::ULong and copy that.
- CORBA::ULong length = static_cast <CORBA::ULong> (this->length_);
-
- (void) ACE_OS::memcpy (start, &this->kind_, lsize);
- (void) ACE_OS::memcpy (start + lsize, &length, lsize);
- (void) ACE_OS::memcpy (start + lsize + lsize, buffer, this->length_);
- // we are the topmost level typecode and hence our typecode base is
- // the start whereas the buffer_ which represents the encapsulation
- // is 8 bytes ahead of the typecode base
- this->tc_base_ = start;
- // since we do not have any parents, we are the root
- this->root_tc_base_ = start;
- this->buffer_ = start + lsize + lsize;
- }
- else
- {
- // We are a child. We do not allocate a new buffer, but share it
- // with our parent. We know that our parent's buffer was
- // properly aligned.
- const CORBA::Octet *ptr =
- reinterpret_cast <const CORBA::Octet *> (buffer);
- this->byte_order_ = *ptr;
-
- this->buffer_ = buffer;
- // our typecode base is 8 bytes prior to our encapsulation and our
- // root base is the same as that of our parent's
- this->tc_base_ = this->buffer_ - 8;
- this->root_tc_base_ = parent->root_tc_base_;
- }
-}
-
-// Destructor. For "indirected" typecodes and children, the typecode
-// reuses the buffer owned by its parent.
-
-CORBA::TypeCode::~TypeCode (void)
-{
- // Delete the original, possibly nonaligned, buffer.
- delete [] this->non_aligned_buffer_;
- this->non_aligned_buffer_ = 0;
-
- this->buffer_ = 0;
-
- // Free up our private state.
- delete this->private_state_;
- this->private_state_ = 0;
-
- if (this->offset_map_ != 0)
- {
- OFFSET_MAP_ENTRY *entry = 0;
-
- for (CORBA::TypeCode::OFFSET_MAP_ITERATOR iter (*this->offset_map_);
- iter.next (entry) != 0;
- iter.advance ())
- {
- CORBA::string_free ((char*)entry->ext_id_);
- delete entry->int_id_;
- }
- }
-
- delete this->offset_map_;
- this->offset_map_ = 0;
-}
-
-
-// Return the i-th member typecode if it exists, else raise an
-// exception. Possible exceptions are BadKind and Bounds.
-//
-// Applicable only to struct, union, and except
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::member_type (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- if (this->private_state_->tc_member_count_known_
- && this->private_state_->tc_member_type_list_known_)
- {
- if (slot < this->private_state_->tc_member_count_)
- {
- return
- CORBA::TypeCode::_duplicate (
- this->private_state_->tc_member_type_list_[slot]);
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- }
- else
- {
- return
- CORBA::TypeCode::_duplicate (
- this->private_member_type (slot
- ACE_ENV_ARG_PARAMETER));
- }
-}
-
-// Applicable only to struct, union, and except
-
-const char *
-CORBA::TypeCode::member_name (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- if (this->private_state_->tc_member_count_known_
- && this->private_state_->tc_member_name_list_known_)
- {
- if (slot < this->private_state_->tc_member_count_)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- else
- {
- return this->private_member_name (slot
- ACE_ENV_ARG_PARAMETER);
- }
-}
-
-// Return the label of the i-th member. Applicable only to CORBA::tk_union
-CORBA::Any_ptr
-CORBA::TypeCode::member_label (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- CORBA::Any_ptr retval = 0;
-
- if (this->private_state_->tc_member_count_known_
- && this->private_state_->tc_member_label_list_known_)
- {
- if (slot < this->private_state_->tc_member_count_)
- {
- ACE_NEW_RETURN (
- retval,
- CORBA::Any (*this->private_state_->tc_member_label_list_[slot]),
- 0
- );
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- else
- {
- CORBA::Any_ptr label =
- this->private_member_label (slot
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- ACE_NEW_RETURN (retval,
- CORBA::Any (*label),
- 0);
- }
-
- return retval;
-}
-
-// only applicable to CORBA::tk_unions
-CORBA::TypeCode_ptr
-CORBA::TypeCode::discriminator_type (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->kind_ != CORBA::tk_union)
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- CORBA::TypeCode::_nil ());
-
- if (this->private_state_->tc_discriminator_type_known_)
- return
- CORBA::TypeCode::_duplicate (
- this->private_state_->tc_discriminator_type_);
-
- CORBA::TypeCode_ptr type =
- this->private_discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- return CORBA::TypeCode::_duplicate (type);
-}
-
-// only applicable to CORBA::tk_unions
-CORBA::Long
-CORBA::TypeCode::default_index (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->kind_ != CORBA::tk_union)
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
-
- if (this->private_state_->tc_default_index_used_known_)
- return this->private_state_->tc_default_index_used_;
- else
- return this->private_default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
-}
-
-// returns the length. Applicable only to string, sequence, and arrays
-CORBA::ULong
-CORBA::TypeCode::length (ACE_ENV_SINGLE_ARG_DECL) const
-{
- // a switch stmt, unfortunately, doesn't get inlined
- if (this->kind_ == CORBA::tk_sequence
- || this->kind_ == CORBA::tk_array
- || this->kind_ == CORBA::tk_string
- || this->kind_ == CORBA::tk_wstring)
- {
- if (this->private_state_->tc_length_known_)
- return this->private_state_->tc_length_;
- else
- return this->private_length (ACE_ENV_SINGLE_ARG_PARAMETER);
- }
- else
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0);
-}
-
-// returns the typecode. Applicable only to string, sequence, and arrays
-CORBA::TypeCode_ptr
-CORBA::TypeCode::content_type (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->kind_ == CORBA::tk_sequence
- || this->kind_ == CORBA::tk_array
- || this->kind_ == CORBA::tk_alias)
- {
- if (this->private_state_->tc_content_type_known_)
- return CORBA::TypeCode::_duplicate (
- this->private_state_->tc_content_type_
- );
- else
- {
- CORBA::TypeCode_ptr tmp =
- this->private_content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- return CORBA::TypeCode::_duplicate (tmp);
- }
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-
-}
-
-CORBA::UShort
-CORBA::TypeCode::fixed_digits (ACE_ENV_SINGLE_ARG_DECL) const
-{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
-}
-
-CORBA::Short
-CORBA::TypeCode::fixed_scale (ACE_ENV_SINGLE_ARG_DECL) const
-{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
-}
-
-CORBA::Visibility
-CORBA::TypeCode::member_visibility (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- if (this->private_state_->tc_member_count_known_
- && this->private_state_->tc_member_visibility_list_known_)
- {
- if (slot < this->private_state_->tc_member_count_)
- {
- return this->private_state_->tc_member_visibility_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- else
- {
- CORBA::Visibility v =
- this->private_member_visibility (slot
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::PRIVATE_MEMBER);
-
- return v;
- }
-}
-
-CORBA::ValueModifier
-CORBA::TypeCode::type_modifier (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->private_state_->tc_type_modifier_known_)
- {
- return this->private_state_->tc_type_modifier_;
- }
- else
- {
- CORBA::ValueModifier vm =
- this->private_type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::VM_NONE);
-
- return vm;
- }
-}
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->private_state_->tc_concrete_base_type_known_)
- {
- return CORBA::TypeCode::_duplicate (
- this->private_state_->tc_concrete_base_type_
- );
- }
- else
- {
- CORBA::TypeCode_ptr tmp =
- this->private_concrete_base_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- return CORBA::TypeCode::_duplicate (tmp);
- }
-}
-
-// skip a typecode encoding in a given CDR stream
-// This is just a helper function
-CORBA::Boolean
-CORBA::TypeCode::skip_typecode (TAO_InputCDR &stream)
-{
- CORBA::ULong kind;
- CORBA::ULong temp;
-
- if (stream.read_ulong (kind)
- && (kind < CORBA::TC_KIND_COUNT || kind == ~0u))
- {
-
- switch (kind)
- {
- // Most TypeCodes have empty parameter lists, nothing to skip
- default:
- break;
-
- // Some have single integer parameters, easy to skip. Some have
- // preallocated constants that could be used.
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- case ~0u:
- return (stream.read_ulong (temp) != 0);
-
- // The rest have "complex" parameter lists that are
- // encoded as bulk octets ... just skip them.
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- case CORBA::tk_value:
- return (stream.read_ulong (temp) != 0
- && stream.skip_bytes (temp) != 0);
- }
-
- return 1;
- }
- else
- return 0;
-}
-
-// constructor for the private state
-TAO::TC_Private_State::TC_Private_State (CORBA::TCKind kind)
- : tc_kind_ (kind),
- tc_id_known_ (0),
- tc_name_known_ (0),
- tc_member_count_known_ (0),
- tc_member_type_list_known_ (0),
- tc_member_name_list_known_ (0),
- tc_member_label_list_known_ (0),
- tc_discriminator_type_known_ (0),
- tc_default_index_used_known_ (0),
- tc_length_known_ (0),
- tc_content_type_known_ (0),
- tc_discrim_pad_size_known_ (0),
- tc_member_visibility_list_known_ (0),
- tc_type_modifier_known_ (0),
- tc_concrete_base_type_known_ (0),
- tc_id_ (0),
- tc_name_ (0),
- tc_member_count_ (0),
- tc_member_type_list_ (0),
- tc_member_name_list_ (0),
- tc_member_label_list_ (0),
- tc_discriminator_type_ (0),
- tc_default_index_used_ (0),
- tc_length_ (0),
- tc_content_type_ (0),
- tc_member_visibility_list_ (0),
- tc_type_modifier_ (0),
- tc_concrete_base_type_ (0)
-{
-}
-
-// Destructor for the private state. In effect, this cleans up all the
-// children and the subtree we hold.
-TAO::TC_Private_State::~TC_Private_State (void)
-{
- // The following just point into the buffer. So we just make it
- // point to 0.
- this->tc_id_ = 0;
-
- if (this->tc_name_ != 0)
- {
- CORBA::string_free (this->tc_name_);
- this->tc_name_ = 0;
- }
-
- // Determine what kind of children we may have and free the space
- // accordingly.
- switch (this->tc_kind_)
- {
- case CORBA::tk_enum:
-
- // free up the member name list
- if (this->tc_member_name_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::string_free (this->tc_member_name_list_ [i]);
- this->tc_member_name_list_ [i] = 0;
- }
-
- delete [] this->tc_member_name_list_;
- this->tc_member_name_list_ = 0;
- }
-
- break;
-
- case CORBA::tk_struct:
- case CORBA::tk_except:
-
- // Free up the member name list
- if (this->tc_member_name_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::string_free (this->tc_member_name_list_ [i]);
- this->tc_member_name_list_ [i] = 0;
- }
-
- delete [] this->tc_member_name_list_;
- this->tc_member_name_list_ = 0;
- }
-
- // Free up member type list
- if (this->tc_member_type_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::release (this->tc_member_type_list_[i]);
- }
-
- // Now free up the array.
- delete [] this->tc_member_type_list_;
- this->tc_member_type_list_ = 0;
- }
-
- this->tc_member_count_ = 0;
-
- break;
-
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- // Delete the content type only if it has a parent i.e., if it
- // is not acquired from the pool of constant or predefined
- // TypeCodes.
- if (this->tc_content_type_known_ && this->tc_content_type_ != 0)
- {
- CORBA::release (this->tc_content_type_);
- this->tc_content_type_ = 0;
- }
-
- break;
-
- case CORBA::tk_union:
- {
- // Free up the member name list.
- if (this->tc_member_name_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::string_free (this->tc_member_name_list_ [i]);
- this->tc_member_name_list_ [i] = 0;
- }
-
- delete [] this->tc_member_name_list_;
- }
-
- // Free up type list, label list, and finally the
- // discriminator.
- if (this->tc_member_type_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::release (this->tc_member_type_list_[i]);
- }
-
- // Now free up the array.
- delete [] this->tc_member_type_list_;
- this->tc_member_type_list_ = 0;
- }
-
- if (this->tc_member_label_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- // Free up the label (Any_ptr).
- delete this->tc_member_label_list_[i];
-
- delete [] this->tc_member_label_list_;
- this->tc_member_label_list_ = 0;
- }
-
- this->tc_member_count_ = 0;
-
- // Discriminator must come last b/c it will be inside the Any
- // in each element of the label list.
- CORBA::release (this->tc_discriminator_type_);
- this->tc_discriminator_type_ = 0;
- }
-
- break;
-
- case CORBA::tk_value:
- // Free up the member name list.
- if (this->tc_member_name_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::string_free (this->tc_member_name_list_ [i]);
- this->tc_member_name_list_ [i] = 0;
- }
-
- delete [] this->tc_member_name_list_;
- this->tc_member_name_list_ = 0;
- }
-
- // Free up member type list.
- if (this->tc_member_type_list_known_)
- {
- for (CORBA::ULong i = 0; i < this->tc_member_count_; ++i)
- {
- CORBA::release (this->tc_member_type_list_[i]);
- }
-
- // Now free up the array.
- delete [] this->tc_member_type_list_;
- this->tc_member_type_list_ = 0;
- }
-
- this->tc_member_count_ = 0;
-
- // Free up the member visibility list.
- if (this->tc_member_visibility_list_known_)
- {
- delete [] this->tc_member_visibility_list_;
- this->tc_member_visibility_list_ = 0;
- }
-
- // Free up concrete base value typecode.
- if (this->tc_concrete_base_type_known_)
- {
- CORBA::release (this->tc_concrete_base_type_);
- this->tc_concrete_base_type_ = 0;
- }
-
- break;
-
- default:
- break;
- }
-}
-
-// Point of recursion for equal() and equivalent().
-CORBA::Boolean
-CORBA::TypeCode::equ_common (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // This will catch applications that haven't initialized an ORB.
- if (CORBA::is_nil (tc))
- {
- return 0;
- }
-
- // Are the two pointers the same?
- if (this == tc)
- {
- return 1;
- }
-
- if (equiv_only)
- {
- CORBA::TypeCode_var rcvr =
- CORBA::TypeCode::_duplicate (const_cast <CORBA::TypeCode *> (this));
-
- CORBA::Boolean status = (this->kind_ == CORBA::tk_alias);
-
- while (status)
- {
- rcvr = rcvr->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- status =
- (rcvr->kind (ACE_ENV_SINGLE_ARG_PARAMETER) == CORBA::tk_alias);
- ACE_CHECK_RETURN (0);
- }
-
- CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
- status = (kind == CORBA::tk_alias);
-
- // Added by Bala to check for leaks as content_type duplicates the
- // pointers
- CORBA::TypeCode_var tcvar =
- CORBA::TypeCode::_duplicate (const_cast <CORBA::TypeCode *> (tc));
-
- while (status)
- {
- tcvar = tcvar->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- kind = tcvar->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
- status = (kind == CORBA::tk_alias);
- }
-
- kind = rcvr->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
- CORBA::TCKind other_kind = tcvar->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (kind != other_kind)
- {
- return 0;
- }
-
- // Typecode kinds are same.
- return rcvr->private_equal (tcvar.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- }
-
- CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (this->kind_ != kind)
- {
- return 0;
- }
-
- // typecode kinds are same
- return this->private_equal (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
-}
-
-// check if typecodes are equal. Equality is based on a mix of structural
-// and name equivalence i.e., if names are provided, we also check for name
-// equivalence, else resort simply to structural equivalence.
-CORBA::Boolean
-CORBA::TypeCode::private_equal (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // We come in here only if the typecode kinds of both are same
- // Handle each complex typecode separately.
- switch (this->kind_)
- {
- case CORBA::tk_null:
- case CORBA::tk_void:
- case CORBA::tk_short:
- case CORBA::tk_ushort:
- case CORBA::tk_long:
- case CORBA::tk_ulong:
- case CORBA::tk_float:
- case CORBA::tk_double:
- case CORBA::tk_longlong:
- case CORBA::tk_ulonglong:
- case CORBA::tk_longdouble:
- case CORBA::tk_boolean:
- case CORBA::tk_octet:
- case CORBA::tk_char:
- case CORBA::tk_wchar:
- case CORBA::tk_TypeCode:
- case CORBA::tk_Principal:
- case CORBA::tk_any:
- // all these are simple typecodes and the comparison is based
- // solely on the kind_ field
- return 1;
- case CORBA::tk_component:
- case CORBA::tk_home:
- case CORBA::tk_objref:
- case CORBA::tk_abstract_interface:
- case CORBA::tk_local_interface:
- return this->private_equal_objref (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_struct:
- return this->private_equal_struct (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_union:
- return this->private_equal_union (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_enum:
- return this->private_equal_enum (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- return this->private_equal_string (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_sequence:
- return this->private_equal_sequence (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_array:
- return this->private_equal_array (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_value_box:
- case CORBA::tk_alias:
- return this->private_equal_alias (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_except:
- return this->private_equal_except (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case CORBA::tk_value:
- case CORBA::tk_event:
- return this->private_equal_valuetype (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- case ~0u: // indirection
- {
- // indirection offset must be same
- return 1;
- }
- ACE_NOTREACHED (break);
- default:
- return 0;
- }
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_objref (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL
- ) const
-{
- // Compare the repoID and name, of which the name is optional as per GIOP
- // spec. However, the repoID is mandatory.
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strcmp (my_id, tc_id) == 0)
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- // Name check is skipped by equivalent().
- else
- {
- // same repository IDs. Now check their names
- const char *myname = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tcname = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if ((ACE_OS::strlen (myname) > 1)
- && (ACE_OS::strlen (tcname) > 1))
- {
- // Both of them specify names, compare them
- if (ACE_OS::strcmp (myname, tcname) == 0)
- {
- return 1; // success
- }
- else
- {
- return 0; // failed
- }
- }
-
- return 1; // success
- }
- }
-
- return 0; // failed
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_struct (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL
- ) const
-{
- // For structs the repoID and names are optional. However, if provided,
- // we must compare them
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // compare repoIDs if they exist
- if (ACE_OS::strlen (my_id) > 1 && ACE_OS::strlen (tc_id) > 1)
- {
- if (ACE_OS::strcmp (my_id, tc_id)) // not same
- {
- return 0;
- }
- else
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- }
- }
-
- // Skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // Compare names if they exist.
- if (ACE_OS::strlen (my_name) > 1
- && ACE_OS::strlen (tc_name) > 1
- && ACE_OS::strcmp (my_name, tc_name) != 0) // not same
- {
- return 0;
- }
- }
-
- // Check if the member count is same.
- CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_count = tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_count != tc_count)
- {
- return 0; // number of members don't match
- }
-
- // The checks below tell if we have a recursive struct.
- CORBA::TypeCode_ptr par = this->parent_;
-
- if (par != 0)
- {
- if (this->tc_base_ == this->root_tc_base_)
- {
- return 1;
- }
-
- CORBA::TypeCode_ptr tc_par = tc->parent_;
-
- if (tc_par)
- {
- CORBA::TypeCode_ptr gpar = par->parent_;
- CORBA::TypeCode_ptr tc_gpar = tc_par->parent_;
-
- if (gpar != 0
- && tc_gpar != 0
- && this->tc_base_ == gpar->tc_base_
- && tc->tc_base_ == tc_gpar->tc_base_)
- {
- return 1;
- }
- }
- }
-
- for (CORBA::ULong i = 0; i < my_count; ++i)
- {
- // Skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_member_name =
- this->member_name (i ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_member_name =
- tc->member_name (i ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (my_member_name) > 1
- && ACE_OS::strlen (tc_member_name) > 1
- && ACE_OS::strcmp (my_member_name, tc_member_name) != 0)
- {
- return 0;
- }
- }
-
- // now compare the typecodes of the members
- CORBA::TypeCode_var my_member_tc =
- this->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_member_tc =
- tc->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // One of our members may be recursive, but not through us.
- if (my_member_tc->parent_ != 0
- && my_member_tc->parent_ == tc_member_tc->parent_
- && my_member_tc->tc_base_ == tc_member_tc->tc_base_
- && my_member_tc->root_tc_base_ == tc_member_tc->root_tc_base_)
- {
- continue;
- }
-
- CORBA::Boolean flag =
- my_member_tc->equ_common (tc_member_tc.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (!flag)
- {
- return 0;
- }
- }
-
- return 1; // success
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_union (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // For unions the repoID and names are optional. However, if provided, we
- // must compare them
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // compare repoIDs if they exist
- if (ACE_OS::strlen (my_id) > 1 && ACE_OS::strlen (tc_id) > 1)
- {
- if (ACE_OS::strcmp (my_id, tc_id)) // not same
- {
- return 0;
- }
- else
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- }
- }
-
- // Skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // Compare names if they exist.
- if (ACE_OS::strlen (my_name) > 1
- && ACE_OS::strlen (tc_name) > 1
- && ACE_OS::strcmp (my_name, tc_name) != 0) // not same
- {
- return 0;
- }
- }
-
- // check if the discriminant type is same
- CORBA::TypeCode_var my_discrim =
- this->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_discrim =
- tc->discriminator_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Boolean status = my_discrim->equ_common (tc_discrim.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (status == 0)
- {
- return 0;
- }
-
- // Check the default used.
- CORBA::Long my_default = this->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Long tc_default = tc->default_index (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_default != tc_default)
- {
- return 0;
- }
-
- // check if the member count is same
- CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_count = tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_count != tc_count)
- {
- return 0;
- }
-
- // The checks below indicate that we have a recursive union.
- CORBA::TypeCode_ptr par = this->parent_;
-
- if (par != 0)
- {
- if (this->tc_base_ == this->root_tc_base_)
- {
- return 1;
- }
-
- CORBA::TypeCode_ptr tc_par = tc->parent_;
-
- if (tc_par)
- {
- CORBA::TypeCode_ptr gpar = par->parent_;
- CORBA::TypeCode_ptr tc_gpar = tc_par->parent_;
-
- if (gpar != 0
- && tc_gpar != 0
- && this->tc_base_ == gpar->tc_base_
- && tc->tc_base_ == tc_gpar->tc_base_)
- {
- return 1;
- }
- }
- }
-
- for (CORBA::ULong i = 0; i < my_count; ++i)
- {
- // First check if labels are same.
-
- // Check if member names are same - skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_member_name =
- this->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_member_name =
- tc->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (my_member_name) > 1
- && ACE_OS::strlen (tc_member_name) > 1
- && ACE_OS::strcmp (my_member_name,
- tc_member_name)) // not same
- {
- return 0;
- }
- }
-
- // now compare the typecodes of the members
- CORBA::TypeCode_var my_member_tc =
- this->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_member_tc =
- tc->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // One of our members may be recursive, but not through us.
- if (my_member_tc->parent_ != 0
- && my_member_tc->parent_ == tc_member_tc->parent_
- && my_member_tc->tc_base_ == tc_member_tc->tc_base_
- && my_member_tc->root_tc_base_ == tc_member_tc->root_tc_base_)
- {
- continue;
- }
-
- CORBA::Boolean flag = my_member_tc->equ_common (tc_member_tc.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (flag == 0)
- {
- return 0;
- }
- }
-
- return 1; // success
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_enum (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // For enums the repoID and names are optional. However, if
- // provided, we must compare them.
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // compare repoIDs if they exist
- if (ACE_OS::strlen (my_id) > 1 && ACE_OS::strlen (tc_id) > 1)
- {
- if (ACE_OS::strcmp (my_id, tc_id)) // not same
- {
- return 0;
- }
- else
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- }
- }
-
- // Skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // Compare names if they exist.
- if (ACE_OS::strlen (my_name) > 1
- && ACE_OS::strlen (tc_name) > 1
- && ACE_OS::strcmp (my_name, tc_name)) // not same
- {
- return 0;
- }
- }
-
- // Check if the member count is same.
- CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_count = tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_count != tc_count)
- {
- return 0;
- }
-
- for (CORBA::ULong i=0; i < my_count; ++i)
- {
- // Check if member names are same - skipped by equivalent().
- if (!equiv_only)
- {
- const char *my_member_name =
- this->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_member_name =
- tc->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (my_member_name) > 1
- && ACE_OS::strlen (tc_member_name) > 1
- && ACE_OS::strcmp (my_member_name, tc_member_name) != 0)
- {
- return 0;
- }
- }
- }
-
- return 1; // success
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_string (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean /* equiv_only */
- ACE_ENV_ARG_DECL
- ) const
-{
- // compare the lengths
- CORBA::ULong my_len = this->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_len = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- return (my_len == tc_len);
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_wstring (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean /* equiv_only */
- ACE_ENV_ARG_DECL
- ) const
-{
- // compare the lengths
- CORBA::ULong my_len = this->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_len = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- return (my_len == tc_len);
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_sequence (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL
- ) const
-{
- // this involves comparing the typecodes of the element type as well
- // as the bounds
- CORBA::TypeCode_var my_elem =
- this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_elem =
- tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Boolean status = my_elem->equ_common (tc_elem.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (status == 0)
- {
- return 0;
- }
-
- // Now check if bounds are same.
- CORBA::ULong my_len = this->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_len = tc->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- return (my_len == tc_len);
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_array (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // Exactly like sequence
- return this->private_equal_sequence (tc,
- equiv_only
- ACE_ENV_ARG_PARAMETER);
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_alias (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // For structs the repoID and names are optional. However, if
- // provided, we must compare them.
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *my_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // Compare repository IDs if they exist.
- if (ACE_OS::strlen (my_id) > 1 && ACE_OS::strlen (tc_id) > 1)
- {
- if (ACE_OS::strcmp (my_id, tc_id) != 0) // not same
- {
- return 0;
- }
- }
-
- // Compare names if they exist.
- if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1)
- {
- if (ACE_OS::strcmp (my_name, tc_name) != 0) // not same
- {
- return 0;
- }
- }
-
- // Now compare element TypeCodes.
- CORBA::TypeCode_var my_elem =
- this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_elem =
- tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- return my_elem->equ_common (tc_elem.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
-}
-
-CORBA::Boolean
-CORBA::TypeCode::private_equal_except (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const
-{
- // Exactly similar to structs, except that the repository ID is
- // mandatory.
-
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strcmp (my_id, tc_id) != 0)
- {
- return 0; // failed
- }
- else
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- }
-
- // Now compare names. They may be optional.
- const char *my_name = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- // Compare names if they exist.
- if (ACE_OS::strlen (my_name) > 1
- && ACE_OS::strlen (tc_name) > 1
- && ACE_OS::strcmp (my_name, tc_name) != 0) // not same
- {
- return 0;
- }
-
- // Check if the member count is same.
- CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_count = tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_count != tc_count)
- {
- return 0; // number of members don't match
- }
-
- for (CORBA::ULong i = 0; i < my_count; ++i)
- {
- // Check if member names are same.
- const char *my_member_name =
- this->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_member_name =
- tc->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (my_member_name) > 1
- && ACE_OS::strlen (tc_member_name) > 1
- && ACE_OS::strcmp (my_member_name, tc_member_name) != 0)
- {
- return 0;
- }
-
- // Now compare the typecodes of the members.
- CORBA::TypeCode_var my_member_tc =
- this->member_type (i ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_member_tc =
- tc->member_type (i ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Boolean flag = my_member_tc->equ_common (tc_member_tc.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (flag == 0)
- {
- return 0;
- }
- }
-
- return 1; // success
-}
-
-//@@ boris: This version is incomplete...
-CORBA::Boolean
-CORBA::TypeCode::private_equal_valuetype (
- CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL
- ) const
-{
- // Compare the repoID and name, of which the name is optional as per GIOP
- // spec. However, the repoID is mandatory.
- const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strcmp (my_id, tc_id) != 0)
- {
- return 0;
- }
- else
- {
- // Equality of repoIDs is sufficient for equivalence.
- if (equiv_only)
- {
- return 1;
- }
- }
-
- // Now check their names.
- const char *myname = this->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tcname = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (myname) > 1
- && ACE_OS::strlen (tcname) > 1
- && ACE_OS::strcmp (myname, tcname) != 0)
- {
- return 0; // failed
- }
-
- // Compare value modifiers.
- CORBA::ValueModifier my_vm =
- this->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ValueModifier tc_vm =
- tc->type_modifier (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_vm != tc_vm)
- {
- return 0;
- }
-
- // Check if the member count is same.
- CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::ULong tc_count = tc->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_count != tc_count)
- {
- return 0; // number of members don't match
- }
-
- // The checks below indicate that we have a recursive union.
- CORBA::TypeCode_ptr par = this->parent_;
-
- if (par != 0)
- {
- if (this->tc_base_ == this->root_tc_base_)
- {
- return 1;
- }
-
- CORBA::TypeCode_ptr tc_par = tc->parent_;
-
- if (tc_par)
- {
- CORBA::TypeCode_ptr gpar = par->parent_;
- CORBA::TypeCode_ptr tc_gpar = tc_par->parent_;
-
- if (gpar != 0
- && tc_gpar != 0
- && this->tc_base_ == gpar->tc_base_
- && tc->tc_base_ == tc_gpar->tc_base_)
- {
- return 1;
- }
- }
- }
-
- for (CORBA::ULong i = 0; i < my_count; ++i)
- {
- // Check if the member visibilities are the same.
- CORBA::Visibility my_vs =
- this->member_visibility (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Visibility tc_vs =
- tc->member_visibility (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (my_vs != tc_vs)
- {
- return 0;
- }
-
- // Check if the (optional) member names are same.
- const char *my_member_name =
- this->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- const char *tc_member_name =
- tc->member_name (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (ACE_OS::strlen (my_member_name) > 1
- && ACE_OS::strlen (tc_member_name) > 1
- && ACE_OS::strcmp (my_member_name, tc_member_name) != 0)
- {
- return 0;
- }
-
- // Now compare the typecodes of the members.
- CORBA::TypeCode_var my_member_tc =
- this->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::TypeCode_var tc_member_tc =
- tc->member_type (i
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- CORBA::Boolean flag = my_member_tc->equ_common (tc_member_tc.in (),
- equiv_only
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (flag == 0)
- {
- return 0;
- }
- }
-
- return 1;
-}
-
-
-// Return the type ID (RepositoryId) for the TypeCode; it may be empty.
-//
-// NOTE the string returned here is owned by the typecode!!
-//
-// Valid only for objref, struct, union, enum, alias, and except. Raises
-// BadKind exception for the rest of the cases.
-const char *
-CORBA::TypeCode::private_id (ACE_ENV_SINGLE_ARG_DECL) const
-{
- switch (this->kind_)
- {
- // These are all complex typecodes, which have as their first
- // parameter (number zero) a repository/type ID string encoded
- // per CDR rules. That means we can just return a pointer to
- // that string directly!
-
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- case CORBA::tk_value:
- case CORBA::tk_component:
- case CORBA::tk_home:
- case CORBA::tk_event:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_id_known_)
- {
- return this->private_state_->tc_id_;
- }
-
- this->private_state_->tc_id_known_ = 1;
- this->private_state_->tc_id_ = (const_cast <char *> (buffer_)
- + 4 // skip byte order
- // flag and padding
- + 4); // skip (strlen + 1)
- return this->private_state_->tc_id_; // this is OK because
- // strings in the CDR stream
- // are NULL terminated
- }
- // No other typecodes ever have type IDs
- default:
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-}
-
-// return the name. The string is owned by the typecode
-const char *
-CORBA::TypeCode::private_name (ACE_ENV_SINGLE_ARG_DECL) const
-{
- switch (this->kind_)
- {
- // These are all complex typecodes, which have as their second
- // parameter (number one) a name string encoded per CDR rules.
- // That means we can just return a pointer to that string
- // directly!
-
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- case CORBA::tk_value:
- case CORBA::tk_component:
- case CORBA::tk_home:
- case CORBA::tk_event:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_name_known_)
- {
- return this->private_state_->tc_name_;
- }
-
- // setup an encapsulation.
- TAO_InputCDR stream (this->buffer_ + 4,
- this->length_ - 4,
- this->byte_order_);
-
- // skip the typecode ID
- if (stream.skip_string ()) // ID
- {
- this->private_state_->tc_name_known_ = 1;
-
- // "Read" the string without copying.
- stream.read_string (this->private_state_->tc_name_);
-
- return this->private_state_->tc_name_;
- }
- else
- {
- ACE_THROW_RETURN (CORBA::INTERNAL (),
- 0);
- }
- }
- // No other typecodes ever have type IDs.
- default:
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-}
-
-// Return the number of members defined by this typecode
-//
-// Applicable to struct, union, enum, alias, and except
-// For the rest of the cases, raises the BadKind exception.
-
-CORBA::ULong
-CORBA::TypeCode::private_member_count (ACE_ENV_SINGLE_ARG_DECL) const
-{
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- CORBA::ULong members;
- // setup an encapsulation
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- switch (kind_)
- {
- case CORBA::tk_alias:
- case CORBA::tk_value_box:
- return 1;
- case CORBA::tk_enum:
- case CORBA::tk_except:
- case CORBA::tk_struct:
- {
- if (this->private_state_->tc_member_count_known_)
- {
- return this->private_state_->tc_member_count_;
- }
-
- // Skip rest of header (type ID and name) and collect the
- // number of struct members.
- if (!stream.skip_string () // ID
- || !stream.skip_string () // struct name
- || !stream.read_ulong (members))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_member_count_known_ = 1;
- this->private_state_->tc_member_count_ = members;
- return this->private_state_->tc_member_count_;
- }
- case CORBA::tk_union:
- {
- if (this->private_state_->tc_member_count_known_)
- {
- return this->private_state_->tc_member_count_;
- }
-
- // Skip rest of header (type ID, name, etc...) and collect the
- // number of struct members.
- if (!stream.skip_string () // ID
- || !stream.skip_string () // struct name
- || !this->skip_typecode (stream) // discriminant TC
- || !stream.read_ulong (members) // default used
- || !stream.read_ulong (members)) // real member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_member_count_known_ = 1;
- this->private_state_->tc_member_count_ = members;
- return this->private_state_->tc_member_count_;
- }
- case CORBA::tk_value:
- case CORBA::tk_event:
- {
- if (this->private_state_->tc_member_count_known_)
- {
- return this->private_state_->tc_member_count_;
- }
-
- // skip rest of header (type ID, name, etc) and collect the
- // number of value members
- CORBA::ULong tc_kind_holder;
- CORBA::TCKind tc_kind;
-
- if (!stream.skip_string () // ID
- || !stream.skip_string () // Name
- || !stream.skip_ulong () // ValueModifier
- || !stream.read_ulong (tc_kind_holder)) // Base's TCKind
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- tc_kind = static_cast <CORBA::TCKind> (tc_kind_holder);
-
- // The tc_kind can be either tk_null or tk_value.
- // In the latter case we should skip encapsulation or
- // indirection - whatever comes in.
- CORBA::ULong encap_length;
-
- if (tc_kind != CORBA::tk_null)
- {
- if (!stream.read_ulong (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- if (tc_kind_holder != 0xffffffff) // check for indirection
- {
- if (!stream.skip_bytes (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
- }
-
- // Now read member count.
- if (!stream.read_ulong (members))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_member_count_known_ = 1;
- this->private_state_->tc_member_count_ = members;
- return this->private_state_->tc_member_count_;
- }
- default:
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-}
-
-//
-// Applicable only to struct, union, except, value and event.
-//
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::private_member_type (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- CORBA::ULong temp = 0;
- CORBA::ULong i = 0;
- CORBA::ULong mcount = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- // Build the de-encapsulating CDR stream, bypassing the stringent
- // alignment tests (we're a bit looser in what we need here, and we
- // _know_ we're OK). Then skip the byte order code.
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
- CORBA::TypeCode_var tc;
- CORBA::TypeCode_ptr disc_tc = CORBA::TypeCode::_nil ();
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- CORBA::TypeCode::_nil ());
-
- switch (kind_)
- {
- case CORBA::tk_except:
- case CORBA::tk_struct:
- if (this->private_state_->tc_member_type_list_known_)
- {
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- }
-
- // the first time in. Precompute and store types of all members
-
- // Allocate a list to hold the member typecodes
- ACE_NEW_THROW_EX (this->private_state_->tc_member_type_list_,
- CORBA::TypeCode_ptr[mcount],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- // skip the id, name, and member_count part
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // typedef name
- || !stream.read_ulong (temp)) // member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- // compute the typecodes for all the members and
- // return the required one.
- for (i = 0; i < mcount; ++i)
- // the ith entry will have the typecode of the ith guy
- {
- if (!stream.skip_string ()) // skip the name
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- CORBA::TypeCode_ptr& member_type =
- this->private_state_->tc_member_type_list_[i];
- CORBA::TypeCode::_tao_decode (this,
- stream,
- member_type
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
- }
-
- this->private_state_->tc_member_type_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- case CORBA::tk_union:
- if (this->private_state_->tc_member_type_list_known_)
- {
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- }
-
- // the first time in. Precompute and store types of all members
- ACE_NEW_THROW_EX (this->private_state_->tc_member_type_list_,
- CORBA::TypeCode_ptr[mcount],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- // skip the id, name, and discrimant type part
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // typedef name
- || !this->skip_typecode (stream)) // skip discriminant typecode
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
- else if (!stream.read_ulong (temp) // default used
- || !stream.read_ulong (temp)) // member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- // Get the typecode for the discriminator.
- disc_tc =
- this->private_discriminator_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
- // Compute the typecodes for all the members and return the
- // required one.
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- for (i = 0; i < mcount; ++i)
- // The ith entry will have the typecode of the ith guy.
- {
- // Skip member label.
- TAO::traverse_status status =
- TAO_Marshal_Object::perform_skip (disc_tc,
- &stream
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- if (status != TAO::TRAVERSE_CONTINUE
- || !stream.skip_string ()) // skip the name
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- CORBA::TypeCode_ptr& member_type =
- this->private_state_->tc_member_type_list_[i];
- CORBA::TypeCode::_tao_decode (this,
- stream,
- member_type
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
- }
-
- this->private_state_->tc_member_type_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- case CORBA::tk_value:
- case CORBA::tk_event:
- if (this->private_state_->tc_member_type_list_known_)
- {
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- }
-
- // the first time in. Precompute and store types of all members
-
- // Allocate a list to hold the member typecodes
- ACE_NEW_THROW_EX (this->private_state_->tc_member_type_list_,
- CORBA::TypeCode_ptr [mcount],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- // skip rest of header (type ID, name, etc) and collect the
- // number of value members
- CORBA::ULong tc_kind_holder;
- CORBA::TCKind tc_kind;
-
- if (!stream.skip_string () // ID
- || !stream.skip_string () // Name
- || !stream.skip_ulong () // ValueModifier
- || !stream.read_ulong (tc_kind_holder)) // Base's TCKind
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- tc_kind = static_cast <CORBA::TCKind> (tc_kind_holder);
-
- // The tc_kind can be either tk_null or tk_value.
- // In the latter case we should skip encapsulation or
- // indirection - whatever comes in.
- CORBA::ULong encap_length;
-
- if (tc_kind != CORBA::tk_null)
- {
- if (!stream.read_ulong (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- if (tc_kind_holder != 0xffffffff) // check for indirection
- {
- if (!stream.skip_bytes (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
- }
- }
-
- // Now skip member count.
- if (!stream.skip_ulong ())
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- // Compute the typecodes for all the members and
- // return the required one.
- for (i = 0; i < mcount; ++i)
- // The ith entry will have the typecode of the ith guy.
- {
- if (!stream.skip_string ()) // skip the name
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- CORBA::TypeCode_ptr& member_type =
- this->private_state_->tc_member_type_list_[i];
- CORBA::TypeCode::_tao_decode (this,
- stream,
- member_type
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- if (!stream.skip_ulong ()) // skip member visibility
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
- }
-
- this->private_state_->tc_member_type_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_type_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::TypeCode::_nil ());
- }
- default:
- // Bad kind.
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- CORBA::TypeCode::_nil ());
- }
-}
-
-// Return the name for the nth member
-// Applicable only to CORBA::tk_struct, CORBA::tk_union, CORBA::tk_enum,
-// CORBA::tk_except, tk_value and tk_event.
-const char *
-CORBA::TypeCode::private_member_name (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- CORBA::ULong temp, mcount;
-
- // Build the de-encapsulating CDR stream, bypassing the stringent
- // alignment tests (we're a bit looser in what we need here, and we
- // _know_ we're OK). Then skip the byte order code.
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- mcount = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- // out of bounds
- ACE_CHECK_RETURN (0);
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_member_name_list_known_)
- {
- if (slot < mcount)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
-
- // the first time in. Precompute and store names of all members
- // Allocate a list to hold the member names
- ACE_NEW_THROW_EX (this->private_state_->tc_member_name_list_,
- char* [mcount],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
-
- switch (kind_)
- {
- case CORBA::tk_enum:
- {
- // skip the id, name, and member_count part
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // enum name
- || !stream.read_ulong (temp)) // member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- // compute the typecodes for all the members and
- // return the required one.
- for (CORBA::ULong i = 0; i < mcount; ++i)
- {
- // Now read this name.
- if (!stream.read_string (
- this->private_state_->tc_member_name_list_ [i]
- ))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
-
- this->private_state_->tc_member_name_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- case CORBA::tk_except:
- case CORBA::tk_struct:
- {
- // Skip the id, name, and member_count part.
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // struct/except name
- || !stream.read_ulong (temp)) // member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- // Computes the typecodes for all the members and
- // return the required one.
- for (CORBA::ULong i = 0; i < mcount; ++i)
- {
- if (!stream.read_string (
- this->private_state_->tc_member_name_list_[i]
- )
- || !this->skip_typecode (stream))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
-
- this->private_state_->tc_member_name_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
-
- }
- case CORBA::tk_union: // index from 0
- {
- // skip the id, name, and discrimant type part
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // typedef name
- || !this->skip_typecode (stream)) // skip discriminant typecode
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), (char *)0);
- else if (!stream.read_ulong (temp) // default used
- || !stream.read_ulong (temp)) // member count
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), 0);
- else
- {
- // get the typecode for the discriminator
- CORBA::TypeCode_ptr disc_tc =
- this->private_discriminator_type_i (
- ACE_ENV_SINGLE_ARG_PARAMETER);
- // Compute the name for all the members and return the
- // required one.
- ACE_CHECK_RETURN (0);
-
- for (CORBA::ULong i = 0; i < mcount; ++i)
- {
- // The ith entry will have the name of the ith member.
- TAO::traverse_status status =
- TAO_Marshal_Object::perform_skip (disc_tc,
- &stream
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (status != TAO::TRAVERSE_CONTINUE)
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), 0);
-
- // skip typecode for member
- if (!stream.read_string (
- this->private_state_->tc_member_name_list_ [i]
- )
- || (!this->skip_typecode (stream))) // skip typecode
- ACE_THROW_RETURN ( CORBA::BAD_TYPECODE (), 0);
- }
-
- this->private_state_->tc_member_name_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- }
- case CORBA::tk_value:
- case CORBA::tk_event:
- {
- // Skip rest of header (type ID, name, etc) and skip the
- // number of value members.
- CORBA::ULong tc_kind_holder;
- CORBA::TCKind tc_kind;
-
- if (!stream.skip_string () // ID
- || !stream.skip_string () // Name
- || !stream.skip_ulong () // ValueModifier
- || !stream.read_ulong (tc_kind_holder)) // Base's TCKind
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- tc_kind = static_cast <CORBA::TCKind> (tc_kind_holder);
-
- // The tc_kind can be either tk_null or tk_value.
- // In the latter case we should skip encapsulation or
- // indirection - whatever comes in.
- CORBA::ULong encap_length;
-
- if (tc_kind != CORBA::tk_null)
- {
- if (!stream.read_ulong (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- if (tc_kind_holder != 0xffffffff) // check for indirection
- {
- if (!stream.skip_bytes (encap_length))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
- }
-
- // Now skip member count.
- if (!stream.skip_ulong ())
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- // Compute the names for all the members, skip the other
- // member parameters and return the required name.
- for (CORBA::ULong i = 0; i < mcount; ++i)
- {
- if (!stream.read_string (
- this->private_state_->tc_member_name_list_[i]
- )
- || !this->skip_typecode (stream) // member typecode
- || !stream.skip_ulong ()) // member visibility
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
-
- this->private_state_->tc_member_name_list_known_ = 1;
-
- if (slot < mcount)
- {
- return this->private_state_->tc_member_name_list_[slot];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
- default:
- // Bad kind.
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-}
-
-// Return member labels for CORBA::tk_union typecodes.
-CORBA::Any_ptr
-CORBA::TypeCode::private_member_label (CORBA::ULong n
- ACE_ENV_ARG_DECL) const
-{
- // this function is only applicable to the CORBA::tk_union TC
- if (this->kind_ != CORBA::tk_union)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip ID and name
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // typedef name
- || !this->skip_typecode (stream)) // skip discriminant typecode
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-
- // skip default used, and get member count
- CORBA::ULong member_count;
-
- if (!stream.read_ulong (member_count) // default used
- || !stream.read_ulong (member_count)) // member count
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TypeCode::private_member_label -- ")
- ACE_TEXT ("error reading from stream\n")));
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_member_label_list_known_)
- {
- if (n < member_count)
- {
- return this->private_state_->tc_member_label_list_[n];
- }
- else
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
- }
-
- // MJember labels are of type Any. However, the actual types are
- // restricted to simple types
-
- // @@EXC@@ We should use Auto_Ptr_Array to make this exception
- // safe.
- CORBA::Any_ptr* label_list;
- ACE_NEW_THROW_EX (label_list,
- CORBA::Any_ptr [member_count],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
-
- // get the discriminant TC
- CORBA::TypeCode_ptr disc_tc =
- this->private_discriminator_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- for (CORBA::ULong i = 0; i < member_count; ++i)
- {
- // Create an any from the portion of the CDR stream created
- // above.....
-
- // @@ This code assumes that the stream is a single message
- // block, this is perfectly OK [the stream is created from a
- // single buffer], but we may need to change this if the
- // stream creation changes. [Carlos]
- TAO_InputCDR temp (stream);
-
- char *begin = stream.rd_ptr ();
- int retval =
- TAO_Marshal_Object::perform_skip (disc_tc,
- &temp
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (retval != TAO::TRAVERSE_CONTINUE)
- {
- return 0;
- }
-
- char* end = temp.rd_ptr ();
-
- // We need to allocate more memory than in the original
- // stream, first to guarantee that the buffer is aligned in
- // memory and next because the realignment may introduce
- // extra padding. 2*MAX_ALIGNMENT should be enough.
- // @@EXC@@ This doesn't seem to be exception safe.
- TAO_OutputCDR out (end - begin + 2 * ACE_CDR::MAX_ALIGNMENT,
- ACE_CDR_BYTE_ORDER,
- ACE_Allocator::instance (),
- ACE_Allocator::instance (),
- ACE_Allocator::instance ());
-
- CORBA::TypeCode_ptr label_tc;
-
- const CORBA::ULong slot =
- static_cast <CORBA::ULong>
- (this->private_default_index_i (ACE_ENV_SINGLE_ARG_PARAMETER));
- ACE_CHECK_RETURN (0);
-
- // If we are computing the label for the default index,
- // the label must contain an octet value of 0.
- if (i == slot)
- {
- label_tc = CORBA::_tc_octet;
-
- if (out.write_octet (static_cast <CORBA::Octet> (0)) == 0)
- {
- return 0;
- }
-
- retval =
- TAO_Marshal_Object::perform_skip (disc_tc,
- &stream
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (retval != TAO::TRAVERSE_CONTINUE)
- {
- return 0;
- }
- }
- else
- {
- label_tc = disc_tc;
-
- retval =
- TAO_Marshal_Object::perform_append (label_tc,
- &stream,
- &out
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- if (retval != TAO::TRAVERSE_CONTINUE)
- {
- return 0;
- }
- }
-
- TAO::Unknown_IDL_Type *impl = 0;
- TAO_InputCDR in (out);
- ACE_NEW_THROW_EX (impl,
- TAO::Unknown_IDL_Type (label_tc,
- in),
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
-
- ACE_NEW_THROW_EX (label_list[i],
- CORBA::Any,
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (0);
-
- label_list[i]->replace (impl);
-
- if (stream.skip_string () == 0
- || this->skip_typecode (stream) == 0)
- {
- if (TAO_debug_level > 0)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TypeCode::private_member_label ")
- ACE_TEXT ("error getting typecode for member %d\n"),
- i));
- }
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
- }
-
- this->private_state_->tc_member_label_list_ = label_list;
- this->private_state_->tc_member_label_list_known_ = 1;
-
- // If caller asked for the label for a nonexistent member, they get
- // an error report!
- if (n >= member_count)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- 0);
- }
-
- return this->private_state_->tc_member_label_list_[n];
-}
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::private_discriminator_type (
- ACE_ENV_SINGLE_ARG_DECL
- ) const
-{
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- return this->private_discriminator_type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
-}
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::private_discriminator_type_i (
- ACE_ENV_SINGLE_ARG_DECL
- ) const
-{
- if (this->private_state_->tc_discriminator_type_known_)
- {
- return this->private_state_->tc_discriminator_type_;
- }
-
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip ID and name, and then get the discriminant TC
-
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string ()) // typedef name
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- CORBA::TypeCode::_tao_decode (this,
- stream,
- this->private_state_->tc_discriminator_type_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- this->private_state_->tc_discriminator_type_known_ = 1;
- return this->private_state_->tc_discriminator_type_;
-}
-
-CORBA::Long
-CORBA::TypeCode::private_default_index (
- ACE_ENV_SINGLE_ARG_DECL
- ) const
-{
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- return this->private_default_index_i (ACE_ENV_SINGLE_ARG_PARAMETER);
-}
-
-CORBA::Long
-CORBA::TypeCode::private_default_index_i (
- ACE_ENV_SINGLE_ARG_DECL
- ) const
-{
- if (this->private_state_->tc_default_index_used_known_)
- {
- return this->private_state_->tc_default_index_used_;
- }
-
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip ID and name, and then get the discriminant TC
-
- if (!stream.skip_string () // type ID, hidden
- || !stream.skip_string () // typedef name
- || !this->skip_typecode (stream) // skip discriminant
- || !stream.read_long (this->private_state_->tc_default_index_used_))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_default_index_used_known_ = 1;
- return this->private_state_->tc_default_index_used_;
-}
-
-CORBA::Long
-CORBA::TypeCode::private_length (ACE_ENV_SINGLE_ARG_DECL) const
-{
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
- switch (this->kind_)
- {
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_length_known_)
- {
- return this->private_state_->tc_length_;
- }
-
- // Skip the typecode of the element and get the bounds
- if (!this->skip_typecode (stream) // skip typecode
- || !stream.read_ulong (this->private_state_->tc_length_))
- {
- ACE_THROW_RETURN (CORBA::BAD_PARAM (),
- 0);
- }
- else
- {
- this->private_state_->tc_length_known_ = 1;
- return this->private_state_->tc_length_;
- }
- }
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_length_known_)
- {
- return this->private_state_->tc_length_;
- }
-
- if (stream.read_ulong (this->private_state_->tc_length_))
- {
- this->private_state_->tc_length_known_ = 1;
- return this->private_state_->tc_length_;
- }
- else
- {
- ACE_THROW_RETURN (CORBA::BAD_PARAM (),
- 0);
- }
- }
- default:
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-}
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::private_content_type (ACE_ENV_SINGLE_ARG_DECL) const
-{
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
- switch (kind_)
- {
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_content_type_known_)
- {
- return this->private_state_->tc_content_type_;
- }
-
- // retrieve the content type
- CORBA::TypeCode::_tao_decode (this,
- stream,
- this->private_state_->tc_content_type_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- this->private_state_->tc_content_type_known_ = 1;
- return this->private_state_->tc_content_type_;
- }
- case CORBA::tk_alias:
- case CORBA::tk_value_box:
- {
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_content_type_known_)
- {
- return this->private_state_->tc_content_type_;
- }
-
- if (!stream.skip_string () // typeID
- || !stream.skip_string ()) // name
- {
- ACE_THROW_RETURN (CORBA::BAD_PARAM (),
- 0);
- }
-
- CORBA::TypeCode::_tao_decode (this,
- stream,
- this->private_state_->tc_content_type_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (0);
-
- this->private_state_->tc_content_type_known_ = 1;
- return this->private_state_->tc_content_type_;
- }
- default:
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-}
-
-CORBA::Visibility
-CORBA::TypeCode::private_member_visibility (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const
-{
- if (this->kind_ != CORBA::tk_value
- && this->kind_ != CORBA::tk_event)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- CORBA::PRIVATE_MEMBER);
- }
-
- CORBA::ULong mcount = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::PRIVATE_MEMBER);
-
- if (slot >= mcount)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::Bounds (),
- CORBA::PRIVATE_MEMBER);
- }
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_member_visibility_list_known_)
- {
- return this->private_state_->tc_member_visibility_list_[slot];
- }
-
- // Set up an encapsulation.
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // Skip rest of header (type ID, name, etc) and collect the
- // number of value members.
- if (!stream.skip_string () // ID
- || !stream.skip_string () // Name
- || !stream.skip_ulong () // ValueModifier
- || !this->skip_typecode (stream) // Concrete base typecode
- || !stream.skip_ulong ()) // Member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- ACE_NEW_THROW_EX (this->private_state_->tc_member_visibility_list_,
- CORBA::Visibility[mcount],
- CORBA::NO_MEMORY ());
- ACE_CHECK_RETURN (CORBA::PRIVATE_MEMBER);
-
- CORBA::Visibility tmp = CORBA::PRIVATE_MEMBER;
-
- for (CORBA::ULong i = 0; i < mcount; ++i)
- {
- if (!stream.skip_string () // Member name
- || !this->skip_typecode (stream) // Member TypeCode
- || !stream.read_short (tmp)) // Read the member visibility
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_member_visibility_list_[i] = tmp;
- }
-
- this->private_state_->tc_member_visibility_list_known_ = 1;
- return this->private_state_->tc_member_visibility_list_[slot];
-}
-
-CORBA::ValueModifier
-CORBA::TypeCode::private_type_modifier (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->kind_ != CORBA::tk_value
- && this->kind_ != CORBA::tk_event)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- 0);
- }
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- 0);
-
- if (this->private_state_->tc_type_modifier_known_)
- {
- return this->private_state_->tc_type_modifier_;
- }
-
- // Set up an encapsulation.
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // Skip rest of header (type ID, name, etc) and collect the
- // number of value members.
- if (!stream.skip_string () // ID
- || !stream.skip_string ()) // Name
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- if (!stream.read_short (this->private_state_->tc_type_modifier_))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- this->private_state_->tc_type_modifier_known_ = 1;
- return this->private_state_->tc_type_modifier_;
-}
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::private_concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const
-{
- if (this->kind_ != CORBA::tk_value
- && this->kind_ != CORBA::tk_event)
- {
- ACE_THROW_RETURN (CORBA::TypeCode::BadKind (),
- CORBA::TypeCode::_nil ());
- }
-
- // Double checked locking...
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->private_state_->mutex_,
- CORBA::TypeCode::_nil ());
-
- if (this->private_state_->tc_concrete_base_type_known_)
- {
- return this->private_state_->tc_concrete_base_type_;
- }
-
- // Set up an encapsulation.
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // Skip rest of header (type ID, name, etc) and collect the
- // number of value members.
- if (!stream.skip_string () // ID
- || !stream.skip_string () // Name
- || !stream.skip_ulong ()) // ValueModifier
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- CORBA::TypeCode::_nil ());
- }
-
- // Retrieve the concrete base typecode.
- CORBA::TypeCode::_tao_decode (this,
- stream,
- this->private_state_->tc_concrete_base_type_
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- this->private_state_->tc_concrete_base_type_known_ = 1;
- return this->private_state_->tc_concrete_base_type_;
-}
-
-// ****************************************************************
-
-void
-CORBA::TypeCode::_tao_decode (const CORBA::TypeCode *parent,
- TAO_InputCDR &cdr,
- CORBA::TypeCode *&x
- ACE_ENV_ARG_DECL)
-{
- x = 0;
- CORBA::ULong kind;
-
- if (!cdr.read_ulong (kind))
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- static CORBA::TypeCode_ptr tc_consts [CORBA::TC_KIND_COUNT] =
- {
- CORBA::_tc_null,
- CORBA::_tc_void,
- CORBA::_tc_short,
- CORBA::_tc_long,
- CORBA::_tc_ushort,
-
- CORBA::_tc_ulong,
- CORBA::_tc_float,
- CORBA::_tc_double,
- CORBA::_tc_boolean,
- CORBA::_tc_char,
-
- CORBA::_tc_octet,
- CORBA::_tc_any,
- CORBA::_tc_TypeCode,
- CORBA::_tc_Principal,
-
- 0, // CORBA::_tc_Object ... type ID is CORBA::Object
- 0, // CORBA::tk_struct
- 0, // CORBA::tk_union
- 0, // CORBA::tk_enum
- 0, // CORBA::_tc_string ... unbounded
- 0, // CORBA::tk_sequence
- 0, // CORBA::tk_array
- 0, // CORBA::tk_alias
- 0, // CORBA::tk_except
-
- CORBA::_tc_longlong,
- CORBA::_tc_ulonglong,
- CORBA::_tc_longdouble,
- CORBA::_tc_wchar,
-
- 0, // CORBA::_tc_wstring ... unbounded
- 0, // CORBA::tk_fixed
- 0, // CORBA::tk_value
- 0, // CORBA::tk_value_box:
- 0, // CORBA::tk_native:
- 0, // CORBA::tk_abstract_interface:
- 0, // CORBA::tk_local_interface:
- 0, // CORBA::tk_component:
- 0, // CORBA::tk_home:
- 0 // CORBA::tk_event:
- };
-
- if (kind < CORBA::TC_KIND_COUNT && tc_consts [kind] != 0)
- {
- // Easy case, the CDR contains no more data, and we can simply
- // duplicate one of the TypeCode constants...
- x = CORBA::TypeCode::_duplicate (tc_consts [kind]);
- return;
- }
-
- if (kind != ~0u && kind >= CORBA::TC_KIND_COUNT)
- {
- // Invalid kind.... cannot even determine what portion of the
- // CDR corresponds to the typecode....
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- if (kind == ~0u)
- {
- // Get the long indicating the encapsulation offset,
- // then set up indirection stream that's like "stream"
- // but has space enough only for the typecode and the
- // length for the encapsulated parameters.
- //
- // The offset must be negative
- CORBA::Long offset;
-
- if (!cdr.read_long (offset) || offset >= 0)
- {
- // Since indirected typecodes cannot occur at the
- // topmost level, they can occur starting only at the
- // second and subsequent levels. This means that a
- // normal encoding of that typecode occurred somewhere
- // before in the stream. As a result the offset field
- // must always be negative. See the CORBA spec for details.
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- // Slava Galperin <galperin@teknowledge.com> clarifies
- // this:
- // CORBA Spec says:
- //
- // The encoding of such an indirection is as a
- // TypeCode with a TCKind value that has the special
- // value 2^32 -1 (0xffffffff, all ones). Such
- // typecodes have a single (simple) parameter, which
- // is the long offset (in units of octets) from the
- // simple parameter. (This means that an offset of
- // negative four (-4) is illegal because it will be
- // self-indirecting.)
- // (CORBA V2.2 CDR Transfer Syntax February 1998 page 13-17)
- //
- // This apparently assumes offset from the <em>
- // beginning </em> of the simple parameter.
- // [Right, because otherwise the value -8 would be
- // illegal]
- // Because at this point stream is positioned after
- // the parameter, we need to account for that when
- // constructing indir_stream by subtracting 4 (length
- // of the offset parameter itself).
-
- // TAO_InputCDR indir_stream (*stream, 8, offset
- // - 4);
- ACE_Message_Block *mb = (ACE_Message_Block *)cdr.start ();
- TAO_InputCDR indir_stream (mb->rd_ptr () + offset - 4,
- -1 * (offset - 4),
- cdr.byte_order ());
-
- if (!indir_stream.good_bit ())
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- // Get "kind" and length of target typecode
- //
- // XXX this currently assumes the TCKind to which we
- // indirect is the same byte order as the "parent"
- // typecode -- not the right assumption; see how the
- // TypeCode interpreter does it.
-
- CORBA::ULong indir_kind = 0;
- CORBA::ULong indir_len = 0;
-
- if (!indir_stream.read_ulong (indir_kind)
- || indir_kind >= CORBA::TC_KIND_COUNT // no double indirections
- || !indir_stream.read_ulong (indir_len))
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- // Now construct indirected typecode. This shares the
- // typecode octets with the "parent" typecode,
- // increasing the amount of memory sharing and
- // reducing the cost of getting typecodes.
- ACE_NEW (x,
- CORBA::TypeCode ((CORBA::TCKind) indir_kind,
- indir_len,
- indir_stream.rd_ptr(),
- 0,
- 0,
- // @@ TODO
- // Here we lose the parent
- // typecode...
- const_cast <CORBA::TypeCode*> (parent)));
- return;
- }
-
- // The other cases....
- switch (kind)
- {
- default:
- ACE_THROW (CORBA::INTERNAL ());
-
- // Some have "simple" parameter lists ... some of these
- // also have preallocated constants that could be used.
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- {
- CORBA::ULong bound;
-
- if (!cdr.read_ulong (bound))
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- if (bound == 0)
- {
- // unbounded string. Let us reuse the ORB owned
- // _tc_string or _tc_wstring
- if (kind == CORBA::tk_string)
- {
- x = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
- }
- else
- {
- x = CORBA::TypeCode::_duplicate (CORBA::_tc_wstring);
- }
- }
- else
- {
- // bounded string. Create a TypeCode. If it is does not
- // have a parent, then the application must free it.
-
- // allocate a new TypeCode
-
- // This may produce a memory leak, because
- // callers are sloppy about removing these
- // objects.
- CORBA::Long _oc_bounded_string [] =
- {TAO_ENCAP_BYTE_ORDER, 0};
- // Bounded string. Save the bounds
- _oc_bounded_string [1] = static_cast <CORBA::Long> (bound);
- ACE_NEW (x,
- CORBA::TypeCode (
- static_cast <CORBA::TCKind> (kind),
- 8,
- reinterpret_cast <char*> (_oc_bounded_string),
- 0,
- sizeof (CORBA::String_var),
- 0
- ));
- }
- }
- break;
-
- // The rest have "complex" parameter lists that are
- // encoded as bulk octets ...
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- case CORBA::tk_value:
- case CORBA::tk_value_box:
- case CORBA::tk_native:
- case CORBA::tk_abstract_interface:
- case CORBA::tk_local_interface:
- case CORBA::tk_component:
- case CORBA::tk_home:
- case CORBA::tk_event:
- {
- CORBA::ULong length;
-
- // get the encapsulation length
- if (!cdr.read_ulong (length))
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- // If the length is greater that the containing CDR stream
- // that is an error...
- if (length > cdr.length ())
- {
- ACE_THROW (CORBA::BAD_TYPECODE ());
- }
-
- // create a new typecode
- ACE_NEW (x,
- CORBA::TypeCode ((CORBA::TCKind) kind,
- length,
- cdr.rd_ptr (),
- 0,
- 0,
- const_cast <CORBA::TypeCode*> (parent)));
- // skip length number of bytes in the stream, otherwise we may
- // leave the stream in an undefined state
- (void) cdr.skip_bytes (length);
- }
- break;
- } // end of switch
-}
-
-// ****************************************************************
-
-CORBA::TypeCode_ptr
-CORBA::TypeCode::unalias (ACE_ENV_SINGLE_ARG_DECL)
-{
- CORBA::TCKind kind = this->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- CORBA::TypeCode_var tmp = CORBA::TypeCode::_duplicate (this);
-
- while (kind == CORBA::tk_alias)
- {
- tmp = tmp->content_type (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
-
- kind = tmp->kind (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
- }
-
- return tmp._retn ();
-}
-
-// ****************************************************************
-
-void
-CORBA::TypeCode::_tao_any_destructor (void *x)
-{
- CORBA::TypeCode_ptr tmp = static_cast <CORBA::TypeCode_ptr> (x);
- CORBA::release (tmp);
-}
-
-// ************ The following are deprecated ****************
-
-// say how many parameters this typecode has; normally a fixed number,
-// some are variable length.
-//
-// NOTE: This refers to "real" parameters, not what shows up in the
-// IFR spec !! That is, "hidden" parameters are counted here, this
-// doesn't strictly comply with what CORBA says "param_count"
-// provides.
-
-CORBA::ULong
-CORBA::TypeCode::param_count (ACE_ENV_SINGLE_ARG_DECL) const
-{
- switch (this->kind_)
- {
- default:
- return 0;
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- return 1;
- case CORBA::tk_objref:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- return 2;
- case CORBA::tk_alias:
- return 3;
- case CORBA::tk_except:
- case CORBA::tk_struct:
- {
- CORBA::ULong members;
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip rest of header (type ID and name) and collect the
- // number of struct members
- if (!stream.skip_string () // ID
- || !stream.skip_string () // struct name
- || !stream.read_ulong (members))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- return 3 + 2 * members;
- }
- case CORBA::tk_enum:
- {
- CORBA::ULong members;
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip rest of header (type ID and name) and collect the
- // number of struct members
- if (!stream.skip_string () // ID
- || !stream.skip_string () // typedef name
- || !stream.read_ulong (members))
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- return 3 + members;
- }
- case CORBA::tk_union:
- {
- CORBA::ULong members;
- TAO_InputCDR stream (this->buffer_+4,
- this->length_-4,
- this->byte_order_);
-
- // skip rest of header (type ID, name, etc...) and collect the
- // number of struct members
- if (!stream.skip_string () // ID
- || !stream.skip_string () // struct name
- || !this->skip_typecode (stream) // discriminant TC
- || !stream.read_ulong (members) // default used
- || !stream.read_ulong (members)) // real member count
- {
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- 0);
- }
-
- return 5 + 3 * members;
- }
- }
-}
-
-CORBA::Any_ptr
-CORBA::TypeCode::parameter (const CORBA::Long /* slot */
- ACE_ENV_ARG_DECL)
-{
- ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (0,
- CORBA::COMPLETED_NO),
- 0);
-}
-
-// =========================================================
-// Traits specializations for CORBA::TypeCode.
-namespace TAO
-{
- CORBA::TypeCode_ptr
- Objref_Traits<CORBA::TypeCode>::duplicate (CORBA::TypeCode_ptr p)
- {
- return CORBA::TypeCode::_duplicate (p);
- }
-
- void
- Objref_Traits<CORBA::TypeCode>::release (CORBA::TypeCode_ptr p)
- {
- CORBA::release (p);
- }
-
- CORBA::TypeCode_ptr
- Objref_Traits<CORBA::TypeCode>::nil (void)
- {
- return CORBA::TypeCode::_nil ();
- }
-
- CORBA::Boolean
- Objref_Traits<CORBA::TypeCode>::marshal (CORBA::TypeCode_ptr p,
- TAO_OutputCDR & cdr)
- {
- return cdr << p;
- }
-}
-
-// ****************************************************************
-
-CORBA::Boolean
-operator<< (TAO_OutputCDR& cdr, const CORBA::TypeCode *x)
-{
- if (x == 0)
- {
- ACE_DECLARE_NEW_CORBA_ENV;
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- 0);
- }
-
- CORBA::ULong kind =
- x->kind_;
-
- if (!cdr.write_ulong (kind))
- {
- return 0;
- }
-
- switch (kind)
- {
- default:
- break;
-
- // Indirected typecodes can occur at "top level" like
- // this only when constructing a recursive typecode in the
- // TypeCodeFactory. The check for non-null offset map suffices.
- case ~0u:
- if (x->offset_map () == 0)
- {
- return 0;
- }
-
- if (!cdr.write_octet_array ((CORBA::Octet*)x->buffer_,
- 4))
- {
- return 0;
- }
-
- break;
-
- // A few have "simple" parameter lists
- case CORBA::tk_string:
- case CORBA::tk_wstring:
- {
- ACE_TRY_NEW_ENV
- {
- CORBA::ULong length =
- x->length (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (!cdr.write_ulong (length))
- {
- return 0;
- }
- }
- ACE_CATCHANY
- {
- return 0;
- }
- ACE_ENDTRY;
- }
- break;
-
- // The rest have "complex" parameter lists that are
- // already encoded as bulk octets ... put length, then
- // octets.
- case CORBA::tk_objref:
- case CORBA::tk_struct:
- case CORBA::tk_union:
- case CORBA::tk_enum:
- case CORBA::tk_sequence:
- case CORBA::tk_array:
- case CORBA::tk_alias:
- case CORBA::tk_except:
- case CORBA::tk_value:
- case CORBA::tk_value_box:
- case CORBA::tk_native:
- case CORBA::tk_abstract_interface:
- case CORBA::tk_local_interface:
- case CORBA::tk_component:
- case CORBA::tk_home:
- case CORBA::tk_event:
- {
- CORBA::ULong xlen = static_cast <CORBA::ULong> (x->length_);
- if (!cdr.write_ulong (xlen)
- || !cdr.write_octet_array ((CORBA::Octet*) x->buffer_,
- xlen))
- {
- return 0;
- }
- }
- break;
- }
-
- return 1;
-}
-
-CORBA::Boolean
-operator>> (TAO_InputCDR& cdr, CORBA::TypeCode *&x)
-{
- ACE_TRY_NEW_ENV
- {
- CORBA::TypeCode::_tao_decode (0,
- cdr,
- x
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- return 0;
- }
- ACE_ENDTRY;
- return 1;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class ACE_Hash_Map_Entry<const char *,
- ACE_Unbounded_Queue<CORBA::Long> *>;
-template class ACE_Hash_Map_Manager_Ex<const char *,
- ACE_Unbounded_Queue<CORBA::Long> *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>;
-template class
- ACE_Hash_Map_Iterator_Base_Ex<const char *,
- ACE_Unbounded_Queue<CORBA::Long> *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>;
-template class
- ACE_Hash_Map_Reverse_Iterator_Ex<const char *,
- ACE_Unbounded_Queue<CORBA::Long> *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>;
-template class ACE_Hash_Map_Iterator_Ex<const char *,
- ACE_Unbounded_Queue<CORBA::Long> *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>;
-
-template class TAO_Pseudo_Var_T<CORBA::TypeCode>;
-template class TAO_Pseudo_Out_T<CORBA::TypeCode, CORBA::TypeCode_var>;
-
-template class TAO::Objref_Traits<CORBA::TypeCode>;
-
-template class TAO::Arg_Traits<CORBA::TypeCode>;
-template class TAO::Object_Arg_Traits_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var,
- CORBA::TypeCode_out,
- TAO::Objref_Traits<CORBA::TypeCode> >;
-
-template class TAO::Ret_Object_Argument_T<CORBA::TypeCode*,
- TAO_Pseudo_Var_T<CORBA::TypeCode> >;
-
-template class TAO::In_Object_Argument_T<CORBA::TypeCode*>;
-
-template class
- TAO::Inout_Object_Argument_T<CORBA::TypeCode*,
- TAO::Objref_Traits<CORBA::TypeCode> >;
-
-template class
- TAO::Out_Object_Argument_T<
- CORBA::TypeCode*,
- TAO_Pseudo_Out_T<CORBA::TypeCode,
- TAO_Pseudo_Var_T<CORBA::TypeCode>
- > >;
-
-#if 0
-template class TAO::SArg_Traits<CORBA::TypeCode>;
-template class TAO::Object_SArg_Traits_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var,
- CORBA::TypeCode_out>;
-template class TAO::In_Object_SArgument_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var>;
-template class TAO::Inout_Object_SArgument_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var>;
-template class TAO::Out_Object_SArgument_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var,
- CORBA::TypeCode_out>;
-template class TAO::Ret_Object_SArgument_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var>;
-#endif /*if 0*/
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate ACE_Hash_Map_Entry<const char *, \
- ACE_Unbounded_Queue<CORBA::Long> *>
-#pragma instantiate \
- ACE_Hash_Map_Manager_Ex<const char *, \
- ACE_Unbounded_Queue<CORBA::Long> *, \
- ACE_Hash<const char *>, \
- ACE_Equal_To<const char *>, \
- ACE_Null_Mutex>
-#pragma instantiate \
- ACE_Hash_Map_Iterator_Base_Ex<const char *, \
- ACE_Unbounded_Queue<CORBA::Long> *, \
- ACE_Hash<const char *>, \
- ACE_Equal_To<const char *>, \
- ACE_Nullv_Mutex>
-#pragma instantiate \
- ACE_Hash_Map_Reverse_Iterator_Ex<const char *, \
- ACE_Unbounded_Queue<CORBA::Long> *, \
- ACE_Hash<const char *>, \
- ACE_Equal_To<const char *>, \
- ACE_Null_Mutex>
-#pragma instantiate \
- ACE_Hash_Map_Iterator_Ex<const char *, \
- ACE_Unbounded_Queue<CORBA::Long> *, \
- ACE_Hash<const char *>, \
- ACE_Equal_To<const char *>, \
- ACE_Null_Mutex>
-
-#pragma instantiate TAO_Pseudo_Var_T<CORBA::TypeCode>
-#pragma instantiate TAO_Pseudo_Out_T<CORBA::TypeCode, CORBA::TypeCode_var>
-
-#pragma instantiate TAO::Objref_Traits<CORBA::TypeCode>
-#pragma instantiate TAO::Arg_Traits<CORBA::TypeCode>
-#pragma instantiate \
- TAO::Object_Arg_Traits_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var, \
- CORBA::TypeCode_out, \
- TAO::Objref_Traits<CORBA::TypeCode> >
-#pragma instantiate TAO::In_Object_Argument_T<CORBA::TypeCode_ptr>
-#pragma instantiate \
- TAO::Inout_Object_Argument_T<CORBA::TypeCode_ptr, \
- TAO::Objref_Traits<CORBA::TypeCode> >
-#pragma instantiate TAO::Out_Object_Argument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_out>
-#pragma instantiate TAO::Ret_Object_Argument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var>
-
-#pragma instantiate TAO::SArg_Traits<CORBA::TypeCode>
-#pragma instantiate TAO::Object_SArg_Traits_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var, \
- CORBA::TypeCode_out>
-#pragma instantiate TAO::In_Object_SArgument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var>
-#pragma instantiate TAO::Inout_Object_SArgument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var>
-#pragma instantiate TAO::Out_Object_SArgument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var, \
- CORBA::TypeCode_out>
-#pragma instantiate TAO::Ret_Object_SArgument_T<CORBA::TypeCode_ptr, \
- CORBA::TypeCode_var>
-
-#pragma instantiate TAO::Ret_Object_Argument_T<CORBA::TypeCode*,
- TAO_Pseudo_Var_T<CORBA::TypeCode> >
-
-#pragma instantiate TAO::In_Object_Argument_T<CORBA::TypeCode*>
-
-#pragma instantiate TAO::Inout_Object_Argument_T<CORBA::TypeCode*,
- TAO::Objref_Traits<CORBA::TypeCode> >
-
-#pragma instantiate TAO::Out_Object_Argument_T<CORBA::TypeCode*,
- TAO_Pseudo_Out_T<CORBA::TypeCode,
- TAO_Pseudo_Var_T<CORBA::TypeCode> > >
-
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/Typecode.h b/TAO/tao/Typecode.h
deleted file mode 100644
index 2742445fa66..00000000000
--- a/TAO/tao/Typecode.h
+++ /dev/null
@@ -1,661 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-//=============================================================================
-/**
- * @file Typecode.h
- *
- * $Id$
- *
- * Header file CORBA's "TypeCode" type.
- *
- * @author Copyright 1994-1995 by Sun Microsystems, Inc.
- * @author DOC group at Wash U, UCI and Vanderbilt U.
- */
-//=============================================================================
-
-#ifndef TAO_TYPECODE_H
-#define TAO_TYPECODE_H
-
-#include /**/ "ace/pre.h"
-
-#include "ace/Thread_Mutex.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Hash_Map_Manager_T.h"
-#include "ace/Unbounded_Queue.h"
-
-#include "tao/UserException.h"
-#include "tao/Environment.h"
-#include "tao/Pseudo_VarOut_T.h"
-#include "tao/Objref_VarOut_T.h"
-#include "tao/Object_Argument_T.h"
-#include "tao/Arg_Traits_T.h"
-#include "tao/TC_Constants_Forward.h"
-#include "tao/VisibilityC.h"
-#include "tao/CORBA_methods.h"
-#include "tao/Sequence_T.h"
-#include "tao/Typecode_typesC.h"
-#include "tao/TAO_Export.h"
-
-// Forward declarations.
-class TAO_InputCDR;
-class TAO_OutputCDR;
-
-namespace TAO
-{
- class TC_Private_State;
-}
-
-namespace CORBA
-{
- class TypeCode;
- typedef TypeCode *TypeCode_ptr;
-
- typedef TAO_Pseudo_Var_T<TypeCode> TypeCode_var;
- typedef TAO_Pseudo_Out_T<TypeCode, TypeCode_var> TypeCode_out;
-
- /**
- * @class TypeCode
- *
- * @brief The CORBA TypeCode class. It maintains the in-memory
- * representation of any OMG CORBA IDL data type.
- *
- * Implements the CORBA::TypeCode interface specified by CORBA 2.0
- * spec. Typecodes essentially consist of just the CDR octets
- * that get marshaled and unmarshaled, and this code knows how to
- * parse those octets and answer questions CORBA's TypeCode APIs
- * require.
- * @par
- * A TypeCode describes data. This one's as thin a wrapper around
- * CDR octet sequences as is practical. There are guesses here
- * about how the OMG C++ mapping and CORBA 2.0 IfR specification
- * will interact.
- *
- * @note Use TypeCode_ptr, except in code (e.g. output of and
- * OMG-IDL / compiler) that needs to create typecodes from
- * their octet-sequence encodings.
- *
- * @note This isn't well tuned performance-wise. Given how much is
- * variable (byte order, alignment) it's clear tuning has its
- * limits with respect to CDR bytecode interpretation.
- *
- *
- * @note (THREADING) Typecodes are readonly data structures, and the
- * only mutual exclusion relates to reference counting and
- * construction.
- */
- class TAO_Export TypeCode
- {
- public:
-
- // Two "user exceptions" are defined for manipulating TypeCodes. These
- // two classes are defined inside the TypeCode class.
- class TAO_Export Bounds : public CORBA::UserException
- {
- public:
- Bounds (void);
-
- static Bounds* _downcast (CORBA::Exception *ex);
- static CORBA::Exception *_alloc (void);
-
- virtual CORBA::Exception *_tao_duplicate (void) const;
-
- virtual void _raise (void) const;
-
- virtual void _tao_encode (TAO_OutputCDR &cdr
- ACE_ENV_ARG_DECL_NOT_USED) const;
- virtual void _tao_decode (TAO_InputCDR &cdr
- ACE_ENV_ARG_DECL_NOT_USED);
- };
-
- class TAO_Export BadKind : public CORBA::UserException
- {
- public:
- BadKind (void);
-
- static BadKind* _downcast (CORBA::Exception *ex);
- static CORBA::Exception *_alloc (void);
-
- virtual CORBA::Exception *_tao_duplicate (void) const;
-
- virtual void _raise (void) const;
-
- virtual void _tao_encode (TAO_OutputCDR &cdr
- ACE_ENV_ARG_DECL_NOT_USED) const;
- virtual void _tao_decode (TAO_InputCDR &cdr
- ACE_ENV_ARG_DECL_NOT_USED);
- };
-
- static CORBA::TypeCode_ptr _tc_Bounds;
- static CORBA::TypeCode_ptr _tc_BadKind;
-
- /// Duplicates i.e., increments ref count.
- static CORBA::TypeCode_ptr _duplicate (CORBA::TypeCode_ptr tc);
-
- /// Returns a NULL typecode.
- static CORBA::TypeCode_ptr _nil (void);
-
- /// Compares two typecodes. Must be identical in every respect.
- CORBA::Boolean equal (CORBA::TypeCode_ptr
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Conforms to CORBA 2.3.1 (99-10-07).
- CORBA::Boolean equivalent (CORBA::TypeCode_ptr
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// For all TypeCode kinds, returns the "kind" of the typecode.
- CORBA::TCKind kind (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// For tk_{objref,struct,union,enum,alias,except}. Returns the
- /// repository ID, raises BadKind.
- const char *id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns name (), raises (BadKind).
- const char *name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns member_count (), raises (BadKind). Useful for tk_struct,
- /// tk_union, tk_enum, tk_alias, and tk_except.
- CORBA::ULong member_count (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns member_name (...), raises (BadKind, Bounds); Useful for
- /// tk_struct, tk_union, tk_enum, tk_alias, and tk_except.
- const char *member_name (CORBA::ULong slot
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns member_type (...), raises (BadKind, Bounds); Useful for
- /// tk_struct, tk_union, and tk_except.
- CORBA::TypeCode_ptr member_type (CORBA::ULong slot
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// For tk_union. Returns the label. Raises BadKind, Bounds.
- CORBA::Any_ptr member_label (CORBA::ULong n
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the discriminator type for tk_union. raises (BadKind).
- CORBA::TypeCode_ptr discriminator_type (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the default slot for the tk_union. Raises (BadKind).
- CORBA::Long default_index (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns length, raises (BadKind). Used for tk_string,
- /// tk_sequence, and tk_array.
- CORBA::ULong length (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the content type (element type). Raises (BadKind); Useful
- /// for tk_sequence, tk_array, and tk_alias.
- CORBA::TypeCode_ptr content_type (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// These just throw CORBA::NO_IMPLEMENT.
- CORBA::UShort fixed_digits (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
- CORBA::Short fixed_scale (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the visibility (public/private) of the member at index
- /// 'slot'. Raises (BadKind, Bounds). Useful for tk_value only.
- CORBA::Visibility member_visibility (CORBA::ULong slot
- ACE_ENV_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the value modifier. Raises (BadKind). Useful for tk_value only.
- CORBA::ValueModifier type_modifier (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// Returns the concrete base type. Raises (BadKind); Useful
- /// for tk_value only.
- CORBA::TypeCode_ptr concrete_base_type (
- ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- // = Creation/refcounting
-
- // These aren't really public APIs, but an IDL compiler will need to
- // be able to create TypeCodes as part of creating stubs.
-
- /// This constructor is used only for built-in TypeCode constants,
- /// with no parameters.
- TypeCode (CORBA::TCKind kind);
-
- /**
- * This constructor is used both for typecode constants and for
- * heap-allocated TypeCodes. The two are distinguished by the
- * orb_owns_tc flag passed in by the creator.
- *
- * For simple param lists with a single numeric parameter, only
- * 'length' matters.
- *
- * For complex param lists, or simple param lists for which the
- * parameter is a string or typecode, length _and_ buffer matter.
- *
- * For typecodes that are precomputed from the encapsulation stream
- * of the parent, even the "parent" argument matters because this
- * implies that all children will share the octet buffers of its
- * parent
- */
- TypeCode (CORBA::TCKind kind,
- size_t length,
- const char *buffer,
- CORBA::Boolean orb_owns_tc,
- CORBA::ULong size,
- CORBA::TypeCode_ptr parent = 0);
-
- /// destructor
- ~TypeCode (void);
-
- /// These are used to indicate the status of marshaling.
- // Reference counting operations.
- CORBA::ULong _incr_refcnt (void);
- CORBA::ULong _decr_refcnt (void);
-
- // = Following three are deprecated
-
- // The following are deprecated in the CORBA 2.2 spec and are
- // missing altogether from 2.3a (98-12-04), but they are included
- // here as no-ops so legacy apps won't completely break. They
- // throw CORBA::NO_IMPLEMENT.
-
- /// Deprecated in the CORBA 2.2 spec and
- /// missing altogether from 2.3a (98-12-04),
- CORBA::Any_ptr parameter (const CORBA::Long slot
- ACE_ENV_ARG_DECL_WITH_DEFAULTS);
-
- /// Deprecated, CORBA 1.2, not fully usable. Returns the number of
- /// parameters that the typecode takes.
- CORBA::ULong param_count (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const;
-
- /// CDR decoding: the >> operator is not enough because we must also
- /// respect the parent/child relationship among TypeCodes.
- static void _tao_decode (const TypeCode *parent,
- TAO_InputCDR &cdr,
- TypeCode *&child
- ACE_ENV_ARG_DECL);
-
- /// Strip away all typedefs, if any.
- TypeCode_ptr unalias (ACE_ENV_SINGLE_ARG_DECL);
-
- // private:
- //
- // = The guts of the typecode implementation class
-
- // This is implemented as a counted set of bytes, in marshaled CDR
- // format.
-
- /// length of the encapsulated stream
- size_t length_;
-
- /// the encapsulated stream
- const char* buffer_;
-
- /// The byte order in the encapsulated stream.
- CORBA::Long byte_order_;
-
- /// the TypeCode kind
- CORBA::Long kind_;
-
- /**
- * Indirected typecodes share "buffer" with a parent, and hold a
- * reference to that parent to ensure its memory is not freed
- * inappropriately.
- */
- CORBA::TypeCode_ptr parent_;
-
- /**
- * my typecode base. Notice that the buffer_ member points to my
- * encapsulation. However, for indirected typecodes, the offsets
- * will point to my tk_kind field which should be pointed to be
- * tc_base_.
- */
- const char *tc_base_;
-
- /**
- * base of the topmost level typecode. Applicable only if I have
- * any parents, else it is the same as tc_base. This helps in case
- * we have indirections and we need to traverse beyond
- * encapsulation boundaries.
- */
- const char *root_tc_base_;
-
- /// Used in our destruction when we are in an Any.
- static void _tao_any_destructor (void *);
-
- /// skip a typecode encoding in a given CDR stream. This is just a
- /// helper function.
- static CORBA::Boolean skip_typecode (TAO_InputCDR &stream);
-
- typedef ACE_Unbounded_Queue<CORBA::Long> OFFSET_LIST;
- typedef ACE_Unbounded_Queue_Iterator<CORBA::Long> OFFSET_LIST_ITERATOR;
- typedef ACE_Hash_Map_Entry<const char *, OFFSET_LIST *> OFFSET_MAP_ENTRY;
- typedef ACE_Hash_Map_Manager_Ex<const char *,
- OFFSET_LIST *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>
- OFFSET_MAP;
-
- typedef ACE_Hash_Map_Iterator_Ex<const char *,
- OFFSET_LIST *,
- ACE_Hash<const char *>,
- ACE_Equal_To<const char *>,
- ACE_Null_Mutex>
- OFFSET_MAP_ITERATOR;
-
- OFFSET_MAP *offset_map (void) const;
- void offset_map (OFFSET_MAP *new_map);
-
- typedef CORBA::TypeCode_ptr _ptr_type;
- typedef CORBA::TypeCode_var _var_type;
- // Useful for template programming.
-
- private:
- // = All the private/helper methods
-
- /**
- * equal() and equivalent() must both recurse, but their
- * behavior is somewhat different (as defined in CORBA 2.3).
- * This function allows us to reuse the same code by acting
- * as the point of recursion and by adding the equiv_only
- * flag, to differentiate the behavior where necessary.
- */
- CORBA::Boolean equ_common (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// Compares the typecodes.
- CORBA::Boolean private_equal (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// For tk_{objref,struct,union,enum,alias,except}. Returns the
- /// repository ID, raises BadKind.
- const char *private_id (ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// returns name (), raises (BadKind)
- const char *private_name (ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// returns member_count (), raises (BadKind). Useful for tk_struct,
- /// tk_union, tk_enum, tk_alias, and tk_except.
- CORBA::ULong private_member_count (
- ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// returns member_type (...), raises (BadKind, Bounds); Useful for
- /// tk_struct, tk_union, and tk_except
- CORBA::TypeCode_ptr private_member_type (
- CORBA::ULong slot
- ACE_ENV_ARG_DECL
- ) const;
-
- /// returns member_name (...), raises (BadKind, Bounds); Useful for
- /// tk_union, tk_struct, tk_except, and tk_enum
- const char *private_member_name (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const;
-
- /// For tk_union. Returns the label. Raises BadKind, Bounds.
- CORBA::Any_ptr private_member_label (CORBA::ULong n
- ACE_ENV_ARG_DECL) const;
-
- /// returns the discriminator type for tk_union, and acquires the lock
- /// for the wrapped function below. raises (BadKind)
- CORBA::TypeCode_ptr private_discriminator_type (
- ACE_ENV_SINGLE_ARG_DECL
- ) const;
-
- /// Acquires no lock so it can be called internally from blocks
- /// which have a lock.
- CORBA::TypeCode_ptr private_discriminator_type_i (
- ACE_ENV_SINGLE_ARG_DECL
- ) const;
-
- /// returns the default slot for the tk_union. Raises (BadKind);
- CORBA::Long private_default_index (
- ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// Acquires no lock so it can be called internally from blocks
- /// which have a lock.
- CORBA::Long private_default_index_i (
- ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// Returns length, raises (BadKind). Used for tk_string,
- /// tk_sequence, and tk_array.
- CORBA::Long private_length (ACE_ENV_SINGLE_ARG_DECL) const;
-
- /// Returns the content type (element type). Raises (BadKind); Useful
- /// for tk_sequence, tk_array, and tk_alias.
- CORBA::TypeCode_ptr private_content_type (
- ACE_ENV_SINGLE_ARG_DECL
- ) const;
-
- /// Returns the visibility (public/private) of the member at index
- /// 'slot'. Raises (BadKind, Bounds). Useful for tk_value only.
- CORBA::Visibility private_member_visibility (CORBA::ULong slot
- ACE_ENV_ARG_DECL) const;
-
- /// Returns the value modifier. Raises (BadKind). Useful for
- /// tk_value only.
- CORBA::ValueModifier private_type_modifier (
- ACE_ENV_SINGLE_ARG_DECL
- ) const;
-
- /// Returns the concrete base type. Raises (BadKind). Useful for
- /// tk_value only.
- CORBA::TypeCode_ptr private_concrete_base_type (
- ACE_ENV_SINGLE_ARG_DECL
- ) const;
-
- // = All the private helpers testing for equality of typecodes
-
- /// test equality for typecodes of objrefs
- CORBA::Boolean private_equal_objref (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of structs
- CORBA::Boolean private_equal_struct (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of unions
- CORBA::Boolean private_equal_union (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of enums
- CORBA::Boolean private_equal_enum (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of strings
- CORBA::Boolean private_equal_string (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of wide strings
- CORBA::Boolean private_equal_wstring (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of sequences
- CORBA::Boolean private_equal_sequence (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of array
- CORBA::Boolean private_equal_array (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of typedefs
- CORBA::Boolean private_equal_alias (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of exceptions
- CORBA::Boolean private_equal_except (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- /// test equality for typecodes of exceptions
- CORBA::Boolean private_equal_valuetype (CORBA::TypeCode_ptr tc,
- CORBA::Boolean equiv_only
- ACE_ENV_ARG_DECL) const;
-
- private:
-
- // = No copy constructor or assignment operator supported;
-
- // Use TypeCode_ptr values, duplicate (), release ().
- TypeCode (const CORBA::TypeCode &src);
- TypeCode &operator = (const CORBA::TypeCode &src);
-
- private:
-
- /// if refcount reaches 0, free this typecode
- CORBA::ULong refcount_;
-
- /// Protect the reference count, this is OK because we do no
- /// duplicates or releases on the critical path.
- TAO_SYNCH_MUTEX refcount_lock_;
-
- /// TAO's approach differs from the SunSoft IIOP. Constant
- /// TypeCodes are owned by the ORB and get freed only when the ORB
- /// dies.
- /**
- * If "orb_owns" is false, the value is a not a constant typecode
- * with both the typecode and the buffer allocated (typically,
- * this will be created by the IDL compiler generated code)
- */
- CORBA::Boolean orb_owns_;
-
- /**
- * maintains precomputed state. We need a separate class that
- * maintains the precomputed state since most of the TypeCode class
- * operations keep the state of the object constant. However, for
- * the purpose of precomputation, we need to update the state. We
- * cannot update state directly in the TypeCode class as that
- * defeats the constness. However, we can keep an object in our
- * typecode class that remains constant, but we can update its
- * state.
- */
- TAO::TC_Private_State *private_state_;
-
- /**
- * Original buffer that may possibly be non-aligned. We still need a
- * handle to the allocated memory so that all of it can be freed by
- * the destructor.
- */
- char *non_aligned_buffer_;
-
- OFFSET_MAP *offset_map_;
- };
-} // End CORBA namespace
-
-// --------------------------------------------------------------
-
-namespace TAO
-{
- /// Used in generated code if CORBA::TypeCode is an argument or return type.
- ACE_TEMPLATE_SPECIALIZATION
- class TAO_Export Arg_Traits<CORBA::TypeCode>
- : public Object_Arg_Traits_T<CORBA::TypeCode_ptr,
- CORBA::TypeCode_var,
- CORBA::TypeCode_out,
- TAO::Objref_Traits<CORBA::TypeCode> >
- {
- };
-
- ACE_TEMPLATE_SPECIALIZATION
- struct TAO_Export Objref_Traits< ::CORBA::TypeCode>
- {
- static ::CORBA::TypeCode_ptr duplicate (
- ::CORBA::TypeCode_ptr
- );
- static void release (
- ::CORBA::TypeCode_ptr
- );
- static ::CORBA::TypeCode_ptr nil (void);
- static CORBA::Boolean marshal (
- ::CORBA::TypeCode_ptr p,
- TAO_OutputCDR & cdr
- );
- };
-
- /**
- * @class TC_Private_State
- *
- * @brief Private state of the TypeCode.
- *
- * Used to store precomputed values
- */
- class TC_Private_State
- {
- public:
- /// Constructor.
- TC_Private_State (CORBA::TCKind kind);
-
- /// Destructor.
- ~TC_Private_State (void);
-
- public:
-
- TAO_SYNCH_MUTEX mutex_;
-
- /// Our kind that will determine what kind of children we may have
- CORBA::TCKind tc_kind_;
-
- // Data members that indicate if the desired quantity
- // was precomputed or not.
- CORBA::Boolean tc_id_known_;
- CORBA::Boolean tc_name_known_;
- CORBA::Boolean tc_member_count_known_;
- CORBA::Boolean tc_member_type_list_known_;
- CORBA::Boolean tc_member_name_list_known_;
- CORBA::Boolean tc_member_label_list_known_;
- CORBA::Boolean tc_discriminator_type_known_;
- CORBA::Boolean tc_default_index_used_known_;
- CORBA::Boolean tc_length_known_;
- CORBA::Boolean tc_content_type_known_;
- CORBA::Boolean tc_discrim_pad_size_known_;
- CORBA::Boolean tc_member_visibility_list_known_;
- CORBA::Boolean tc_type_modifier_known_;
- CORBA::Boolean tc_concrete_base_type_known_;
-
- // These data members store the precomputed values.
- char *tc_id_;
- char *tc_name_;
- CORBA::ULong tc_member_count_;
- CORBA::TypeCode_ptr *tc_member_type_list_;
- char **tc_member_name_list_;
- CORBA::Any_ptr *tc_member_label_list_;
- CORBA::TypeCode_ptr tc_discriminator_type_;
- CORBA::Long tc_default_index_used_;
- CORBA::ULong tc_length_;
- CORBA::TypeCode_ptr tc_content_type_;
- CORBA::Visibility *tc_member_visibility_list_;
- CORBA::ValueModifier tc_type_modifier_;
- CORBA::TypeCode_ptr tc_concrete_base_type_;
- };
-} // End TAO namespace
-
-// Workaround for a Visual Studio .NET bug where this class is not
-// properly imported by an application if typedef'd or subclassed,
-// resulting in 'multiply defined' link errors. The export macro
-// here forces an explicit import by the application. Please see
-// http://support.microsoft.com/default.aspx?scid=kb;en-us;309801
-#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
- template class TAO_Export TAO_Unbounded_Pseudo_Sequence<CORBA::TypeCode>;
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
-
-// --------------------------------------------------------------
-
-TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR& cdr,
- const CORBA::TypeCode *x);
-TAO_Export CORBA::Boolean operator>> (TAO_InputCDR& cdr,
- CORBA::TypeCode *&x);
-
-#if defined (__ACE_INLINE__)
-# include "tao/Typecode.i"
-#endif /* __ACE_INLINE__ */
-
-#include /**/ "ace/post.h"
-
-#endif /* TAO_TYPECODE_H */
diff --git a/TAO/tao/Typecode.i b/TAO/tao/Typecode.i
deleted file mode 100644
index 6c6f85e2fd2..00000000000
--- a/TAO/tao/Typecode.i
+++ /dev/null
@@ -1,133 +0,0 @@
-// -*- C++ -*-
-//
-// $Id$
-
-ACE_INLINE CORBA::ULong
-CORBA::TypeCode::_incr_refcnt (void)
-{
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->refcount_lock_, 0);
- return this->refcount_++;
-}
-
-ACE_INLINE CORBA::ULong
-CORBA::TypeCode::_decr_refcnt (void)
-{
- {
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->refcount_lock_, 0);
- this->refcount_--;
- if (this->refcount_ != 0)
- return this->refcount_;
- }
- delete this;
- return 0;
-}
-
-ACE_INLINE CORBA::TypeCode_ptr
-CORBA::TypeCode::_duplicate (CORBA::TypeCode_ptr tc)
-{
- if (tc)
- tc->_incr_refcnt ();
- return tc;
-}
-
-ACE_INLINE CORBA::TypeCode_ptr
-CORBA::TypeCode::_nil (void)
-{
- return (CORBA::TypeCode_ptr)0;
-}
-
-ACE_INLINE CORBA::TCKind
-CORBA::TypeCode::kind (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
-{
- return (CORBA::TCKind) this->kind_;
-}
-
-// Returns true if the two typecodes are equivalent.
-ACE_INLINE CORBA::Boolean
-CORBA::TypeCode::equivalent (CORBA::TypeCode_ptr tc
- ACE_ENV_ARG_DECL) const
-{
- return this->equ_common (tc,
- 1
- ACE_ENV_ARG_PARAMETER);
-}
-
-// Returns true if the two typecodes are identical.
-ACE_INLINE CORBA::Boolean
-CORBA::TypeCode::equal (CORBA::TypeCode_ptr tc
- ACE_ENV_ARG_DECL) const
-{
- return this->equ_common (tc,
- 0
- ACE_ENV_ARG_PARAMETER);
-}
-
-// returns the Repository ID
-ACE_INLINE const char *
-CORBA::TypeCode::id (ACE_ENV_SINGLE_ARG_DECL) const
-{
- // if already precomputed
- if (this->private_state_->tc_id_known_)
- return this->private_state_->tc_id_;
- else
- return this->private_id (ACE_ENV_SINGLE_ARG_PARAMETER);
-}
-
-// returns the string name
-ACE_INLINE const char *
-CORBA::TypeCode::name (ACE_ENV_SINGLE_ARG_DECL) const
-{
- // if already precomputed
- if (this->private_state_->tc_name_known_)
- return this->private_state_->tc_name_;
- else
- return this->private_name (ACE_ENV_SINGLE_ARG_PARAMETER);
-}
-
-// Return the number of members defined by this typecode
-//
-// Applicable to struct, union, enum, alias, and except
-// For the rest of the cases, raises the BadKind exception.
-
-ACE_INLINE CORBA::ULong
-CORBA::TypeCode::member_count (ACE_ENV_SINGLE_ARG_DECL) const
-{
- // if already precomputed...
- if (this->private_state_->tc_member_count_known_)
- {
- return this->private_state_->tc_member_count_;
- }
- else
- {
- return this->private_member_count (ACE_ENV_SINGLE_ARG_PARAMETER);
- }
-}
-
-ACE_INLINE CORBA::TypeCode::OFFSET_MAP *
-CORBA::TypeCode::offset_map (void) const
-{
- return this->offset_map_;
-}
-
-ACE_INLINE void
-CORBA::TypeCode::offset_map (CORBA::TypeCode::OFFSET_MAP *new_map)
-{
- this->offset_map_ = new_map;
-}
-
-// ************************************************************
-// These are in CORBA namespace
-
-ACE_INLINE CORBA::Boolean
-CORBA::is_nil (CORBA::TypeCode_ptr obj)
-{
- return obj == 0;
-}
-
-ACE_INLINE void
-CORBA::release (CORBA::TypeCode_ptr obj)
-{
- if (obj)
- obj->_decr_refcnt ();
-}
-
diff --git a/TAO/tao/Typecode_Constants.cpp b/TAO/tao/Typecode_Constants.cpp
deleted file mode 100644
index 57d20d38389..00000000000
--- a/TAO/tao/Typecode_Constants.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// Typecode_Constants.cpp
-//
-// = DESCRIPTION
-// All the CORBA-specified typecode constants.
-//
-// NOTE: IFR TypeCode constants aren't here; they're left for an IDL
-// compiler to generate from the appropriate IDL source.
-//
-// NOTE: it'd be nice to have these not use init sections. Most can easily
-// be in readonly data (e.g. text segment, ROM) rather than writable data;
-// that speeds program startup and page sharing in shared libraries.
-//
-// THREADING NOTE: no issues, these are immutable constants
-//
-// = AUTHOR
-// Copyright 1994-1995 by Sun Microsystems Inc.
-// and Aniruddha Gokhale
-//
-// ============================================================================
-
-#include "tao/Typecode_Constants.h"
-#include "tao/Typecode.h"
-#include "tao/NVList.h"
-#include "tao/ORB.h"
-#include "tao/Object.h"
-#include "tao/SystemException.h"
-
-#if defined (TAO_HAS_AMI_POLLER) && (TAO_HAS_AMI_POLLER == 1)
-#include "tao/PollableC.h"
-#endif /* TAO_HAS_AMI_POLLER == 1 */
-
-ACE_RCSID (tao,
- Typecode_Constants,
- "$Id$")
-
-// Declare all the standard typecodes owned by the ORB
-
-// Null and void
-namespace CORBA
-{
- TypeCode_ptr _tc_null = 0;
- TypeCode_ptr _tc_void = 0;
-
- // Basic numeric types: short, long, longlong, and unsigned
- // variants
-
- TypeCode_ptr _tc_short = 0;
- TypeCode_ptr _tc_long = 0;
- TypeCode_ptr _tc_longlong = 0;
- TypeCode_ptr _tc_ushort = 0;
- TypeCode_ptr _tc_ulong = 0;
- TypeCode_ptr _tc_ulonglong = 0;
-
- // Floating point types: single, double, quad precision
- TypeCode_ptr _tc_float = 0;
- TypeCode_ptr _tc_double = 0;
- TypeCode_ptr _tc_longdouble = 0;
-
- // Various simple quantities.
- TypeCode_ptr _tc_boolean = 0;
- TypeCode_ptr _tc_octet = 0;
-
- // Internationalization-related data types: ISO Latin/1 and "wide"
- // characters, and strings of each. "wchar" is probably Unicode 1.1,
- // "wstring" being null-terminated sets thereof.
- TypeCode_ptr _tc_char = 0;
- TypeCode_ptr _tc_wchar = 0;
-
- // a string/wstring have a simple parameter list that indicates the
- // length
- TypeCode_ptr _tc_string = 0;
- TypeCode_ptr _tc_wstring = 0;
-
- //
- // Various things that can be passed as "general" parameters:
- // Any, TypeCode_ptr Principal_ptr, Object_ptr
- //
- TypeCode_ptr _tc_any = 0;
- TypeCode_ptr _tc_TypeCode = 0;
- TypeCode_ptr _tc_Principal = 0;
- TypeCode_ptr _tc_Object = 0;
-
- // Two typecodes for exceptions
- TypeCode_ptr CORBA::TypeCode::_tc_Bounds = 0;
- TypeCode_ptr CORBA::TypeCode::_tc_BadKind = 0;
- TypeCode_ptr _tc_exception_type = 0;
-
-#if (TAO_HAS_MINIMUM_CORBA == 0)
- TypeCode_ptr _tc_NamedValue = 0;
-#endif /* TAO_HAS_MINIMUM_CORBA */
-} // End namespace CORBA
-
-namespace TAO
-{
- // Internal to TAO ORB
- CORBA::TypeCode_ptr TC_opaque = 0;
- CORBA::TypeCode_ptr TC_completion_status = 0;
-
- // Flag that denotes that the TAO TypeCode constants have been
- // initialized.
- int TypeCode_Constants::initialized_ = 0;
-
- // Initialize all the ORB owned TypeCode constants. This routine will
- // be invoked by the ORB_init method.
- void
- TypeCode_Constants::init (void)
- {
- // Initialize all the standard typecodes owned by the ORB
-
- // Not thread safe. Caller must provide synchronization.
-
- // Do not execute code after this point more than once.
- if (initialized_ != 0)
- {
- return;
- }
-
- initialized_ = 1;
-
- // Null and void.
- ACE_NEW (CORBA::_tc_null,
- CORBA::TypeCode (CORBA::tk_null));
-
- ACE_NEW (CORBA::_tc_void,
- CORBA::TypeCode (CORBA::tk_void));
-
- // Basic numeric types: short, long, longlong, and unsigned variants.
- ACE_NEW (CORBA::_tc_short,
- CORBA::TypeCode (CORBA::tk_short));
-
- ACE_NEW (CORBA::_tc_long,
- CORBA::TypeCode (CORBA::tk_long));
-
- ACE_NEW (CORBA::_tc_longlong,
- CORBA::TypeCode (CORBA::tk_longlong));
-
- ACE_NEW (CORBA::_tc_ushort,
- CORBA::TypeCode (CORBA::tk_ushort));
-
- ACE_NEW (CORBA::_tc_ulong,
- CORBA::TypeCode (CORBA::tk_ulong));
-
- ACE_NEW (CORBA::_tc_ulonglong,
- CORBA::TypeCode (CORBA::tk_ulonglong));
-
- // Floating point types: single, double, quad precision.
- ACE_NEW (CORBA::_tc_float,
- CORBA::TypeCode (CORBA::tk_float));
-
- ACE_NEW (CORBA::_tc_double,
- CORBA::TypeCode (CORBA::tk_double));
-
- ACE_NEW (CORBA::_tc_longdouble,
- CORBA::TypeCode (CORBA::tk_longdouble));
-
- // Various simple quantities.
- ACE_NEW (CORBA::_tc_boolean,
- CORBA::TypeCode (CORBA::tk_boolean));
-
- ACE_NEW (CORBA::_tc_octet,
- CORBA::TypeCode (CORBA::tk_octet));
-
- // Internationalization-related data types: ISO Latin/1 and "wide"
- // characters, and strings of each. "wchar" is probably Unicode 1.1,
- // "wstring" being null-terminated sets thereof.
- ACE_NEW (CORBA::_tc_char,
- CORBA::TypeCode (CORBA::tk_char));
-
- ACE_NEW (CORBA::_tc_wchar,
- CORBA::TypeCode (CORBA::tk_wchar));
-
- // A string/wstring have a simple parameter list that
- // indicates the length.
- static const CORBA::Long _oc_string [] =
- {
- // CDR typecode octets
- TAO_ENCAP_BYTE_ORDER, // native endian + padding; "tricky"
- 0 // ... unbounded string
- };
-
- ACE_NEW (CORBA::_tc_string,
- CORBA::TypeCode (CORBA::tk_string,
- sizeof _oc_string,
- (char*)&_oc_string,
- 1,
- sizeof (CORBA::String_var)));
-
- static const CORBA::Long _oc_wstring [] =
- {
- // CDR typecode octets
- TAO_ENCAP_BYTE_ORDER, // native endian + padding; "tricky"
- 0 // ... unbounded string
- };
-
- ACE_NEW (CORBA::_tc_wstring,
- CORBA::TypeCode (CORBA::tk_wstring,
- sizeof _oc_wstring,
- (char *) &_oc_wstring,
- 1,
- sizeof (CORBA::WChar*)));
-
- //
- // Various things that can be passed as "general" parameters:
- // Any, TypeCode_ptr, Principal_ptr, Object_ptr
- //
- ACE_NEW (CORBA::_tc_any,
- CORBA::TypeCode (CORBA::tk_any));
-
- ACE_NEW (CORBA::_tc_TypeCode,
- CORBA::TypeCode (CORBA::tk_TypeCode));
-
- ACE_NEW (CORBA::_tc_Principal,
- CORBA::TypeCode (CORBA::tk_Principal));
-
- // typecode for objref is complex, has two string parameters
- //
- // NOTE: Must be four-byte aligned
-
- static const CORBA::Long _oc_CORBA_Object[] =
- {
- TAO_ENCAP_BYTE_ORDER, // byte order
- 29,
- ACE_NTOHL (0x49444c3a),
- ACE_NTOHL (0x6f6d672e),
- ACE_NTOHL (0x6f72672f),
- ACE_NTOHL (0x434f5242),
- ACE_NTOHL (0x412f4f62),
- ACE_NTOHL (0x6a656374),
- ACE_NTOHL (0x3a312e30),
- ACE_NTOHL (0x0), // repository ID = IDL:omg.org/CORBA/Object:1.0
- 7,
- ACE_NTOHL (0x4f626a65),
- ACE_NTOHL (0x63740000), // name = Object
- };
-
- ACE_NEW (CORBA::_tc_Object,
- CORBA::TypeCode (CORBA::tk_objref,
- sizeof (_oc_CORBA_Object),
- (char *) &_oc_CORBA_Object,
- 1,
- sizeof (CORBA::Object)));
-
- // Static initialization of the two user-defined exceptions that
- // are part of the ORB.
-
- static const CORBA::Long _oc_CORBA_TypeCode_Bounds[] =
- {
- TAO_ENCAP_BYTE_ORDER, // byte order
- 38,
- ACE_NTOHL (0x49444c3a),
- ACE_NTOHL (0x6f6d672e),
- ACE_NTOHL (0x6f72672f),
- ACE_NTOHL (0x434f5242),
- ACE_NTOHL (0x412f5479),
- ACE_NTOHL (0x7065436f),
- ACE_NTOHL (0x64652f42),
- ACE_NTOHL (0x6f756e64),
- ACE_NTOHL (0x733a312e),
- ACE_NTOHL (0x30000000), // repository ID = IDL:omg.org/CORBA/TypeCode/Bounds:1.0
- 7,
- ACE_NTOHL (0x426f756e),
- ACE_NTOHL (0x64730000), // name = Bounds
- 0, // member count
- };
-
- ACE_NEW (CORBA::TypeCode::_tc_Bounds,
- CORBA::TypeCode (CORBA::tk_except,
- sizeof (_oc_CORBA_TypeCode_Bounds),
- (char*) &_oc_CORBA_TypeCode_Bounds,
- 1,
- sizeof (CORBA::TypeCode::Bounds)));
-
-
- static const CORBA::Long _oc_CORBA_TypeCode_BadKind[] =
- {
- TAO_ENCAP_BYTE_ORDER, // byte order
- 39,
- ACE_NTOHL (0x49444c3a),
- ACE_NTOHL (0x6f6d672e),
- ACE_NTOHL (0x6f72672f),
- ACE_NTOHL (0x434f5242),
- ACE_NTOHL (0x412f5479),
- ACE_NTOHL (0x7065436f),
- ACE_NTOHL (0x64652f42),
- ACE_NTOHL (0x61644b69),
- ACE_NTOHL (0x6e643a31),
- ACE_NTOHL (0x2e300000), // repository ID = IDL:omg.org/CORBA/TypeCode/BadKind:1.0
- 8,
- ACE_NTOHL (0x4261644b),
- ACE_NTOHL (0x696e6400), // name = BadKind
- 0, // member count
- };
-
- ACE_NEW (CORBA::TypeCode::_tc_BadKind,
- CORBA::TypeCode (CORBA::tk_except,
- sizeof (_oc_CORBA_TypeCode_BadKind),
- (char*) &_oc_CORBA_TypeCode_BadKind,
- 1,
- sizeof (CORBA::TypeCode::BadKind)));
-
- #if (TAO_HAS_MINIMUM_CORBA == 0)
-
- static const CORBA::Long _oc_corba_NamedValue[] =
- {
- TAO_ENCAP_BYTE_ORDER, // byte order
- 33,
- ACE_NTOHL (0x49444c3a),
- ACE_NTOHL (0x6f6d672e),
- ACE_NTOHL (0x6f72672f),
- ACE_NTOHL (0x636f7262),
- ACE_NTOHL (0x612f4e61),
- ACE_NTOHL (0x6d656456),
- ACE_NTOHL (0x616c7565),
- ACE_NTOHL (0x3a312e30),
- ACE_NTOHL (0x0), // repository ID =
- // IDL:omg.org/corba/NamedValue:1.0
- 11,
- ACE_NTOHL (0x4e616d65),
- ACE_NTOHL (0x6456616c),
- ACE_NTOHL (0x75650000), // name = NamedValue,
- };
-
- ACE_NEW (CORBA::_tc_NamedValue,
- CORBA::TypeCode (CORBA::tk_objref,
- sizeof (_oc_corba_NamedValue),
- (char *) &_oc_corba_NamedValue,
- 0,
- sizeof (CORBA::NamedValue)));
-
- #endif /* TAO_HAS_MINIMUM_CORBA */
-
- // ****************************************************************
-
- // The following are internal to the TAO ORB
-
- // Octet codes for the parameters of the "Opaque" (sequence of octet)
- // data type used various places internally ... a CDR encapsulation
- // holding two parameters (like all sequence TypeCodes).
- //
- // NOTE: this **MUST** be longword aligned, which is why it's coded as
- // a longword array not an octet array. Just sticking a long in for
- // padding won't work with compilers that optimize unused data out of
- // existence.
-
- // CDR typecode octets.
-
- typedef TAO_Unbounded_Sequence<CORBA::Octet> TAO_opaque;
-
- static const CORBA::Long _oc_opaque [] =
- {
-
- TAO_ENCAP_BYTE_ORDER, // native endian + padding; "tricky"
- 10, // ... (sequence of) octets
- 0 // ... unbounded
- };
-
- ACE_NEW (TC_opaque,
- CORBA::TypeCode (CORBA::tk_sequence,
- sizeof _oc_opaque,
- (char *) &_oc_opaque,
- 1,
- sizeof (TAO_opaque)));
-
- // Octet codes for the parameters of the ServiceContextList TypeCode
- // ... this is a CDR encapsulation holding two parameters (like all
- // sequences): a TypeCode, and the bounds of the sequence (zero in
- // this case).
- //
- // This is complicated since the Typecode for the data type for the
- // sequence members is complex, a structure that nests two further
- // typecodes (one is a sequence).
- //
- // NOTE: this must be longword aligned!
-
- static const CORBA::ULong oc_completion_status [] =
- {
- TAO_ENCAP_BYTE_ORDER, // byte order flag, tricky
- 0, 0, // type ID omitted
- 3, // three members
- 0, 0, // ... whose names are all omitted
- 0, 0,
- 0, 0
- };
-
- ACE_NEW (TC_completion_status,
- CORBA::TypeCode (CORBA::tk_enum,
- sizeof oc_completion_status,
- (char *) &oc_completion_status,
- 1,
- sizeof (CORBA::CompletionStatus)));
- }
-
- // Destroy all the typecodes owned by the ORB.
- void
- TypeCode_Constants::fini (void)
- {
- // Release all the standard typecodes owned by the ORB.
-
- // Null and void.
- CORBA::release (CORBA::_tc_null);
-
- CORBA::release (CORBA::_tc_void);
-
- // Basic numeric types: short, long, longlong, and unsigned variants
- CORBA::release (CORBA::_tc_short);
-
- CORBA::release (CORBA::_tc_long);
-
- CORBA::release (CORBA::_tc_longlong);
-
- CORBA::release (CORBA::_tc_ushort);
-
- CORBA::release (CORBA::_tc_ulong);
-
- CORBA::release (CORBA::_tc_ulonglong);
-
- // Floating point types: single, double, quad precision
- CORBA::release (CORBA::_tc_float);
-
- CORBA::release (CORBA::_tc_double);
-
- CORBA::release (CORBA::_tc_longdouble);
-
- // Various simple quantities.
- CORBA::release (CORBA::_tc_boolean);
-
- CORBA::release (CORBA::_tc_octet);
-
- // Internationalization-related data types: ISO Latin/1 and "wide"
- // characters, and strings of each. "wchar" is probably Unicode 1.1,
- // "wstring" being null-terminated sets thereof.
- CORBA::release (CORBA::_tc_char);
-
- CORBA::release (CORBA::_tc_wchar);
-
- // A string/wstring have a simple parameter list that
- // indicates the length.
- CORBA::release (CORBA::_tc_string);
-
- CORBA::release (CORBA::_tc_wstring);
-
- //
- // Various things that can be passed as "general" parameters:
- // Any, TypeCode_ptr, Principal_ptr, Object_ptr
- //
- CORBA::release (CORBA::_tc_any);
-
- CORBA::release (CORBA::_tc_TypeCode);
-
- CORBA::release (CORBA::_tc_Principal);
-
- // typecode for objref is complex, has two string parameters
- //
- CORBA::release (CORBA::_tc_Object);
-
- // other ORB owned typecodes
- CORBA::release (CORBA::TypeCode::_tc_Bounds);
-
- CORBA::release (CORBA::TypeCode::_tc_BadKind);
-
- #if (TAO_HAS_MINIMUM_CORBA == 0)
-
- CORBA::release (CORBA::_tc_NamedValue);
-
- #endif /* TAO_HAS_MINIMUM_CORBA */
-
- // TAO specific
- CORBA::release (TC_opaque);
-
- CORBA::release (TC_completion_status);
- }
-} // end namespace TAO
diff --git a/TAO/tao/Typecode_typesC.h b/TAO/tao/Typecode_typesC.h
index 6fa50f8c3ff..9bacd563cbe 100644
--- a/TAO/tao/Typecode_typesC.h
+++ b/TAO/tao/Typecode_typesC.h
@@ -121,7 +121,7 @@ namespace CORBA
// This symbol is not defined by CORBA 3.0. It's used to speed up
// dispatch based on TCKind values, and lets many important ones
// just be table lookups. It must always be the last enum value!!
- , TC_KIND_COUNT
+ , TAO_TC_KIND_COUNT
};
typedef TCKind &TCKind_out;
diff --git a/TAO/tao/append.cpp b/TAO/tao/append.cpp
index fe8f03070ba..f94f10ff6f2 100644
--- a/TAO/tao/append.cpp
+++ b/TAO/tao/append.cpp
@@ -167,7 +167,7 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
// heap access ... also, to speed things up!
- if ((kind < CORBA::TC_KIND_COUNT)
+ if ((kind < CORBA::TAO_TC_KIND_COUNT)
|| (kind == ~0u))
{
// Either a non-constant typecode or an indirected typecode.
diff --git a/TAO/tao/diffs/Typecode_types.diff b/TAO/tao/diffs/Typecode_types.diff
index 4ff1392d63f..46dd87ebbf9 100644
--- a/TAO/tao/diffs/Typecode_types.diff
+++ b/TAO/tao/diffs/Typecode_types.diff
@@ -43,7 +43,7 @@
+ // This symbol is not defined by CORBA 3.0. It's used to speed up
+ // dispatch based on TCKind values, and lets many important ones
+ // just be table lookups. It must always be the last enum value!!
-+ , TC_KIND_COUNT
++ , TAO_TC_KIND_COUNT
};
typedef TCKind &TCKind_out;
diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp
index e78b27ddd19..461290890d5 100644
--- a/TAO/tao/skip.cpp
+++ b/TAO/tao/skip.cpp
@@ -132,7 +132,7 @@ TAO_Marshal_TypeCode::skip (CORBA::TypeCode_ptr,
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
// heap access ... also, to speed things up!
- if ((kind < CORBA::TC_KIND_COUNT) ||
+ if ((kind < CORBA::TAO_TC_KIND_COUNT) ||
(kind == ~0u))
{
// Either a non-constant typecode or an indirected typecode.