Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends

CORBA::Any Class Reference

Generic container for IDL types. More...

#include <Any.h>

List of all members.

Classes

struct  to_abstract_base
struct  to_object
 These are not in ACE. More...
struct  to_value

Public Types

typedef Any_ptr _ptr_type
typedef Any_var _var_type
typedef Any_out _out_type
typedef ACE_OutputCDR::from_boolean from_boolean
typedef ACE_OutputCDR::from_octet from_octet
typedef ACE_OutputCDR::from_char from_char
typedef ACE_OutputCDR::from_wchar from_wchar
typedef ACE_OutputCDR::from_string from_string
typedef ACE_OutputCDR::from_wstring from_wstring
typedef ACE_InputCDR::to_boolean to_boolean
typedef ACE_InputCDR::to_char to_char
typedef ACE_InputCDR::to_wchar to_wchar
typedef ACE_InputCDR::to_octet to_octet
typedef ACE_InputCDR::to_string to_string
typedef ACE_InputCDR::to_wstring to_wstring

Public Member Functions

 Any (void)
 Any (const Any &)
 ~Any (void)
Anyoperator= (const Any &)
TAO::Any_Impl * impl (void) const
void operator<<= (from_boolean)
 Insertion of the special types.
void operator<<= (from_char)
void operator<<= (from_wchar)
void operator<<= (from_octet)
void operator<<= (from_string)
void operator<<= (from_wstring)
Boolean operator>>= (to_boolean) const
 Extraction of the special types.
Boolean operator>>= (to_octet) const
Boolean operator>>= (to_char) const
Boolean operator>>= (to_wchar) const
Boolean operator>>= (to_string) const
Boolean operator>>= (to_wstring) const
Boolean operator>>= (to_object) const
Boolean operator>>= (to_abstract_base) const
Boolean operator>>= (to_value) const
void replace (TAO::Any_Impl *)
 TAO-specific signature.
TypeCode_ptr type (void) const
 Return TypeCode of the element stored in the Any.
void type (TypeCode_ptr)
CORBA::TypeCode_ptr _tao_get_typecode (void) const
 TAO extension, does not return a duplicate.
void _tao_set_typecode (const CORBA::TypeCode_ptr)
 TAO extension.
int _tao_byte_order (void) const

Static Public Member Functions

static void _tao_any_destructor (void *)
 Used in our destruction if we ourselves are stored in an Any.

Private Member Functions

CORBA::Boolean checked_to_object (CORBA::Object_ptr &) const
CORBA::Boolean checked_to_value (CORBA::ValueBase *&) const
CORBA::Boolean checked_to_abstract_base (CORBA::AbstractBase_ptr &) const
void operator<<= (unsigned char)
CORBA::Boolean operator>>= (unsigned char &) const

Private Attributes

TAO::Any_Impl * impl_

Friends

class TAO_Marshal_Any

Detailed Description

Generic container for IDL types.

This is the top-level class of the Any implementation. It exposes the spec-required functionality, but is mostly a wrapper for one of the template classes below.

Definition at line 64 of file Any.h.


Member Typedef Documentation

Definition at line 69 of file Any.h.

Definition at line 67 of file Any.h.

Definition at line 68 of file Any.h.

These are needed for insertion and extraction of booleans, octets, chars, and bounded strings. CORBA spec requires that they be here, we just typedef to the already-defined ACE_OutputCDR types.

Definition at line 87 of file Any.h.

Definition at line 89 of file Any.h.

Definition at line 88 of file Any.h.

Definition at line 91 of file Any.h.

Definition at line 90 of file Any.h.

Definition at line 92 of file Any.h.

These extract octets, chars, booleans, bounded strings, and object references. All these are defined in ACE_InputCDR.

Definition at line 106 of file Any.h.

Definition at line 107 of file Any.h.

Definition at line 109 of file Any.h.

Definition at line 110 of file Any.h.

Definition at line 108 of file Any.h.

Definition at line 111 of file Any.h.


Constructor & Destructor Documentation

CORBA::Any::Any ( void   ) 

Definition at line 31 of file Any.cpp.

  : impl_ (0)
{
}

CORBA::Any::Any ( const Any rhs  ) 

Definition at line 36 of file Any.cpp.

  : impl_ (rhs.impl_)
{
  if (this->impl_ != 0)
    {
      this->impl_->_add_ref ();
    }
}

CORBA::Any::~Any ( void   ) 

Definition at line 45 of file Any.cpp.

{
  if (this->impl_ != 0)
    {
      this->impl_->_remove_ref ();
    }
}


Member Function Documentation

void CORBA::Any::_tao_any_destructor ( void *  x  )  [static]

Used in our destruction if we ourselves are stored in an Any.

Definition at line 156 of file Any.cpp.

{
  CORBA::Any *tmp = static_cast<CORBA::Any *> (x);
  delete tmp;
}

int CORBA::Any::_tao_byte_order ( void   )  const

Definition at line 124 of file Any.cpp.

{
  if (this->impl_ != 0)
    {
      return this->impl_->_tao_byte_order ();
    }

  return TAO_ENCAP_BYTE_ORDER;
}

CORBA::TypeCode_ptr CORBA::Any::_tao_get_typecode ( void   )  const

TAO extension, does not return a duplicate.

Definition at line 99 of file Any.cpp.

{
  if (this->impl_ != 0)
    {
      return this->impl_->_tao_get_typecode ();
    }

  return CORBA::_tc_null;
}

void CORBA::Any::_tao_set_typecode ( const CORBA::TypeCode_ptr  tc  ) 

TAO extension.

Definition at line 110 of file Any.cpp.

{
  if (this->impl_ == 0)
    {
      ACE_NEW (this->impl_,
               TAO::Unknown_IDL_Type (tc));
    }
  else
    {
      this->impl_->type (tc);
    }
}

CORBA::Boolean CORBA::Any::checked_to_abstract_base ( CORBA::AbstractBase_ptr _tao_elem  )  const [private]

Definition at line 200 of file Any.cpp.

{
  if (this->impl_ == 0)
    {
      return false;
    }

  return this->impl_->to_abstract_base (_tao_elem);
}

CORBA::Boolean CORBA::Any::checked_to_object ( CORBA::Object_ptr _tao_elem  )  const [private]

Definition at line 178 of file Any.cpp.

{
  if (this->impl_ == 0)
    {
      return 0;
    }

  return this->impl_->to_object (_tao_elem);
}

CORBA::Boolean CORBA::Any::checked_to_value ( CORBA::ValueBase *&  _tao_elem  )  const [private]

Definition at line 189 of file Any.cpp.

{
  if (this->impl_ == 0)
    {
      return false;
    }

  return this->impl_->to_value (_tao_elem);
}

TAO::Any_Impl * CORBA::Any::impl ( void   )  const

Definition at line 8 of file Any.inl.

{
  return this->impl_;
}

void CORBA::Any::operator<<= ( from_string  s  ) 

Definition at line 332 of file Any.cpp.

{
  if (s.bound_ > 0 && s.val_ != 0 && ACE_OS::strlen (s.val_) > s.bound_)
    {
      return;
    }

  TAO::Any_Special_Impl_T<
      char,
      CORBA::Any::from_string,
      CORBA::Any::to_string
    >::insert (*this,
               TAO::Any_Impl::_tao_any_string_destructor,
               CORBA::_tc_string,
               s.nocopy_ ? s.val_ : CORBA::string_dup (s.val_),
               s.bound_);
}

void CORBA::Any::operator<<= ( from_wstring  ws  ) 

Definition at line 351 of file Any.cpp.

{
  if (ws.bound_ > 0 && ws.val_ != 0 && ACE_OS::wslen (ws.val_) > ws.bound_)
    {
      return;
    }

  TAO::Any_Special_Impl_T<
      CORBA::WChar,
      CORBA::Any::from_wstring,
      CORBA::Any::to_wstring
    >::insert (*this,
               TAO::Any_Impl::_tao_any_wstring_destructor,
               CORBA::_tc_wstring,
               ws.nocopy_ ? ws.val_ : CORBA::wstring_dup (ws.val_),
               ws.bound_);
}

void CORBA::Any::operator<<= ( from_boolean  b  ) 

Insertion of the special types.

Definition at line 308 of file Any.cpp.

void CORBA::Any::operator<<= ( from_char  c  ) 

Definition at line 320 of file Any.cpp.

void CORBA::Any::operator<<= ( from_wchar  wc  ) 

Definition at line 326 of file Any.cpp.

void CORBA::Any::operator<<= ( from_octet  o  ) 

Definition at line 314 of file Any.cpp.

void CORBA::Any::operator<<= ( unsigned  char  )  [private]
CORBA::Any & CORBA::Any::operator= ( const Any rhs  ) 

Definition at line 54 of file Any.cpp.

{
  if (this->impl_ != rhs.impl_)
    {
      if (this->impl_ != 0)
        {
          this->impl_->_remove_ref ();
        }

      this->impl_ = rhs.impl_;

      if (this->impl_ != 0)
        {
          this->impl_->_add_ref ();
        }
    }

  return *this;
}

CORBA::Boolean CORBA::Any::operator>>= ( to_value  obj  )  const

Definition at line 604 of file Any.cpp.

{
  return this->checked_to_value (obj.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_wchar  wc  )  const

Definition at line 556 of file Any.cpp.

{
  return TAO::Any_Basic_Impl::extract (*this, CORBA::_tc_wchar, &wc.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_wstring  ws  )  const

Definition at line 577 of file Any.cpp.

{
  return
    TAO::Any_Special_Impl_T<
        CORBA::WChar,
        CORBA::Any::from_wstring,
        CORBA::Any::to_wstring
      >::extract (*this,
                  TAO::Any_Impl::_tao_any_wstring_destructor,
                  CORBA::_tc_wstring,
                  ws.val_,
                  ws.bound_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_octet  o  )  const

Definition at line 544 of file Any.cpp.

{
  return TAO::Any_Basic_Impl::extract (*this, CORBA::_tc_octet, &o.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_object  obj  )  const

Definition at line 592 of file Any.cpp.

{
  return this->checked_to_object (obj.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( unsigned char &   )  const [private]
CORBA::Boolean CORBA::Any::operator>>= ( to_boolean  b  )  const

Extraction of the special types.

Definition at line 538 of file Any.cpp.

{
  return TAO::Any_Basic_Impl::extract (*this, CORBA::_tc_boolean, &b.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_abstract_base  obj  )  const

Definition at line 598 of file Any.cpp.

{
  return this->checked_to_abstract_base (obj.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_char  c  )  const

Definition at line 550 of file Any.cpp.

{
  return TAO::Any_Basic_Impl::extract (*this, CORBA::_tc_char, &c.ref_);
}

CORBA::Boolean CORBA::Any::operator>>= ( to_string  s  )  const

Definition at line 562 of file Any.cpp.

{
  return
    TAO::Any_Special_Impl_T<
        char,
        CORBA::Any::from_string,
        CORBA::Any::to_string
      >::extract (*this,
                  TAO::Any_Impl::_tao_any_string_destructor,
                  CORBA::_tc_string,
                  s.val_,
                  s.bound_);
}

void CORBA::Any::replace ( TAO::Any_Impl *  new_impl  ) 

TAO-specific signature.

Definition at line 75 of file Any.cpp.

{
  ACE_ASSERT (new_impl != 0);

  if (this->impl_ != 0)
    {
      this->impl_->_remove_ref ();
    }

  this->impl_ = new_impl;
}

void CORBA::Any::type ( CORBA::TypeCode_ptr  tc  ) 

For use along with <<= of a value of aliased type when the alias must be preserved.

Definition at line 135 of file Any.cpp.

{
  CORBA::Boolean equiv = false;

  if (this->impl_ != 0)
    {
      equiv = this->impl_->_tao_get_typecode ()->equivalent (tc);
    }

  if (equiv)
    {
      this->impl_->type (tc);
    }
  else
    {
      throw ::CORBA::BAD_TYPECODE ();
    }
}

CORBA::TypeCode_ptr CORBA::Any::type ( void   )  const

Return TypeCode of the element stored in the Any.

Definition at line 88 of file Any.cpp.

{
  if (this->impl_ != 0)
    {
      return this->impl_->type ();
    }

  return CORBA::TypeCode::_duplicate (CORBA::_tc_null);
}


Friends And Related Function Documentation

friend class TAO_Marshal_Any [friend]

Definition at line 177 of file Any.h.


Member Data Documentation

TAO::Any_Impl* CORBA::Any::impl_ [private]

Definition at line 175 of file Any.h.


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