TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy > Class Template Reference

CORBA::TypeCode implementation for an OMG IDL typedef. More...

#include <Alias_TypeCode.h>

Inheritance diagram for TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >:

Inheritance graph
[legend]
Collaboration diagram for TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >:

Collaboration graph
[legend]
List of all members.

@c TAO CORBA::TypeCode Template Methods

tk_alias and tk_value_box CORBA::TypeCode -specific template methods.

See also:
CORBA::TypeCode


virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc) const
virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc) const
virtual CORBA::TypeCode_ptr get_compact_typecode_i (void) const
virtual char const * id_i (void) const
virtual char const * name_i (void) const
virtual CORBA::TypeCode_ptr content_type_i (void) const
Base_Attributes< StringType > attributes_
TypeCodeType const  content_type_

Public Member Functions

 Alias (CORBA::TCKind kind, char const *id, char const *name, TypeCodeType const &tc)
 Constructor.

TAO-specific @c CORBA::TypeCode Methods
Methods required by TAO's implementation of the CORBA::TypeCode class.

See also:
CORBA::TypeCode


virtual bool tao_marshal (TAO_OutputCDR &cdr, CORBA::ULong offset) const
 Marshal this TypeCode into a CDR output stream.

virtual void tao_duplicate (void)
 Increase the reference count on this TypeCode.

virtual void tao_release (void)
 Decrease the reference count on this object.


Detailed Description

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
class TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >

CORBA::TypeCode implementation for an OMG IDL typedef.

This class implements a CORBA::TypeCode for an OMG IDL typedef.

Definition at line 48 of file Alias_TypeCode.h.


Constructor & Destructor Documentation

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::Alias CORBA::TCKind  kind,
char const *  id,
char const *  name,
TypeCodeType const &  tc
 

Constructor.

Definition at line 13 of file Alias_TypeCode.inl.

00024   : ::CORBA::TypeCode (kind)
00025   , RefCountPolicy ()
00026   , attributes_ (id, name)
00027   , content_type_ (tc)
00028 {
00029 }


Member Function Documentation

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
CORBA::TypeCode_ptr TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::content_type_i void   )  const [protected, virtual]
 

Reimplemented from CORBA::TypeCode.

Definition at line 181 of file Alias_TypeCode.cpp.

References CORBA::TypeCode::_duplicate().

00182 {
00183   return
00184      CORBA::TypeCode::_duplicate (
00185        Traits<StringType>::get_typecode (this->content_type_));
00186 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
CORBA::Boolean TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::equal_i CORBA::TypeCode_ptr  tc  )  const [protected, virtual]
 

Implements CORBA::TypeCode.

Definition at line 86 of file Alias_TypeCode.cpp.

00087 {
00088   // The CORBA::TypeCode base class already verified equality of the
00089   // base attributes (id and name).  Perform an equality comparison of
00090   // the content.
00091 
00092   CORBA::TypeCode_var rhs_content_type = tc->content_type ();
00093 
00094   return
00095     Traits<StringType>::get_typecode (this->content_type_)->equal (
00096       rhs_content_type.in ());
00097 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
CORBA::Boolean TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::equivalent_i CORBA::TypeCode_ptr  tc  )  const [protected, virtual]
 

Implements CORBA::TypeCode.

Definition at line 105 of file Alias_TypeCode.cpp.

00106 {
00107   // Equivalence already verified in the base class
00108   // CORBA::TypeCode::equivalent() method.
00109 
00110   return true;
00111 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
CORBA::TypeCode_ptr TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::get_compact_typecode_i void   )  const [protected, virtual]
 

Implements CORBA::TypeCode.

Definition at line 119 of file Alias_TypeCode.cpp.

References TAO_TypeCodeFactory_Adapter::create_alias_tc(), TAO_TypeCodeFactory_Adapter::create_value_box_tc(), and ACE_Dynamic_Service< TYPE >::instance().

00120 {
00121   TAO_TypeCodeFactory_Adapter * const adapter =
00122     ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
00123         TAO_ORB_Core::typecodefactory_adapter_name ()
00124       );
00125 
00126   if (adapter == 0)
00127     {
00128       throw ::CORBA::INITIALIZE ();
00129     }
00130 
00131   CORBA::TypeCode_var compact_content_type =
00132     Traits<StringType>::get_typecode (
00133       this->content_type_)->get_compact_typecode ();
00134 
00135   if (this->kind_ == CORBA::tk_alias)
00136     {
00137       return adapter->create_alias_tc (this->attributes_.id (),
00138                                        "",  /* empty name */
00139                                        compact_content_type.in ());
00140     }
00141   else
00142     {
00143       return adapter->create_value_box_tc (this->attributes_.id (),
00144                                            "",  /* empty name */
00145                                            compact_content_type.in ());
00146     }
00147 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
char const * TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::id_i void   )  const [protected, virtual]
 

Reimplemented from CORBA::TypeCode.

Definition at line 155 of file Alias_TypeCode.cpp.

00156 {
00157   // Ownership is retained by the TypeCode, as required by the C++
00158   // mapping.
00159   return this->attributes_.id ();
00160 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
char const * TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::name_i void   )  const [protected, virtual]
 

Reimplemented from CORBA::TypeCode.

Definition at line 168 of file Alias_TypeCode.cpp.

00169 {
00170   // Ownership is retained by the TypeCode, as required by the C++
00171   // mapping.
00172   return this->attributes_.name ();
00173 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
void TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::tao_duplicate void   )  [virtual]
 

Increase the reference count on this TypeCode.

Implements CORBA::TypeCode.

Definition at line 64 of file Alias_TypeCode.cpp.

00065 {
00066   this->RefCountPolicy::add_ref ();
00067 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
TAO_BEGIN_VERSIONED_NAMESPACE_DECL bool TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::tao_marshal TAO_OutputCDR cdr,
CORBA::ULong  offset
const [virtual]
 

Marshal this TypeCode into a CDR output stream.

Marshal this TypeCode into the cdr output CDR stream, excluding the TypeCode kind. Existing cdr contents will not be altered. The marshaled TypeCode will be appended to the given cdr CDR output stream.

Parameters:
cdr Output CDR stream into which the TypeCode will be marshaled.
offset Number of bytes currently in the output CDR stream, including the top-level TypeCode TCKind. This argument is useful for recursive TypeCodes. TypeCodes that contain other TypeCodes should pass an updated offset value to the marshaling operation for those contained TypeCodes.
Returns:
true if marshaling was successful.
Note:
This is a TAO-specific method that is not part of the standard CORBA::TypeCode interface.

If this method returns false, the contents of the cdr output CDR stream are undefined.

Implements CORBA::TypeCode.

Definition at line 27 of file Alias_TypeCode.cpp.

References ACE_align_binary(), ACE_OutputCDR::begin(), TAO_ENCAP_BYTE_ORDER, and ACE_OutputCDR::total_length().

00029 {
00030   // A tk_alias TypeCode has a "complex" parameter list type (see
00031   // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
00032   // the CORBA specification), meaning that it must be marshaled into
00033   // a CDR encapsulation.
00034 
00035   // Create a CDR encapsulation.
00036 
00037   TAO_OutputCDR enc;
00038 
00039   // Account for the encoded CDR encapsulation length and byte order.
00040   //
00041   // Aligning on an octet since the next value after the CDR
00042   // encapsulation length will always be the byte order octet/boolean
00043   // in this case.
00044   offset = ACE_align_binary (offset + 4,
00045                              ACE_CDR::OCTET_ALIGN);
00046 
00047   return
00048     enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
00049     && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
00050     && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
00051     && marshal (enc,
00052                 Traits<StringType>::get_typecode (this->content_type_),
00053                 offset + enc.total_length ())
00054     && cdr << static_cast<CORBA::ULong> (enc.total_length ())
00055     && cdr.write_octet_array_mb (enc.begin ());
00056 }

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
void TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::tao_release void   )  [virtual]
 

Decrease the reference count on this object.

Implements CORBA::TypeCode.

Definition at line 75 of file Alias_TypeCode.cpp.

00076 {
00077   this->RefCountPolicy::remove_ref ();
00078 }


Member Data Documentation

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
Base_Attributes<StringType> TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::attributes_ [private]
 

Base attributes for this TypeCode containing the repository ID and name of the typedef.

Definition at line 103 of file Alias_TypeCode.h.

template<typename StringType, typename TypeCodeType, class RefCountPolicy>
TypeCodeType const TAO::TypeCode::Alias< StringType, TypeCodeType, RefCountPolicy >::content_type_ [private]
 

A pointer to the CORBA::TypeCode_ptr rather than the CORBA::TypeCode_ptr itself is stored since that address is well-defined. We may not know the value of the CORBA::TypeCode_ptr when creating this Field statically at compile-time, hence the indirection.

Note:
This TypeCode is released upon destruction of this TypeCode::Alias.

Definition at line 117 of file Alias_TypeCode.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:22:09 2008 for TAO_AnyTypeCode by doxygen 1.3.6