CORBA::Any Class Reference

Generic container for IDL types. More...

#include <Any.h>

Collaboration diagram for CORBA::Any:

Collaboration graph
[legend]
List of all members.

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_Implimpl (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

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_Implimpl_

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

typedef Any_out CORBA::Any::_out_type
 

Definition at line 69 of file Any.h.

typedef Any_ptr CORBA::Any::_ptr_type
 

Definition at line 67 of file Any.h.

typedef Any_var CORBA::Any::_var_type
 

Definition at line 68 of file Any.h.

typedef ACE_OutputCDR::from_boolean CORBA::Any::from_boolean
 

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.

Referenced by TAO::TypeCode::Case_Traits< CORBA::Boolean >::any_from(), TAO::Any_Basic_Impl::marshal_value(), and operator<<=().

typedef ACE_OutputCDR::from_char CORBA::Any::from_char
 

Definition at line 89 of file Any.h.

Referenced by TAO::TypeCode::Case_Traits< CORBA::Char >::any_from(), TAO::Any_Basic_Impl::marshal_value(), operator<<=(), and operator<<=().

typedef ACE_OutputCDR::from_octet CORBA::Any::from_octet
 

Definition at line 88 of file Any.h.

Referenced by TAO::Any_Basic_Impl::marshal_value(), TAO::TypeCode::Union< StringType, TypeCodeType, CaseArrayType, RefCountPolicy >::member_label_i(), operator<<=(), and operator<<=().

typedef ACE_OutputCDR::from_string CORBA::Any::from_string
 

Definition at line 91 of file Any.h.

Referenced by operator<<=(), operator<<=(), operator>>=(), and operator>>=().

typedef ACE_OutputCDR::from_wchar CORBA::Any::from_wchar
 

Definition at line 90 of file Any.h.

Referenced by TAO::Any_Basic_Impl::marshal_value(), operator<<=(), and operator<<=().

typedef ACE_OutputCDR::from_wstring CORBA::Any::from_wstring
 

Definition at line 92 of file Any.h.

Referenced by operator<<=(), operator<<=(), operator>>=(), and operator>>=().

typedef ACE_InputCDR::to_boolean CORBA::Any::to_boolean
 

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.

Referenced by TAO::TypeCode::Case_Traits< CORBA::Boolean >::any_to(), TAO_Marshal_Union::append(), TAO::Any_Basic_Impl::demarshal_value(), operator>>=(), operator>>=(), TAO_Marshal_Union::skip(), and TAO::TypeCodeFactory::tc_union_factory().

typedef ACE_InputCDR::to_char CORBA::Any::to_char
 

Definition at line 107 of file Any.h.

Referenced by TAO::TypeCode::Case_Traits< CORBA::Char >::any_to(), TAO_Marshal_Union::append(), TAO::Any_Basic_Impl::demarshal_value(), operator>>=(), operator>>=(), TAO_Marshal_Union::skip(), and TAO::TypeCodeFactory::tc_union_factory().

typedef ACE_InputCDR::to_octet CORBA::Any::to_octet
 

Definition at line 109 of file Any.h.

Referenced by TAO_Marshal_Union::append(), TAO::Any_Basic_Impl::demarshal_value(), operator>>=(), operator>>=(), and TAO_Marshal_Union::skip().

typedef ACE_InputCDR::to_string CORBA::Any::to_string
 

Definition at line 110 of file Any.h.

Referenced by operator<<=(), operator<<=(), operator>>=(), and operator>>=().

typedef ACE_InputCDR::to_wchar CORBA::Any::to_wchar
 

Definition at line 108 of file Any.h.

Referenced by TAO_Marshal_Union::append(), TAO::Any_Basic_Impl::demarshal_value(), operator>>=(), operator>>=(), and TAO_Marshal_Union::skip().

typedef ACE_InputCDR::to_wstring CORBA::Any::to_wstring
 

Definition at line 111 of file Any.h.

Referenced by operator<<=(), operator<<=(), operator>>=(), and operator>>=().


Constructor & Destructor Documentation

CORBA::Any::Any void   ) 
 

Definition at line 31 of file Any.cpp.

00032   : impl_ (0)
00033 {
00034 }

CORBA::Any::Any const Any  ) 
 

Definition at line 36 of file Any.cpp.

References TAO::Any_Impl::_add_ref().

00037   : impl_ (rhs.impl_)
00038 {
00039   if (this->impl_ != 0)
00040     {
00041       this->impl_->_add_ref ();
00042     }
00043 }

CORBA::Any::~Any void   ) 
 

Definition at line 45 of file Any.cpp.

References TAO::Any_Impl::_remove_ref().

00046 {
00047   if (this->impl_ != 0)
00048     {
00049       this->impl_->_remove_ref ();
00050     }
00051 }


Member Function Documentation

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

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

Definition at line 156 of file Any.cpp.

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

int CORBA::Any::_tao_byte_order void   )  const
 

Definition at line 124 of file Any.cpp.

References TAO::Any_Impl::_tao_byte_order(), and TAO_ENCAP_BYTE_ORDER.

00125 {
00126   if (this->impl_ != 0)
00127     {
00128       return this->impl_->_tao_byte_order ();
00129     }
00130 
00131   return TAO_ENCAP_BYTE_ORDER;
00132 }

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.

References TAO::Any_Impl::_tao_get_typecode().

Referenced by TAO::Any_SystemException::extract(), TAO::Any_Special_Impl_T< T, from_T, to_T >::extract(), TAO::Any_Impl_T< T >::extract(), TAO::Any_Dual_Impl_T< T >::extract(), TAO::Any_Basic_Impl_T< T >::extract(), TAO::Any_Basic_Impl::extract(), and TAO::Any_Array_Impl_T< T_slice, T_forany >::extract().

00100 {
00101   if (this->impl_ != 0)
00102     {
00103       return this->impl_->_tao_get_typecode ();
00104     }
00105 
00106   return CORBA::_tc_null;
00107 }

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

TAO extension.

Definition at line 110 of file Any.cpp.

References ACE_NEW, and TAO::Any_Impl::type().

00111 {
00112   if (this->impl_ == 0)
00113     {
00114       ACE_NEW (this->impl_,
00115                TAO::Unknown_IDL_Type (tc));
00116     }
00117   else
00118     {
00119       this->impl_->type (tc);
00120     }
00121 }

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

Definition at line 200 of file Any.cpp.

References TAO::Any_Impl::to_abstract_base().

Referenced by operator>>=().

00201 {
00202   if (this->impl_ == 0)
00203     {
00204       return false;
00205     }
00206 
00207   return this->impl_->to_abstract_base (_tao_elem);
00208 }

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

Definition at line 178 of file Any.cpp.

References TAO::Any_Impl::to_object().

Referenced by operator>>=().

00179 {
00180   if (this->impl_ == 0)
00181     {
00182       return 0;
00183     }
00184 
00185   return this->impl_->to_object (_tao_elem);
00186 }

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

Definition at line 189 of file Any.cpp.

References TAO::Any_Impl::to_value().

Referenced by operator>>=().

00190 {
00191   if (this->impl_ == 0)
00192     {
00193       return false;
00194     }
00195 
00196   return this->impl_->to_value (_tao_elem);
00197 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO::Any_Impl * CORBA::Any::impl void   )  const
 

Definition at line 8 of file Any.inl.

Referenced by TAO::Any_SystemException::extract(), TAO::Any_Special_Impl_T< T, from_T, to_T >::extract(), TAO::Any_Impl_T< T >::extract(), TAO::Any_Dual_Impl_T< T >::extract(), TAO::Any_Basic_Impl_T< T >::extract(), TAO::Any_Basic_Impl::extract(), TAO::Any_Array_Impl_T< T_slice, T_forany >::extract(), and operator<<().

00009 {
00010   return this->impl_;
00011 }

void CORBA::Any::operator<<= unsigned  char  )  [private]
 

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

Definition at line 351 of file Any.cpp.

References ACE_OutputCDR::from_wstring::bound_, from_wstring, ACE_OutputCDR::from_wstring::nocopy_, to_wstring, ACE_OutputCDR::from_wstring::val_, ACE_OS::wslen(), and CORBA::wstring_dup().

00352 {
00353   if (ws.bound_ > 0 && ws.val_ != 0 && ACE_OS::wslen (ws.val_) > ws.bound_)
00354     {
00355       return;
00356     }
00357 
00358   TAO::Any_Special_Impl_T<
00359       CORBA::WChar,
00360       CORBA::Any::from_wstring,
00361       CORBA::Any::to_wstring
00362     >::insert (*this,
00363                TAO::Any_Impl::_tao_any_wstring_destructor,
00364                CORBA::_tc_wstring,
00365                ws.nocopy_ ? ws.val_ : CORBA::wstring_dup (ws.val_),
00366                ws.bound_);
00367 }

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

Definition at line 332 of file Any.cpp.

References ACE_OutputCDR::from_string::bound_, from_string, ACE_OutputCDR::from_string::nocopy_, CORBA::string_dup(), ACE_OS::strlen(), to_string, and ACE_OutputCDR::from_string::val_.

00333 {
00334   if (s.bound_ > 0 && s.val_ != 0 && ACE_OS::strlen (s.val_) > s.bound_)
00335     {
00336       return;
00337     }
00338 
00339   TAO::Any_Special_Impl_T<
00340       char,
00341       CORBA::Any::from_string,
00342       CORBA::Any::to_string
00343     >::insert (*this,
00344                TAO::Any_Impl::_tao_any_string_destructor,
00345                CORBA::_tc_string,
00346                s.nocopy_ ? s.val_ : CORBA::string_dup (s.val_),
00347                s.bound_);
00348 }

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

Definition at line 314 of file Any.cpp.

References from_octet, TAO::Any_Basic_Impl::insert(), and ACE_OutputCDR::from_octet::val_.

00315 {
00316   TAO::Any_Basic_Impl::insert (*this, CORBA::_tc_octet, &o.val_);
00317 }

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

Definition at line 326 of file Any.cpp.

References from_wchar, TAO::Any_Basic_Impl::insert(), and ACE_OutputCDR::from_wchar::val_.

00327 {
00328   TAO::Any_Basic_Impl::insert (*this, CORBA::_tc_wchar, &wc.val_);
00329 }

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

Definition at line 320 of file Any.cpp.

References from_char, TAO::Any_Basic_Impl::insert(), and ACE_OutputCDR::from_char::val_.

00321 {
00322   TAO::Any_Basic_Impl::insert (*this, CORBA::_tc_char, &c.val_);
00323 }

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

Insertion of the special types.

Definition at line 308 of file Any.cpp.

References from_boolean, TAO::Any_Basic_Impl::insert(), and ACE_OutputCDR::from_boolean::val_.

00309 {
00310   TAO::Any_Basic_Impl::insert (*this, CORBA::_tc_boolean, &b.val_);
00311 }

CORBA::Any & CORBA::Any::operator= const Any  ) 
 

Definition at line 54 of file Any.cpp.

References TAO::Any_Impl::_add_ref(), TAO::Any_Impl::_remove_ref(), and impl_.

00055 {
00056   if (this->impl_ != rhs.impl_)
00057     {
00058       if (this->impl_ != 0)
00059         {
00060           this->impl_->_remove_ref ();
00061         }
00062 
00063       this->impl_ = rhs.impl_;
00064 
00065       if (this->impl_ != 0)
00066         {
00067           this->impl_->_add_ref ();
00068         }
00069     }
00070 
00071   return *this;
00072 }

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

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

Definition at line 592 of file Any.cpp.

References checked_to_value(), and CORBA::Any::to_value::ref_.

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

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

Definition at line 586 of file Any.cpp.

References checked_to_abstract_base(), and CORBA::Any::to_abstract_base::ref_.

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

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

Definition at line 580 of file Any.cpp.

References checked_to_object(), and CORBA::Any::to_object::ref_.

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

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

Definition at line 565 of file Any.cpp.

References ACE_InputCDR::to_wstring::bound_, from_wstring, to_wstring, and ACE_InputCDR::to_wstring::val_.

00566 {
00567   return
00568     TAO::Any_Special_Impl_T<
00569         CORBA::WChar,
00570         CORBA::Any::from_wstring,
00571         CORBA::Any::to_wstring
00572       >::extract (*this,
00573                   TAO::Any_Impl::_tao_any_wstring_destructor,
00574                   CORBA::_tc_wstring,
00575                   ws.val_,
00576                   ws.bound_);
00577 }

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

Definition at line 550 of file Any.cpp.

References ACE_InputCDR::to_string::bound_, from_string, to_string, and ACE_InputCDR::to_string::val_.

00551 {
00552   return
00553     TAO::Any_Special_Impl_T<
00554         char,
00555         CORBA::Any::from_string,
00556         CORBA::Any::to_string
00557       >::extract (*this,
00558                   TAO::Any_Impl::_tao_any_string_destructor,
00559                   CORBA::_tc_string,
00560                   s.val_,
00561                   s.bound_);
00562 }

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

Definition at line 544 of file Any.cpp.

References TAO::Any_Basic_Impl::extract(), ACE_InputCDR::to_wchar::ref_, and to_wchar.

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

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

Definition at line 538 of file Any.cpp.

References TAO::Any_Basic_Impl::extract(), ACE_InputCDR::to_char::ref_, and to_char.

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

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

Definition at line 532 of file Any.cpp.

References TAO::Any_Basic_Impl::extract(), ACE_InputCDR::to_octet::ref_, and to_octet.

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

CORBA::Boolean CORBA::Any::operator>>= to_boolean   )  const
 

Extraction of the special types.

Definition at line 526 of file Any.cpp.

References TAO::Any_Basic_Impl::extract(), ACE_InputCDR::to_boolean::ref_, and to_boolean.

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

void CORBA::Any::replace TAO::Any_Impl  ) 
 

TAO-specific signature.

Definition at line 75 of file Any.cpp.

References TAO::Any_Impl::_remove_ref(), and ACE_ASSERT.

Referenced by TAO::Any_SystemException::insert(), TAO::Any_Special_Impl_T< T, from_T, to_T >::insert(), TAO::Any_Impl_T< T >::insert(), TAO::Any_Dual_Impl_T< T >::insert(), TAO::Any_Basic_Impl_T< T >::insert(), TAO::Any_Basic_Impl::insert(), TAO::Any_Array_Impl_T< T_slice, T_forany >::insert(), TAO::Any_SystemException::insert_copy(), TAO::Any_Dual_Impl_T< T >::insert_copy(), TAO::TypeCode::Case_Enum_T< StringType, TypeCodeType >::label(), and operator>>().

00076 {
00077   ACE_ASSERT (new_impl != 0);
00078 
00079   if (this->impl_ != 0)
00080     {
00081       this->impl_->_remove_ref ();
00082     }
00083 
00084   this->impl_ = new_impl;
00085 }

void CORBA::Any::type TypeCode_ptr   ) 
 

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

Definition at line 135 of file Any.cpp.

References TAO::Any_Impl::_tao_get_typecode(), and TAO::Any_Impl::type().

00137 {
00138   CORBA::Boolean equiv = false;
00139 
00140   if (this->impl_ != 0)
00141     {
00142       equiv = this->impl_->_tao_get_typecode ()->equivalent (tc);
00143     }
00144 
00145   if (equiv)
00146     {
00147       this->impl_->type (tc);
00148     }
00149   else
00150     {
00151       throw ::CORBA::BAD_TYPECODE ();
00152     }
00153 }

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.

References CORBA::TypeCode::_duplicate(), and TAO::Any_Impl::type().

00089 {
00090   if (this->impl_ != 0)
00091     {
00092       return this->impl_->type ();
00093     }
00094 
00095   return CORBA::TypeCode::_duplicate (CORBA::_tc_null);
00096 }


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.

Referenced by operator=().


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