Public Member Functions | Private Attributes

TAO::TypeCodeFactory::Recursive_TypeCode Class Reference

Recursive TypeCode placeholder. More...

#include <Recursive_TypeCode.h>

Inheritance diagram for TAO::TypeCodeFactory::Recursive_TypeCode:
Inheritance graph
[legend]
Collaboration diagram for TAO::TypeCodeFactory::Recursive_TypeCode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Recursive_TypeCode (char const *id)
 Constructor.
void the_typecode (CORBA::TypeCode_ptr tc)
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_kind (TAO_OutputCDR &cdr) const
 Marshal the TypeCode TCKind.
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.

Protected Member Functions

TAO @c CORBA::TypeCode Template Methods

Recursive type-capable (i.e. struct, union, valuetype and eventtype) 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::ULong member_count_i (void) const
virtual char const * member_name_i (CORBA::ULong index) const
virtual CORBA::TypeCode_ptr member_type_i (CORBA::ULong index) const
virtual CORBA::Anymember_label_i (CORBA::ULong index) const
virtual CORBA::TypeCode_ptr discriminator_type_i (void) const
virtual CORBA::Long default_index_i (void) const
virtual CORBA::Visibility member_visibility_i (CORBA::ULong index) const
virtual CORBA::ValueModifier type_modifier_i (void) const
virtual CORBA::TypeCode_ptr concrete_base_type_i (void) const

Private Attributes

CORBA::String_var id_
 Repository ID.
CORBA::TypeCode_ptr the_typecode_

Detailed Description

Recursive TypeCode placeholder.

This class implements a placeholder for recursive TypeCodes. It is meant solely for use as an intermediate TypeCode, and merely forwards all operations to the actual recursive TypeCode that is set by the TypeCodeFactory.

Note:
This class serves a purpose different than the one served by the TAO::TypeCode::Recursive class.

Definition at line 42 of file Recursive_TypeCode.h.


Constructor & Destructor Documentation

TAO::TypeCodeFactory::Recursive_TypeCode::Recursive_TypeCode ( char const *  id  ) 

Constructor.

Definition at line 8 of file Recursive_TypeCode.inl.

  : ::CORBA::TypeCode (CORBA::TAO_TC_KIND_COUNT)
  , ::TAO::True_RefCount_Policy ()
  , id_ (id)
  , the_typecode_ ()
{
}


Member Function Documentation

CORBA::TypeCode_ptr TAO::TypeCodeFactory::Recursive_TypeCode::concrete_base_type_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 219 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->concrete_base_type ();
}

CORBA::Long TAO::TypeCodeFactory::Recursive_TypeCode::default_index_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 184 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->default_index ();
}

CORBA::TypeCode_ptr TAO::TypeCodeFactory::Recursive_TypeCode::discriminator_type_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 172 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->discriminator_type ();
}

CORBA::Boolean TAO::TypeCodeFactory::Recursive_TypeCode::equal_i ( CORBA::TypeCode_ptr  tc  )  const [protected, virtual]

Implements CORBA::TypeCode.

Definition at line 65 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      // Nothing to compare yet.

      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->equal (tc);
}

CORBA::Boolean TAO::TypeCodeFactory::Recursive_TypeCode::equivalent_i ( CORBA::TypeCode_ptr  tc  )  const [protected, virtual]

Implements CORBA::TypeCode.

Definition at line 78 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      // Nothing to compare yet.

      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->equivalent (tc);
}

CORBA::TypeCode_ptr TAO::TypeCodeFactory::Recursive_TypeCode::get_compact_typecode_i ( void   )  const [protected, virtual]

Implements CORBA::TypeCode.

Definition at line 92 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      // Nothing to compare yet.

      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->get_compact_typecode ();
}

char const * TAO::TypeCodeFactory::Recursive_TypeCode::id_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 106 of file Recursive_TypeCode.cpp.

{
  // Ownership is retained by the TypeCode, as required by the C++
  // mapping.
  return this->id_.in ();
}

CORBA::ULong TAO::TypeCodeFactory::Recursive_TypeCode::member_count_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 125 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->member_count ();
}

CORBA::Any * TAO::TypeCodeFactory::Recursive_TypeCode::member_label_i ( CORBA::ULong  index  )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 160 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->member_label (index);
}

char const * TAO::TypeCodeFactory::Recursive_TypeCode::member_name_i ( CORBA::ULong  index  )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 136 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->member_name (index);
}

CORBA::TypeCode_ptr TAO::TypeCodeFactory::Recursive_TypeCode::member_type_i ( CORBA::ULong  index  )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 148 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->member_type (index);
}

CORBA::Visibility TAO::TypeCodeFactory::Recursive_TypeCode::member_visibility_i ( CORBA::ULong  index  )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 196 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->member_visibility (index);
}

char const * TAO::TypeCodeFactory::Recursive_TypeCode::name_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 114 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->name ();
}

void TAO::TypeCodeFactory::Recursive_TypeCode::tao_duplicate ( void   )  [virtual]

Increase the reference count on this TypeCode.

Implements CORBA::TypeCode.

Definition at line 53 of file Recursive_TypeCode.cpp.

{
  this->add_ref ();
}

bool TAO::TypeCodeFactory::Recursive_TypeCode::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 20 of file Recursive_TypeCode.cpp.

{

  if (CORBA::is_nil (this->the_typecode_))
    {
      // Marshaling an incomplete recursive TypeCode placeholder is
      // not allowed.

      throw ::CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->tao_marshal (cdr, offset);
}

bool TAO::TypeCodeFactory::Recursive_TypeCode::tao_marshal_kind ( TAO_OutputCDR cdr  )  const [virtual]

Marshal the TypeCode TCKind.

Reimplemented from CORBA::TypeCode.

Definition at line 37 of file Recursive_TypeCode.cpp.

{

  if (CORBA::is_nil (this->the_typecode_))
    {
      // Marshaling an incomplete recursive TypeCode placeholder is
      // not allowed.

      throw ::CORBA::BAD_TYPECODE (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->tao_marshal_kind (cdr);
}

void TAO::TypeCodeFactory::Recursive_TypeCode::tao_release ( void   )  [virtual]

Decrease the reference count on this object.

Implements CORBA::TypeCode.

Definition at line 59 of file Recursive_TypeCode.cpp.

{
  this->remove_ref ();
}

void TAO::TypeCodeFactory::Recursive_TypeCode::the_typecode ( CORBA::TypeCode_ptr  tc  ) 

Set the actual recursive TypeCode to which all TypeCode operations will be forwarded.

Definition at line 17 of file Recursive_TypeCode.inl.

{
  this->the_typecode_ = tc;

  // @@ Lazy, I know.  :(
  CORBA::TCKind & mutable_kind = const_cast<CORBA::TCKind &> (this->kind_);

  mutable_kind = tc->kind ();
}

CORBA::ValueModifier TAO::TypeCodeFactory::Recursive_TypeCode::type_modifier_i ( void   )  const [protected, virtual]

Reimplemented from CORBA::TypeCode.

Definition at line 208 of file Recursive_TypeCode.cpp.

{
  if (CORBA::is_nil (this->the_typecode_))
    {
      throw ::CORBA::BAD_TYPECODE (0, CORBA::COMPLETED_NO);
    }

  return this->the_typecode_->type_modifier ();
}


Member Data Documentation

CORBA::String_var TAO::TypeCodeFactory::Recursive_TypeCode::id_ [private]

Repository ID.

Definition at line 101 of file Recursive_TypeCode.h.

CORBA::TypeCode_ptr TAO::TypeCodeFactory::Recursive_TypeCode::the_typecode_ [private]

The actual recursive TypeCode.

Originally this was a *_var, but that led to a loop of references meaning the type codes would leak. Keeping a *_ptr to the previous occurrence of type type is safe because whenever we dereference it the target object will exist because it contains this one!

Definition at line 110 of file Recursive_TypeCode.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines