TAO_DynCommon Class Reference

#include <DynCommon.h>

Inheritance diagram for TAO_DynCommon:

Inheritance graph
[legend]
Collaboration diagram for TAO_DynCommon:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_DynCommon (void)
 Constructor.

virtual ~TAO_DynCommon (void)
 Destructor.

virtual CORBA::TypeCode_ptr type (void)
virtual void assign (DynamicAny::DynAny_ptr dyn_any)
virtual void insert_boolean (CORBA::Boolean value)
virtual void insert_octet (CORBA::Octet value)
virtual void insert_char (CORBA::Char value)
virtual void insert_short (CORBA::Short value)
virtual void insert_ushort (CORBA::UShort value)
virtual void insert_long (CORBA::Long value)
virtual void insert_ulong (CORBA::ULong value)
virtual void insert_float (CORBA::Float value)
virtual void insert_double (CORBA::Double value)
virtual void insert_string (const char *value)
virtual void insert_reference (CORBA::Object_ptr value)
virtual void insert_typecode (CORBA::TypeCode_ptr value)
virtual void insert_longlong (CORBA::LongLong value)
virtual void insert_ulonglong (CORBA::ULongLong value)
virtual void insert_longdouble (CORBA::LongDouble value)
virtual void insert_wchar (CORBA::WChar value)
virtual void insert_wstring (const CORBA::WChar *value)
virtual void insert_any (const CORBA::Any &value)
virtual void insert_dyn_any (DynamicAny::DynAny_ptr value)
virtual void insert_val (CORBA::ValueBase *value)
virtual CORBA::Boolean get_boolean (void)
virtual CORBA::Octet get_octet (void)
virtual CORBA::Char get_char (void)
virtual CORBA::Short get_short (void)
virtual CORBA::UShort get_ushort (void)
virtual CORBA::Long get_long (void)
virtual CORBA::ULong get_ulong (void)
virtual CORBA::Float get_float (void)
virtual CORBA::Double get_double (void)
virtual char * get_string (void)
virtual CORBA::Object_ptr get_reference (void)
virtual CORBA::TypeCode_ptr get_typecode (void)
virtual CORBA::LongLong get_longlong (void)
virtual CORBA::ULongLong get_ulonglong (void)
virtual CORBA::LongDouble get_longdouble (void)
virtual CORBA::WChar get_wchar (void)
virtual CORBA::WCharget_wstring (void)
virtual CORBA::Any * get_any (void)
virtual DynamicAny::DynAny_ptr get_dyn_any (void)
virtual CORBA::ValueBase * get_val (void)
virtual CORBA::Boolean seek (CORBA::Long index)
virtual void rewind (void)
virtual CORBA::Boolean next (void)
virtual DynamicAny::DynAny_ptr copy (void)
virtual CORBA::ULong component_count (void)
virtual void insert_abstract (CORBA::AbstractBase_ptr value)
virtual CORBA::AbstractBase_ptr get_abstract (void)
virtual void insert_boolean_seq (const CORBA::BooleanSeq &value)
virtual void insert_octet_seq (const CORBA::OctetSeq &value)
virtual void insert_char_seq (const CORBA::CharSeq &value)
virtual void insert_short_seq (const CORBA::ShortSeq &value)
virtual void insert_ushort_seq (const CORBA::UShortSeq &value)
virtual void insert_long_seq (const CORBA::LongSeq &value)
virtual void insert_ulong_seq (const CORBA::ULongSeq &value)
virtual void insert_float_seq (const CORBA::FloatSeq &value)
virtual void insert_double_seq (const CORBA::DoubleSeq &value)
virtual void insert_longlong_seq (const CORBA::LongLongSeq &value)
virtual void insert_ulonglong_seq (const CORBA::ULongLongSeq &value)
virtual void insert_longdouble_seq (const CORBA::LongDoubleSeq &value)
virtual void insert_wchar_seq (const CORBA::WCharSeq &value)
virtual CORBA::BooleanSeqget_boolean_seq (void)
virtual CORBA::OctetSeqget_octet_seq (void)
virtual CORBA::CharSeqget_char_seq (void)
virtual CORBA::ShortSeqget_short_seq (void)
virtual CORBA::UShortSeqget_ushort_seq (void)
virtual CORBA::LongSeqget_long_seq (void)
virtual CORBA::ULongSeqget_ulong_seq (void)
virtual CORBA::FloatSeqget_float_seq (void)
virtual CORBA::DoubleSeqget_double_seq (void)
virtual CORBA::LongLongSeqget_longlong_seq (void)
virtual CORBA::ULongLongSeqget_ulonglong_seq (void)
virtual CORBA::LongDoubleSeqget_longdouble_seq (void)
virtual CORBA::WCharSeqget_wchar_seq (void)
void set_flag (DynamicAny::DynAny_ptr component, CORBA::Boolean destroying)
DynamicAny::DynAny_ptr check_component (void)
void check_type (CORBA::TypeCode_ptr tc)
CORBA::Boolean has_components (void) const
CORBA::Boolean destroyed (void) const
CORBA::Any & the_any (void)
void container_is_destroying (CORBA::Boolean val)
void ref_to_component (CORBA::Boolean val)

Static Public Member Functions

bool is_basic_type_seq (CORBA::TypeCode_ptr tc)

Protected Attributes

CORBA::Boolean ref_to_component_
 Were we created by current_component()?

CORBA::Boolean container_is_destroying_
 Flag to let destroy() call by container override the flag above.

CORBA::Boolean has_components_
 Do we contain other Dynamic Anys?

CORBA::Boolean destroyed_
 Has destroy() been called on us yet?

CORBA::Long current_position_
 Slot of the current component (if any).

CORBA::ULong component_count_
 Number of components, as defined by CORBA 2.4.2.

CORBA::TypeCode_var type_
 Holder for our type code.

CORBA::Any any_

Private Member Functions

CORBA::TypeCode_ptr check_type_and_unalias (CORBA::TypeCode_ptr tc)

Detailed Description

Contains most of the functionality common to all the Dynamic Any implementation classes.

Definition at line 32 of file DynCommon.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_DynCommon::TAO_DynCommon void   ) 
 

Constructor.

Definition at line 28 of file DynCommon.cpp.

00029 {
00030 }

TAO_DynCommon::~TAO_DynCommon void   )  [virtual]
 

Destructor.

Definition at line 32 of file DynCommon.cpp.

00033 {
00034 }


Member Function Documentation

void TAO_DynCommon::assign DynamicAny::DynAny_ptr  dyn_any  )  [virtual]
 

Definition at line 48 of file DynCommon.cpp.

References destroyed_, and DynamicAny::DynAny::from_any().

00049 {
00050   if (this->destroyed_)
00051     {
00052       throw ::CORBA::OBJECT_NOT_EXIST ();
00053     }
00054 
00055   CORBA::TypeCode_var tc = dyn_any->type ();
00056 
00057   CORBA::Boolean const equivalent = this->type_.in ()->equivalent (tc.in ());
00058 
00059   if (equivalent)
00060     {
00061       CORBA::Any_var any = dyn_any->to_any ();
00062 
00063       this->from_any (any.in ());
00064     }
00065   else
00066     {
00067       throw DynamicAny::DynAny::TypeMismatch ();
00068     }
00069 }

DynamicAny::DynAny_ptr TAO_DynCommon::check_component void   ) 
 

Definition at line 1183 of file DynCommon.cpp.

References DynamicAny::DynAny::current_component(), current_position_, is_basic_type_seq(), and TAO_DynAnyFactory::unalias().

Referenced by get_abstract(), get_any(), get_reference(), get_string(), get_typecode(), get_val(), TAO::DynAnyBasicTypeUtils< T >::get_value(), get_wchar(), get_wstring(), insert_abstract(), insert_reference(), insert_string(), insert_val(), TAO::DynAnyBasicTypeUtils< T >::insert_value(), and insert_wstring().

01184 {
01185   if (this->current_position_ == -1)
01186     {
01187       throw DynamicAny::DynAny::InvalidValue ();
01188     }
01189 
01190   DynamicAny::DynAny_var cc =
01191     this->current_component ();
01192 
01193   CORBA::TypeCode_var tc = cc->type ();
01194 
01195   CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ());
01196 
01197   // We are here because we are a component that is the target of
01198   // an insert_*() call on our container. It is
01199   // illegal to insert anything into a component that itself has
01200   // components.
01201   switch (kind)
01202   {
01203     case CORBA::tk_array:
01204     case CORBA::tk_except:
01205     case CORBA::tk_struct:
01206     case CORBA::tk_union:
01207       throw DynamicAny::DynAny::TypeMismatch ();
01208     case CORBA::tk_sequence:
01209       if (TAO_DynCommon::is_basic_type_seq (tc.in ()))
01210         {
01211           return cc._retn ();
01212         }
01213       else
01214         {
01215           throw DynamicAny::DynAny::TypeMismatch ();
01216         }
01217     default:
01218       return cc._retn ();
01219   }
01220 }

void TAO_DynCommon::check_type CORBA::TypeCode_ptr  tc  ) 
 

Definition at line 1223 of file DynCommon.cpp.

Referenced by check_type_and_unalias(), and TAO::DynAnyBasicTypeUtils< T >::insert_value().

01224 {
01225   CORBA::Boolean const equivalent =
01226     this->type_->equivalent (tc);
01227 
01228   if (!equivalent)
01229     {
01230       throw DynamicAny::DynAny::TypeMismatch ();
01231     }
01232 }

CORBA::TypeCode_ptr TAO_DynCommon::check_type_and_unalias CORBA::TypeCode_ptr  tc  )  [private]
 

Definition at line 1283 of file DynCommon.cpp.

References check_type(), and TAO_DynAnyFactory::strip_alias().

Referenced by get_wstring(), and insert_wstring().

01284 {
01285   this->check_type (tc);
01286 
01287   return TAO_DynAnyFactory::strip_alias (tc);
01288 }

CORBA::ULong TAO_DynCommon::component_count void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 809 of file DynCommon.cpp.

References component_count_, and destroyed_.

00810 {
00811   if (this->destroyed_)
00812     {
00813       throw ::CORBA::OBJECT_NOT_EXIST ();
00814     }
00815 
00816   return this->component_count_;
00817 }

void TAO_DynCommon::container_is_destroying CORBA::Boolean  val  ) 
 

Definition at line 1271 of file DynCommon.cpp.

References container_is_destroying_.

01272 {
01273   this->container_is_destroying_ = val;
01274 }

DynamicAny::DynAny_ptr TAO_DynCommon::copy void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 791 of file DynCommon.cpp.

References destroyed_, and DynamicAny::DynAny::to_any().

00792 {
00793   if (this->destroyed_)
00794     {
00795       throw ::CORBA::OBJECT_NOT_EXIST ();
00796     }
00797 
00798   CORBA::Any_var any = this->to_any ();
00799 
00800   DynamicAny::DynAny_ptr retval =
00801     TAO::MakeDynAnyUtils::make_dyn_any_t<const CORBA::Any&> (
00802       any.in ()._tao_get_typecode (),
00803       any.in ());
00804 
00805   return retval;
00806 }

CORBA::Boolean TAO_DynCommon::destroyed void   )  const
 

Definition at line 1259 of file DynCommon.cpp.

References destroyed_.

Referenced by TAO::DynAnyBasicTypeUtils< T >::get_value(), and TAO::DynAnyBasicTypeUtils< T >::insert_value().

01260 {
01261   return this->destroyed_;
01262 }

CORBA::AbstractBase_ptr TAO_DynCommon::get_abstract void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 895 of file DynCommon.cpp.

References any_, check_component(), destroyed_, has_components_, and TAO_DynAnyFactory::unalias().

00896 {
00897   if (this->destroyed_)
00898     {
00899       throw ::CORBA::OBJECT_NOT_EXIST ();
00900     }
00901 
00902   if (this->has_components_)
00903     {
00904       DynamicAny::DynAny_var cc =
00905         this->check_component ();
00906 
00907       return cc->get_abstract ();
00908     }
00909   else
00910     {
00911       CORBA::TCKind kind =
00912         TAO_DynAnyFactory::unalias (this->type_.in ());
00913 
00914       if (kind != CORBA::tk_abstract_interface)
00915         {
00916           throw DynamicAny::DynAny::TypeMismatch ();
00917         }
00918 
00919       CORBA::AbstractBase_var retval;
00920       TAO::Any_Impl *any_impl = this->any_.impl ();
00921 
00922       if (any_impl == 0)
00923         {
00924           throw DynamicAny::DynAny::InvalidValue ();
00925         }
00926 
00927       // This should always be non-zero for dynamic anys.
00928       TAO::Unknown_IDL_Type *unk =
00929         dynamic_cast<TAO::Unknown_IDL_Type *> (any_impl);
00930 
00931       // Make a copy to extract from so we retain ownership of contents.
00932       TAO_InputCDR for_reading (unk->_tao_get_cdr ());
00933 
00934       // The CDR extraction operator for AbstractBase handles
00935       // all cases.
00936       if (!(for_reading >> retval.inout ()))
00937         {
00938           throw DynamicAny::DynAny::InvalidValue ();
00939         }
00940 
00941       return retval._retn ();
00942     }
00943 }

CORBA::Any_ptr TAO_DynCommon::get_any void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 625 of file DynCommon.cpp.

References ACE_NEW_RETURN, any_, check_component(), destroyed_, and has_components_.

Referenced by get_dyn_any().

00626 {
00627   if (this->destroyed_)
00628     {
00629       throw ::CORBA::OBJECT_NOT_EXIST ();
00630     }
00631 
00632   if (this->has_components_)
00633     {
00634       DynamicAny::DynAny_var cc =
00635         this->check_component ();
00636 
00637       return cc->get_any ();
00638     }
00639   else
00640     {
00641       const CORBA::Any *tmp = 0;
00642 
00643       if ((this->any_ >>= tmp) == 0)
00644         {
00645           throw DynamicAny::DynAny::TypeMismatch ();
00646         }
00647 
00648       CORBA::Any *retval = 0;
00649       ACE_NEW_RETURN (retval,
00650                       CORBA::Any (*tmp),
00651                       0);
00652       return retval;
00653     }
00654 }

CORBA::Boolean TAO_DynCommon::get_boolean void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 393 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00394 {
00395   return TAO::DynAnyBasicTypeUtils<CORBA::Boolean>::get_value (this);
00396 }

CORBA::BooleanSeq * TAO_DynCommon::get_boolean_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1028 of file DynCommon.cpp.

References CORBA::BooleanSeq, and TAO::DynAnyBasicTypeUtils< T >::get_value().

01029 {
01030   CORBA::BooleanSeq *owned =
01031     TAO::DynAnyBasicTypeUtils<CORBA::BooleanSeq>::get_value (this);
01032   return new CORBA::BooleanSeq (*owned);
01033 }

CORBA::Char TAO_DynCommon::get_char void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 405 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00406 {
00407   return TAO::DynAnyBasicTypeUtils<CORBA::Char>::get_value (this);
00408 }

CORBA::CharSeq * TAO_DynCommon::get_char_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1044 of file DynCommon.cpp.

References CORBA::CharSeq, and TAO::DynAnyBasicTypeUtils< T >::get_value().

01045 {
01046   CORBA::CharSeq *owned =
01047     TAO::DynAnyBasicTypeUtils<CORBA::CharSeq>::get_value (this);
01048   return new CORBA::CharSeq (*owned);
01049 }

CORBA::Double TAO_DynCommon::get_double void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 441 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00442 {
00443   return TAO::DynAnyBasicTypeUtils<CORBA::Double>::get_value (this);
00444 }

CORBA::DoubleSeq * TAO_DynCommon::get_double_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1092 of file DynCommon.cpp.

References CORBA::DoubleSeq, and TAO::DynAnyBasicTypeUtils< T >::get_value().

01093 {
01094   CORBA::DoubleSeq *owned =
01095     TAO::DynAnyBasicTypeUtils<CORBA::DoubleSeq>::get_value (this);
01096   return new CORBA::DoubleSeq (*owned);
01097 }

DynamicAny::DynAny_ptr TAO_DynCommon::get_dyn_any void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 659 of file DynCommon.cpp.

References destroyed_, and get_any().

00660 {
00661   if (this->destroyed_)
00662     {
00663       throw ::CORBA::OBJECT_NOT_EXIST ();
00664     }
00665 
00666   CORBA::Any_var any = this->get_any ();
00667 
00668   return
00669     TAO::MakeDynAnyUtils::make_dyn_any_t<const CORBA::Any&> (
00670       any.in ()._tao_get_typecode (),
00671       any.in ());
00672 }

CORBA::Float TAO_DynCommon::get_float void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 435 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00436 {
00437   return TAO::DynAnyBasicTypeUtils<CORBA::Float>::get_value (this);
00438 }

CORBA::FloatSeq * TAO_DynCommon::get_float_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1084 of file DynCommon.cpp.

References CORBA::FloatSeq, and TAO::DynAnyBasicTypeUtils< T >::get_value().

01085 {
01086   CORBA::FloatSeq *owned =
01087     TAO::DynAnyBasicTypeUtils<CORBA::FloatSeq>::get_value (this);
01088   return new CORBA::FloatSeq (*owned);
01089 }

CORBA::Long TAO_DynCommon::get_long void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 423 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00424 {
00425   return TAO::DynAnyBasicTypeUtils<CORBA::Long>::get_value (this);
00426 }

CORBA::LongSeq * TAO_DynCommon::get_long_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1068 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::LongSeq.

01069 {
01070   CORBA::LongSeq *owned =
01071     TAO::DynAnyBasicTypeUtils<CORBA::LongSeq>::get_value (this);
01072   return new CORBA::LongSeq (*owned);
01073 }

CORBA::LongDouble TAO_DynCommon::get_longdouble void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 558 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00559 {
00560   return TAO::DynAnyBasicTypeUtils<CORBA::LongDouble>::get_value (this);
00561 }

CORBA::LongDoubleSeq * TAO_DynCommon::get_longdouble_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1116 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::LongDoubleSeq.

01117 {
01118   CORBA::LongDoubleSeq *owned =
01119     TAO::DynAnyBasicTypeUtils<CORBA::LongDoubleSeq>::get_value (this);
01120   return new CORBA::LongDoubleSeq (*owned);
01121 }

CORBA::LongLong TAO_DynCommon::get_longlong void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 546 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00547 {
00548   return TAO::DynAnyBasicTypeUtils<CORBA::LongLong>::get_value (this);
00549 }

CORBA::LongLongSeq * TAO_DynCommon::get_longlong_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1100 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::LongLongSeq.

01101 {
01102   CORBA::LongLongSeq *owned =
01103     TAO::DynAnyBasicTypeUtils<CORBA::LongLongSeq>::get_value (this);
01104   return new CORBA::LongLongSeq (*owned);
01105 }

CORBA::Octet TAO_DynCommon::get_octet void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 399 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00400 {
00401   return TAO::DynAnyBasicTypeUtils<CORBA::Octet>::get_value (this);
00402 }

CORBA::OctetSeq * TAO_DynCommon::get_octet_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1036 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::OctetSeq.

01037 {
01038   CORBA::OctetSeq *owned =
01039     TAO::DynAnyBasicTypeUtils<CORBA::OctetSeq>::get_value (this);
01040   return new CORBA::OctetSeq (*owned);
01041 }

CORBA::Object_ptr TAO_DynCommon::get_reference void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 491 of file DynCommon.cpp.

References any_, check_component(), destroyed_, and has_components_.

00492 {
00493   if (this->destroyed_)
00494     {
00495       throw ::CORBA::OBJECT_NOT_EXIST ();
00496     }
00497 
00498   if (this->has_components_)
00499     {
00500       DynamicAny::DynAny_var cc =
00501         this->check_component ();
00502 
00503       return cc->get_reference ();
00504     }
00505   else
00506     {
00507       CORBA::Object_var retval;
00508 
00509       if ((this->any_ >>= CORBA::Any::to_object (retval.inout ())) == 0)
00510         {
00511           throw DynamicAny::DynAny::TypeMismatch ();
00512         }
00513 
00514       return retval._retn ();
00515     }
00516 }

CORBA::Short TAO_DynCommon::get_short void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 411 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00412 {
00413   return TAO::DynAnyBasicTypeUtils<CORBA::Short>::get_value (this);
00414 }

CORBA::ShortSeq * TAO_DynCommon::get_short_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1052 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::ShortSeq.

01053 {
01054   CORBA::ShortSeq *owned =
01055     TAO::DynAnyBasicTypeUtils<CORBA::ShortSeq>::get_value (this);
01056   return new CORBA::ShortSeq (*owned);
01057 }

char * TAO_DynCommon::get_string void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 447 of file DynCommon.cpp.

References any_, check_component(), destroyed_, has_components_, CORBA::string_dup(), and TAO_DynAnyFactory::strip_alias().

00448 {
00449   if (this->destroyed_)
00450     {
00451       throw ::CORBA::OBJECT_NOT_EXIST ();
00452     }
00453 
00454   if (this->has_components_)
00455     {
00456       DynamicAny::DynAny_var cc =
00457         this->check_component ();
00458 
00459       return cc->get_string ();
00460     }
00461   else
00462     {
00463       CORBA::TypeCode_var unaliased_tc =
00464         TAO_DynAnyFactory::strip_alias (this->type_.in ());
00465 
00466       CORBA::TCKind kind =
00467         unaliased_tc->kind ();
00468 
00469       if (kind != CORBA::tk_string)
00470         {
00471           throw DynamicAny::DynAny::TypeMismatch ();
00472         }
00473 
00474       char *retval = 0;
00475 
00476       CORBA::ULong const bound =
00477         unaliased_tc->length ();
00478 
00479       // We will have caught a type mismatch above, so if this fails,
00480       // it must be for some other reason.
00481       if ((this->any_ >>= CORBA::Any::to_string (retval, bound)) == 0)
00482         {
00483           throw DynamicAny::DynAny::InvalidValue ();
00484         }
00485 
00486       return CORBA::string_dup (retval);
00487     }
00488 }

CORBA::TypeCode_ptr TAO_DynCommon::get_typecode void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 519 of file DynCommon.cpp.

References any_, check_component(), destroyed_, and has_components_.

00520 {
00521   if (this->destroyed_)
00522     {
00523       throw ::CORBA::OBJECT_NOT_EXIST ();
00524     }
00525 
00526   if (this->has_components_)
00527     {
00528       DynamicAny::DynAny_var cc = this->check_component ();
00529 
00530       return cc->get_typecode ();
00531     }
00532   else
00533     {
00534       CORBA::TypeCode_ptr retval;
00535 
00536       if ((this->any_ >>= retval) == 0)
00537         {
00538           throw DynamicAny::DynAny::TypeMismatch ();
00539         }
00540 
00541       return CORBA::TypeCode::_duplicate (retval);
00542     }
00543 }

CORBA::ULong TAO_DynCommon::get_ulong void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 429 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00430 {
00431   return TAO::DynAnyBasicTypeUtils<CORBA::ULong>::get_value (this);
00432 }

CORBA::ULongSeq * TAO_DynCommon::get_ulong_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1076 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::ULongSeq.

01077 {
01078   CORBA::ULongSeq *owned =
01079     TAO::DynAnyBasicTypeUtils<CORBA::ULongSeq>::get_value (this);
01080   return new CORBA::ULongSeq (*owned);
01081 }

CORBA::ULongLong TAO_DynCommon::get_ulonglong void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 552 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00553 {
00554   return TAO::DynAnyBasicTypeUtils<CORBA::ULongLong>::get_value (this);
00555 }

CORBA::ULongLongSeq * TAO_DynCommon::get_ulonglong_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1108 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::ULongLongSeq.

01109 {
01110   CORBA::ULongLongSeq *owned =
01111     TAO::DynAnyBasicTypeUtils<CORBA::ULongLongSeq>::get_value (this);
01112   return new CORBA::ULongLongSeq (*owned);
01113 }

CORBA::UShort TAO_DynCommon::get_ushort void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 417 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value().

00418 {
00419   return TAO::DynAnyBasicTypeUtils<CORBA::UShort>::get_value (this);
00420 }

CORBA::UShortSeq * TAO_DynCommon::get_ushort_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1060 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::UShortSeq.

01061 {
01062   CORBA::UShortSeq *owned =
01063     TAO::DynAnyBasicTypeUtils<CORBA::UShortSeq>::get_value (this);
01064   return new CORBA::UShortSeq (*owned);
01065 }

CORBA::ValueBase * TAO_DynCommon::get_val void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 675 of file DynCommon.cpp.

References any_, check_component(), destroyed_, has_components_, and TAO_DynAnyFactory::unalias().

00676 {
00677   if (this->destroyed_)
00678     {
00679       throw ::CORBA::OBJECT_NOT_EXIST ();
00680     }
00681 
00682   if (this->has_components_)
00683     {
00684       DynamicAny::DynAny_var cc =
00685         this->check_component ();
00686 
00687       return cc->get_val ();
00688     }
00689   else
00690     {
00691       CORBA::TCKind kind =
00692         TAO_DynAnyFactory::unalias (this->type_.in ());
00693 
00694       if (kind != CORBA::tk_value)
00695         {
00696           throw DynamicAny::DynAny::TypeMismatch ();
00697         }
00698 
00699       CORBA::ValueBase_var retval;
00700       TAO::Any_Impl *any_impl = this->any_.impl ();
00701 
00702       if (any_impl == 0)
00703         {
00704           throw DynamicAny::DynAny::InvalidValue ();
00705         }
00706 
00707       // This should always be non-zero for dynamic anys.
00708       TAO::Unknown_IDL_Type *unk =
00709         dynamic_cast<TAO::Unknown_IDL_Type *> (any_impl);
00710 
00711       // Demarshal from a copy so we can retain ownership of our contents.
00712       TAO_InputCDR for_reading (unk->_tao_get_cdr ());
00713 
00714       CORBA::Boolean good_extract =
00715         CORBA::ValueBase::_tao_unmarshal (for_reading,
00716                                           retval.inout ());
00717 
00718       if (!good_extract)
00719         {
00720           throw DynamicAny::DynAny::InvalidValue ();
00721         }
00722 
00723       return retval._retn ();
00724     }
00725 }

CORBA::WChar TAO_DynCommon::get_wchar void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 564 of file DynCommon.cpp.

References any_, check_component(), destroyed_, and has_components_.

00565 {
00566   if (this->destroyed_)
00567     {
00568       throw ::CORBA::OBJECT_NOT_EXIST ();
00569     }
00570 
00571   if (this->has_components_)
00572     {
00573       DynamicAny::DynAny_var cc = this->check_component ();
00574 
00575       return cc->get_wchar ();
00576     }
00577   else
00578     {
00579       CORBA::WChar retval;
00580 
00581       if ((this->any_ >>= CORBA::Any::to_wchar (retval)) == 0)
00582         {
00583           throw DynamicAny::DynAny::TypeMismatch ();
00584         }
00585 
00586       return retval;
00587     }
00588 }

CORBA::WCharSeq * TAO_DynCommon::get_wchar_seq void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 1124 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::get_value(), and CORBA::WCharSeq.

01125 {
01126   CORBA::WCharSeq *owned =
01127     TAO::DynAnyBasicTypeUtils<CORBA::WCharSeq>::get_value (this);
01128   return new CORBA::WCharSeq (*owned);
01129 }

CORBA::WChar * TAO_DynCommon::get_wstring void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 591 of file DynCommon.cpp.

References any_, check_component(), check_type_and_unalias(), destroyed_, has_components_, and CORBA::wstring_dup().

00592 {
00593   if (this->destroyed_)
00594     {
00595       throw ::CORBA::OBJECT_NOT_EXIST ();
00596     }
00597 
00598   if (this->has_components_)
00599     {
00600       DynamicAny::DynAny_var cc =
00601         this->check_component ();
00602 
00603       return cc->get_wstring ();
00604     }
00605   else
00606     {
00607       // @@@ (JP) Someday try to find a way to avoid checking for
00608       // type code equivalence twice without risking a throw of
00609       // BadKind.
00610       CORBA::TypeCode_var unaliased_tc =
00611         this->check_type_and_unalias (CORBA::_tc_wstring);
00612 
00613       CORBA::WChar *retval = 0;
00614 
00615       CORBA::ULong bound =
00616         unaliased_tc->length ();
00617 
00618       (void) (this->any_ >>= CORBA::Any::to_wstring (retval, bound));
00619 
00620       return CORBA::wstring_dup (retval);
00621     }
00622 }

CORBA::Boolean TAO_DynCommon::has_components void   )  const
 

Definition at line 1253 of file DynCommon.cpp.

References has_components_.

Referenced by TAO::DynAnyBasicTypeUtils< T >::get_value(), and TAO::DynAnyBasicTypeUtils< T >::insert_value().

01254 {
01255   return this->has_components_;
01256 }

void TAO_DynCommon::insert_abstract CORBA::AbstractBase_ptr  value  )  [virtual]
 

Definition at line 822 of file DynCommon.cpp.

References ACE_NEW, any_, check_component(), destroyed_, has_components_, CORBA::is_nil(), ACE_OS::strcmp(), and TAO_DynAnyFactory::unalias().

00823 {
00824   if (this->destroyed_)
00825     {
00826       throw ::CORBA::OBJECT_NOT_EXIST ();
00827     }
00828 
00829   if (this->has_components_)
00830     {
00831       DynamicAny::DynAny_var cc =
00832         this->check_component ();
00833 
00834       cc->insert_abstract (value);
00835     }
00836   else
00837     {
00838       CORBA::Boolean good_type = true;
00839       CORBA::TCKind kind =
00840         TAO_DynAnyFactory::unalias (this->type_.in ());
00841 
00842       if (kind != CORBA::tk_abstract_interface)
00843         {
00844           good_type = false;
00845         }
00846       else if (!CORBA::is_nil (value))
00847         {
00848           const char *value_id = value->_interface_repository_id ();
00849           int cmp =
00850             ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/AbstractBase:1.0");
00851 
00852           if (cmp != 0)
00853             {
00854               const char *my_id =
00855                 this->type_->id ();
00856 
00857               if (ACE_OS::strcmp (value_id, my_id) != 0)
00858                 {
00859                   // If 'value' is an objref, this will be a virtual
00860                   // call. If not, it will just compare to the repo id
00861                   // above, which we already know won't match. We see
00862                   // in insert_val() (see comment there) that there
00863                   // is no way to check for derived valuetypes w/o
00864                   // type knowledge at compile time.
00865                   good_type = value->_is_a (my_id);
00866                 }
00867             }
00868         }
00869 
00870       if (good_type)
00871         {
00872           TAO_OutputCDR out;
00873 
00874           // The CDR insertion operator for AbstractBase handles
00875           // all cases - nil, objref and valuetype - polymorphically.
00876           if (!(out << value))
00877             {
00878               throw DynamicAny::DynAny::InvalidValue ();
00879             }
00880 
00881           TAO_InputCDR in (out);
00882           TAO::Unknown_IDL_Type *unk = 0;
00883           ACE_NEW (unk,
00884                    TAO::Unknown_IDL_Type (this->type_.in (), in));
00885           this->any_.replace (unk);
00886         }
00887       else
00888         {
00889           throw DynamicAny::DynAny::TypeMismatch ();
00890         }
00891     }
00892 }

void TAO_DynCommon::insert_any const CORBA::Any &  value  )  [virtual]
 

Definition at line 305 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

Referenced by insert_dyn_any().

00306 {
00307   TAO::DynAnyBasicTypeUtils<CORBA::Any>::insert_value (value,
00308                                                        this);
00309 }

void TAO_DynCommon::insert_boolean CORBA::Boolean  value  )  [virtual]
 

Definition at line 72 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00073 {
00074   TAO::DynAnyBasicTypeUtils<CORBA::Boolean>::insert_value (value, this);
00075 }

void TAO_DynCommon::insert_boolean_seq const CORBA::BooleanSeq value  )  [virtual]
 

Definition at line 948 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

void TAO_DynCommon::insert_char CORBA::Char  value  )  [virtual]
 

Definition at line 84 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00085 {
00086   TAO::DynAnyBasicTypeUtils<CORBA::Char>::insert_value (value, this);
00087 }

void TAO_DynCommon::insert_char_seq const CORBA::CharSeq value  )  [virtual]
 

Definition at line 960 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00961 {
00962   TAO::DynAnyBasicTypeUtils<CORBA::CharSeq>::insert_value (value, this);
00963 }

void TAO_DynCommon::insert_double CORBA::Double  value  )  [virtual]
 

Definition at line 120 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00121 {
00122   TAO::DynAnyBasicTypeUtils<CORBA::Double>::insert_value (value, this);
00123 }

void TAO_DynCommon::insert_double_seq const CORBA::DoubleSeq value  )  [virtual]
 

Definition at line 996 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00997 {
00998   TAO::DynAnyBasicTypeUtils<CORBA::DoubleSeq>::insert_value (value, this);
00999 }

void TAO_DynCommon::insert_dyn_any DynamicAny::DynAny_ptr  value  )  [virtual]
 

Definition at line 314 of file DynCommon.cpp.

References destroyed_, and insert_any().

00315 {
00316   if (this->destroyed_)
00317     {
00318       throw ::CORBA::OBJECT_NOT_EXIST ();
00319     }
00320 
00321   CORBA::Any_var any = value->to_any ();
00322 
00323   this->insert_any (any.in ());
00324 }

void TAO_DynCommon::insert_float CORBA::Float  value  )  [virtual]
 

Definition at line 114 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00115 {
00116   TAO::DynAnyBasicTypeUtils<CORBA::Float>::insert_value (value, this);
00117 }

void TAO_DynCommon::insert_float_seq const CORBA::FloatSeq value  )  [virtual]
 

Definition at line 990 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00991 {
00992   TAO::DynAnyBasicTypeUtils<CORBA::FloatSeq>::insert_value (value, this);
00993 }

void TAO_DynCommon::insert_long CORBA::Long  value  )  [virtual]
 

Definition at line 102 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00103 {
00104   TAO::DynAnyBasicTypeUtils<CORBA::Long>::insert_value (value, this);
00105 }

void TAO_DynCommon::insert_long_seq const CORBA::LongSeq value  )  [virtual]
 

Definition at line 978 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00979 {
00980   TAO::DynAnyBasicTypeUtils<CORBA::LongSeq>::insert_value (value, this);
00981 }

void TAO_DynCommon::insert_longdouble CORBA::LongDouble  value  )  [virtual]
 

Definition at line 259 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00260 {
00261   TAO::DynAnyBasicTypeUtils<CORBA::LongDouble>::insert_value (value,
00262                                                               this);
00263 }

void TAO_DynCommon::insert_longdouble_seq const CORBA::LongDoubleSeq value  )  [virtual]
 

Definition at line 1014 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

void TAO_DynCommon::insert_longlong CORBA::LongLong  value  )  [virtual]
 

Definition at line 247 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00248 {
00249   TAO::DynAnyBasicTypeUtils<CORBA::LongLong>::insert_value (value, this);
00250 }

void TAO_DynCommon::insert_longlong_seq const CORBA::LongLongSeq value  )  [virtual]
 

Definition at line 1002 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

void TAO_DynCommon::insert_octet CORBA::Octet  value  )  [virtual]
 

Definition at line 78 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00079 {
00080   TAO::DynAnyBasicTypeUtils<CORBA::Octet>::insert_value (value, this);
00081 }

void TAO_DynCommon::insert_octet_seq const CORBA::OctetSeq value  )  [virtual]
 

Definition at line 954 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00955 {
00956   TAO::DynAnyBasicTypeUtils<CORBA::OctetSeq>::insert_value (value, this);
00957 }

void TAO_DynCommon::insert_reference CORBA::Object_ptr  value  )  [virtual]
 

Definition at line 167 of file DynCommon.cpp.

References ACE_NEW, any_, check_component(), destroyed_, has_components_, CORBA::is_nil(), ACE_OS::strcmp(), TAO_DynAnyFactory::unalias(), ACE_OutputCDR::write_char(), and ACE_OutputCDR::write_ulong().

00168 {
00169   if (this->destroyed_)
00170     {
00171       throw ::CORBA::OBJECT_NOT_EXIST ();
00172     }
00173 
00174   if (this->has_components_)
00175     {
00176       DynamicAny::DynAny_var cc =
00177         this->check_component ();
00178 
00179       cc->insert_reference (value);
00180     }
00181   else
00182     {
00183       CORBA::Boolean good_type = true;
00184       CORBA::TCKind const kind =
00185         TAO_DynAnyFactory::unalias (this->type_.in ());
00186 
00187       if (kind != CORBA::tk_objref)
00188         {
00189           good_type = false;
00190         }
00191       else if (!CORBA::is_nil (value))
00192         {
00193           const char *value_id = value->_interface_repository_id ();
00194 
00195           if (ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/Object:1.0") != 0)
00196             {
00197               const char *my_id =
00198                 this->type_->id ();
00199 
00200               if (ACE_OS::strcmp (value_id, my_id) != 0)
00201                 {
00202                   good_type = value->_is_a (my_id);
00203                 }
00204             }
00205         }
00206 
00207       if (good_type)
00208         {
00209           TAO_OutputCDR cdr;
00210 
00211           if (CORBA::is_nil (value))
00212             {
00213               // Empty type hint, no profile.
00214               cdr.write_ulong (1);
00215               cdr.write_char ('\0');
00216               cdr.write_ulong (0);
00217             }
00218           else
00219             {
00220               if (!value->marshal (cdr))
00221                 {
00222                   throw DynamicAny::DynAny::InvalidValue ();
00223                 }
00224             }
00225 
00226           TAO_InputCDR in (cdr);
00227           TAO::Unknown_IDL_Type *unk = 0;
00228           ACE_NEW (unk,
00229                    TAO::Unknown_IDL_Type (this->type_.in (),
00230                                           in));
00231           this->any_.replace (unk);
00232         }
00233       else
00234         {
00235           throw DynamicAny::DynAny::TypeMismatch ();
00236         }
00237     }
00238 }

void TAO_DynCommon::insert_short CORBA::Short  value  )  [virtual]
 

Definition at line 90 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00091 {
00092   TAO::DynAnyBasicTypeUtils<CORBA::Short>::insert_value (value, this);
00093 }

void TAO_DynCommon::insert_short_seq const CORBA::ShortSeq value  )  [virtual]
 

Definition at line 966 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00967 {
00968   TAO::DynAnyBasicTypeUtils<CORBA::ShortSeq>::insert_value (value, this);
00969 }

void TAO_DynCommon::insert_string const char *  value  )  [virtual]
 

Definition at line 126 of file DynCommon.cpp.

References check_component(), destroyed_, has_components_, TAO_DynAnyFactory::strip_alias(), and ACE_OS::strlen().

00127 {
00128   if (this->destroyed_)
00129     {
00130       throw ::CORBA::OBJECT_NOT_EXIST ();
00131     }
00132 
00133   if (this->has_components_)
00134     {
00135       DynamicAny::DynAny_var cc =
00136         this->check_component ();
00137 
00138       cc->insert_string (value);
00139     }
00140   else
00141     {
00142       CORBA::TypeCode_var unaliased_tc =
00143         TAO_DynAnyFactory::strip_alias (this->type_.in ());
00144 
00145       CORBA::TCKind const kind =
00146         unaliased_tc->kind ();
00147 
00148       if (kind != CORBA::tk_string)
00149         {
00150           throw DynamicAny::DynAny::TypeMismatch ();
00151         }
00152 
00153       CORBA::ULong const bound =
00154         unaliased_tc->length ();
00155 
00156       if (bound > 0 && bound < ACE_OS::strlen (value))
00157         {
00158           throw DynamicAny::DynAny::InvalidValue ();
00159         }
00160 
00161       this->any_ <<= CORBA::Any::from_string (const_cast<char *> (value),
00162                                               bound);
00163     }
00164 }

void TAO_DynCommon::insert_typecode CORBA::TypeCode_ptr  value  )  [virtual]
 

Definition at line 241 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

void TAO_DynCommon::insert_ulong CORBA::ULong  value  )  [virtual]
 

Definition at line 108 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00109 {
00110   TAO::DynAnyBasicTypeUtils<CORBA::ULong>::insert_value (value, this);
00111 }

void TAO_DynCommon::insert_ulong_seq const CORBA::ULongSeq value  )  [virtual]
 

Definition at line 984 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00985 {
00986   TAO::DynAnyBasicTypeUtils<CORBA::ULongSeq>::insert_value (value, this);
00987 }

void TAO_DynCommon::insert_ulonglong CORBA::ULongLong  value  )  [virtual]
 

Definition at line 253 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00254 {
00255   TAO::DynAnyBasicTypeUtils<CORBA::ULongLong>::insert_value (value, this);
00256 }

void TAO_DynCommon::insert_ulonglong_seq const CORBA::ULongLongSeq value  )  [virtual]
 

Definition at line 1008 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

void TAO_DynCommon::insert_ushort CORBA::UShort  value  )  [virtual]
 

Definition at line 96 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00097 {
00098   TAO::DynAnyBasicTypeUtils<CORBA::UShort>::insert_value (value, this);
00099 }

void TAO_DynCommon::insert_ushort_seq const CORBA::UShortSeq value  )  [virtual]
 

Definition at line 972 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00973 {
00974   TAO::DynAnyBasicTypeUtils<CORBA::UShortSeq>::insert_value (value, this);
00975 }

void TAO_DynCommon::insert_val CORBA::ValueBase *  value  )  [virtual]
 

Definition at line 327 of file DynCommon.cpp.

References ACE_NEW, any_, check_component(), destroyed_, has_components_, ACE_OS::strcmp(), and TAO_DynAnyFactory::unalias().

00328 {
00329   if (this->destroyed_)
00330     {
00331       throw ::CORBA::OBJECT_NOT_EXIST ();
00332     }
00333 
00334   if (this->has_components_)
00335     {
00336       DynamicAny::DynAny_var cc =
00337         this->check_component ();
00338 
00339       cc->insert_val (value);
00340     }
00341   else
00342     {
00343       CORBA::TCKind kind =
00344         TAO_DynAnyFactory::unalias (this->type_.in ());
00345 
00346       if (kind != CORBA::tk_value)
00347         {
00348           throw DynamicAny::DynAny::TypeMismatch ();
00349         }
00350 
00351       // If the arg is 0 we can't do this kind of type checking,
00352       // and the call to _tao_marshal() below will handle the
00353       // null value correctly.
00354       if (value != 0)
00355         {
00356           const char *value_id = value->_tao_obv_repository_id ();
00357           const char *my_id =
00358             this->type_->id ();
00359 
00360           // Valuetypes, unlike interfaces, don't have a virtual
00361           // method to check for a more derived type when the
00362           // repo ids don't match. Valuetypes have only
00363           // a static _downcast() method, which can't be used
00364           // here, so if the repo ids don't match, we're hosed.
00365           if (ACE_OS::strcmp (value_id, my_id) != 0)
00366             {
00367               throw DynamicAny::DynAny::TypeMismatch ();
00368             }
00369         }
00370 
00371       // This will handle null values correctly, or otherwise
00372       // make a virtual call to marshal the state.
00373       TAO_OutputCDR out;
00374       CORBA::Boolean const good_insert =
00375         CORBA::ValueBase::_tao_marshal (out, value);
00376 
00377       if (!good_insert)
00378         {
00379           throw DynamicAny::DynAny::InvalidValue ();
00380         }
00381 
00382       TAO_InputCDR in (out);
00383       TAO::Unknown_IDL_Type *unk = 0;
00384       ACE_NEW (unk,
00385                TAO::Unknown_IDL_Type (this->type_.in (), in));
00386       this->any_.replace (unk);
00387     }
00388 }

void TAO_DynCommon::insert_wchar CORBA::WChar  value  )  [virtual]
 

Definition at line 266 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

00267 {
00268   TAO::DynAnyBasicTypeUtils<CORBA::WChar>::insert_value (value,
00269                                                          this);
00270 }

void TAO_DynCommon::insert_wchar_seq const CORBA::WCharSeq value  )  [virtual]
 

Definition at line 1020 of file DynCommon.cpp.

References TAO::DynAnyBasicTypeUtils< T >::insert_value().

01021 {
01022   TAO::DynAnyBasicTypeUtils<CORBA::WCharSeq>::insert_value (value, this);
01023 }

void TAO_DynCommon::insert_wstring const CORBA::WChar value  )  [virtual]
 

Definition at line 273 of file DynCommon.cpp.

References check_component(), check_type_and_unalias(), destroyed_, has_components_, and ACE_OS::wslen().

00274 {
00275   if (this->destroyed_)
00276     {
00277       throw ::CORBA::OBJECT_NOT_EXIST ();
00278     }
00279 
00280   if (this->has_components_)
00281     {
00282       DynamicAny::DynAny_var cc =
00283         this->check_component ();
00284 
00285       cc->insert_wstring (value);
00286     }
00287   else
00288     {
00289       CORBA::TypeCode_var unaliased_tc =
00290         this->check_type_and_unalias (CORBA::_tc_wstring);
00291 
00292       CORBA::ULong const bound = unaliased_tc->length ();
00293 
00294       if (bound > 0 && bound < ACE_OS::wslen (value))
00295         {
00296           throw DynamicAny::DynAny::InvalidValue ();
00297         }
00298 
00299       this->any_ <<= CORBA::Any::from_wstring (const_cast<CORBA::WChar *> (value),
00300                                                bound);
00301     }
00302 }

bool TAO_DynCommon::is_basic_type_seq CORBA::TypeCode_ptr  tc  )  [static]
 

Definition at line 1235 of file DynCommon.cpp.

Referenced by check_component(), TAO::MakeDynAnyUtils::make_dyn_any_t(), and set_flag().

01236 {
01237   return (tc == CORBA::_tc_BooleanSeq
01238           || tc == CORBA::_tc_OctetSeq
01239           || tc == CORBA::_tc_CharSeq
01240           || tc == CORBA::_tc_WCharSeq
01241           || tc == CORBA::_tc_ShortSeq
01242           || tc == CORBA::_tc_UShortSeq
01243           || tc == CORBA::_tc_LongSeq
01244           || tc == CORBA::_tc_ULongSeq
01245           || tc == CORBA::_tc_LongLongSeq
01246           || tc == CORBA::_tc_ULongLongSeq
01247           || tc == CORBA::_tc_FloatSeq
01248           || tc == CORBA::_tc_DoubleSeq
01249           || tc == CORBA::_tc_LongDoubleSeq);
01250 }

CORBA::Boolean TAO_DynCommon::next void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 768 of file DynCommon.cpp.

References component_count_, current_position_, destroyed_, and has_components_.

00769 {
00770   if (this->destroyed_)
00771     {
00772       throw ::CORBA::OBJECT_NOT_EXIST ();
00773     }
00774 
00775   CORBA::Long component_count = static_cast<CORBA::Long> (this->component_count_);
00776 
00777   if (this->has_components_ == 0
00778       || this->current_position_ + 1 >= component_count)
00779     {
00780       this->current_position_ = -1;
00781       return false;
00782     }
00783   else
00784     {
00785       ++this->current_position_;
00786       return true;
00787     }
00788 }

void TAO_DynCommon::ref_to_component CORBA::Boolean  val  ) 
 

Definition at line 1277 of file DynCommon.cpp.

References ref_to_component_.

01278 {
01279   this->ref_to_component_ = val;
01280 }

void TAO_DynCommon::rewind void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 757 of file DynCommon.cpp.

References destroyed_, and seek().

00758 {
00759   if (this->destroyed_)
00760     {
00761       throw ::CORBA::OBJECT_NOT_EXIST ();
00762     }
00763 
00764   (void) this->seek (0);
00765 }

CORBA::Boolean TAO_DynCommon::seek CORBA::Long  index  )  [virtual]
 

Definition at line 730 of file DynCommon.cpp.

References component_count_, current_position_, destroyed_, and has_components_.

Referenced by rewind().

00732 {
00733   if (this->destroyed_)
00734     {
00735       throw ::CORBA::OBJECT_NOT_EXIST ();
00736     }
00737 
00738   if (this->has_components_ == 0)
00739     {
00740       ACE_UNUSED_ARG (slot);
00741       this->current_position_ = -1;
00742       return false;
00743     }
00744   else if (slot < 0 || slot >= static_cast<CORBA::Long> (this->component_count_))
00745     {
00746       this->current_position_ = -1;
00747       return false;
00748     }
00749   else
00750     {
00751       this->current_position_ = slot;
00752       return true;
00753     }
00754 }

void TAO_DynCommon::set_flag DynamicAny::DynAny_ptr  component,
CORBA::Boolean  destroying
 

This sets one of two flags in this base class. CORBA 2.4.2 requires that destroy() do nothing if it is called on the result of current_component(), the only non-deep-copying method in the Dynamic Any API. If the boolean arg below is 0, the call is from inside current_component(), and the flag ref_to_component_ is set. If the boolean arg is 1, the call is from inside destroy(), and the container_is_destroying_ flag is set, overriding the first flag in the component's destroy() method.

Definition at line 1134 of file DynCommon.cpp.

References is_basic_type_seq(), TAO::DynAnyFlagUtils< T >::set_flag_t(), and TAO_DynAnyFactory::unalias().

Referenced by TAO_DynUnion_i::current_component(), TAO_DynStruct_i::current_component(), TAO_DynSequence_i::current_component(), TAO_DynArray_i::current_component(), TAO_DynUnion_i::destroy(), TAO_DynStruct_i::destroy(), TAO_DynSequence_i::destroy(), TAO_DynArray_i::destroy(), TAO_DynUnion_i::get_discriminator(), TAO_DynSequence_i::get_elements_as_dyn_any(), TAO_DynArray_i::get_elements_as_dyn_any(), TAO_DynStruct_i::get_members_as_dyn_any(), and TAO_DynUnion_i::member().

01136 {
01137   CORBA::TypeCode_var tc = component->type ();
01138 
01139   CORBA::TCKind tk = TAO_DynAnyFactory::unalias (tc.in ());
01140 
01141   switch (tk)
01142   {
01143     case CORBA::tk_array:
01144       TAO::DynAnyFlagUtils<TAO_DynArray_i>::set_flag_t (component,
01145                                                         destroying);
01146       break;
01147     case CORBA::tk_enum:
01148       TAO::DynAnyFlagUtils<TAO_DynEnum_i>::set_flag_t (component,
01149                                                        destroying);
01150       break;
01151     case CORBA::tk_sequence:
01152       if (TAO_DynCommon::is_basic_type_seq (tc.in ()))
01153         {
01154           TAO::DynAnyFlagUtils<TAO_DynAny_i>::set_flag_t (component,
01155                                                           destroying);
01156         }
01157       else
01158         {
01159           TAO::DynAnyFlagUtils<TAO_DynSequence_i>::set_flag_t (component,
01160                                                                destroying);
01161         }
01162       break;
01163     case CORBA::tk_struct:
01164       TAO::DynAnyFlagUtils<TAO_DynStruct_i>::set_flag_t (component,
01165                                                          destroying);
01166       break;
01167     case CORBA::tk_union:
01168       TAO::DynAnyFlagUtils<TAO_DynUnion_i>::set_flag_t (component,
01169                                                         destroying);
01170       break;
01171     case CORBA::tk_fixed:
01172     case CORBA::tk_value:
01173     case CORBA::tk_value_box:
01174       throw ::CORBA::NO_IMPLEMENT ();
01175     default:
01176       TAO::DynAnyFlagUtils<TAO_DynAny_i>::set_flag_t (component,
01177                                                       destroying);
01178       break;
01179   }
01180 }

CORBA::Any & TAO_DynCommon::the_any void   ) 
 

Definition at line 1265 of file DynCommon.cpp.

References any_.

Referenced by TAO::DynAnyBasicTypeUtils< T >::get_value(), and TAO::DynAnyBasicTypeUtils< T >::insert_value().

01266 {
01267   return this->any_;
01268 }

CORBA::TypeCode_ptr TAO_DynCommon::type void   )  [virtual]
 

Implements DynamicAny::DynAny.

Definition at line 37 of file DynCommon.cpp.

References destroyed_.

00038 {
00039   if (this->destroyed_)
00040     {
00041       throw ::CORBA::OBJECT_NOT_EXIST ();
00042     }
00043 
00044   return CORBA::TypeCode::_duplicate (this->type_.in ());
00045 }


Member Data Documentation

CORBA::Any TAO_DynCommon::any_ [protected]
 

Gets a value only for basic types, but used in insert_* and get_*, defined in this base class.

Definition at line 246 of file DynCommon.h.

Referenced by TAO_DynAny_i::equal(), get_abstract(), get_any(), get_reference(), get_string(), get_typecode(), get_val(), get_wchar(), get_wstring(), insert_abstract(), insert_reference(), insert_val(), and the_any().

CORBA::ULong TAO_DynCommon::component_count_ [protected]
 

Number of components, as defined by CORBA 2.4.2.

Definition at line 239 of file DynCommon.h.

Referenced by component_count(), next(), and seek().

CORBA::Boolean TAO_DynCommon::container_is_destroying_ [protected]
 

Flag to let destroy() call by container override the flag above.

Definition at line 227 of file DynCommon.h.

Referenced by container_is_destroying().

CORBA::Long TAO_DynCommon::current_position_ [protected]
 

Slot of the current component (if any).

Definition at line 236 of file DynCommon.h.

Referenced by check_component(), next(), and seek().

CORBA::Boolean TAO_DynCommon::destroyed_ [protected]
 

Has destroy() been called on us yet?

Definition at line 233 of file DynCommon.h.

Referenced by assign(), component_count(), copy(), destroyed(), get_abstract(), get_any(), get_dyn_any(), get_reference(), get_string(), get_typecode(), get_val(), get_wchar(), get_wstring(), insert_abstract(), insert_dyn_any(), insert_reference(), insert_string(), insert_val(), insert_wstring(), next(), rewind(), seek(), and type().

CORBA::Boolean TAO_DynCommon::has_components_ [protected]
 

Do we contain other Dynamic Anys?

Definition at line 230 of file DynCommon.h.

Referenced by get_abstract(), get_any(), get_reference(), get_string(), get_typecode(), get_val(), get_wchar(), get_wstring(), has_components(), insert_abstract(), insert_reference(), insert_string(), insert_val(), insert_wstring(), next(), and seek().

CORBA::Boolean TAO_DynCommon::ref_to_component_ [protected]
 

Were we created by current_component()?

Definition at line 224 of file DynCommon.h.

Referenced by ref_to_component().

CORBA::TypeCode_var TAO_DynCommon::type_ [protected]
 

Holder for our type code.

Definition at line 242 of file DynCommon.h.

Referenced by TAO_DynUnion_i::equal(), and TAO_DynAny_i::equal().


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