#include <DynCommon.h>
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::WChar * | get_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::BooleanSeq * | get_boolean_seq (void) |
virtual CORBA::OctetSeq * | get_octet_seq (void) |
virtual CORBA::CharSeq * | get_char_seq (void) |
virtual CORBA::ShortSeq * | get_short_seq (void) |
virtual CORBA::UShortSeq * | get_ushort_seq (void) |
virtual CORBA::LongSeq * | get_long_seq (void) |
virtual CORBA::ULongSeq * | get_ulong_seq (void) |
virtual CORBA::FloatSeq * | get_float_seq (void) |
virtual CORBA::DoubleSeq * | get_double_seq (void) |
virtual CORBA::LongLongSeq * | get_longlong_seq (void) |
virtual CORBA::ULongLongSeq * | get_ulonglong_seq (void) |
virtual CORBA::LongDoubleSeq * | get_longdouble_seq (void) |
virtual CORBA::WCharSeq * | get_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 | |
static 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) |
Contains most of the functionality common to all the Dynamic Any implementation classes.
Definition at line 32 of file DynCommon.h.
TAO_DynCommon::TAO_DynCommon | ( | void | ) |
TAO_DynCommon::~TAO_DynCommon | ( | void | ) | [virtual] |
void TAO_DynCommon::assign | ( | DynamicAny::DynAny_ptr | dyn_any | ) | [virtual] |
Definition at line 48 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::TypeCode_var tc = dyn_any->type (); CORBA::Boolean const equivalent = this->type_.in ()->equivalent (tc.in ()); if (equivalent) { CORBA::Any_var any = dyn_any->to_any (); this->from_any (any.in ()); } else { throw DynamicAny::DynAny::TypeMismatch (); } }
DynamicAny::DynAny_ptr TAO_DynCommon::check_component | ( | void | ) |
Definition at line 1183 of file DynCommon.cpp.
{ if (this->current_position_ == -1) { throw DynamicAny::DynAny::InvalidValue (); } DynamicAny::DynAny_var cc = this->current_component (); CORBA::TypeCode_var tc = cc->type (); CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()); // We are here because we are a component that is the target of // an insert_*() call on our container. It is // illegal to insert anything into a component that itself has // components. switch (kind) { case CORBA::tk_array: case CORBA::tk_except: case CORBA::tk_struct: case CORBA::tk_union: throw DynamicAny::DynAny::TypeMismatch (); case CORBA::tk_sequence: if (TAO_DynCommon::is_basic_type_seq (tc.in ())) { return cc._retn (); } else { throw DynamicAny::DynAny::TypeMismatch (); } default: return cc._retn (); } }
void TAO_DynCommon::check_type | ( | CORBA::TypeCode_ptr | tc | ) |
Definition at line 1223 of file DynCommon.cpp.
{ CORBA::Boolean const equivalent = this->type_->equivalent (tc); if (!equivalent) { throw DynamicAny::DynAny::TypeMismatch (); } }
CORBA::TypeCode_ptr TAO_DynCommon::check_type_and_unalias | ( | CORBA::TypeCode_ptr | tc | ) | [private] |
Definition at line 1283 of file DynCommon.cpp.
{ this->check_type (tc); return TAO_DynAnyFactory::strip_alias (tc); }
CORBA::ULong TAO_DynCommon::component_count | ( | void | ) | [virtual] |
Definition at line 809 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } return this->component_count_; }
void TAO_DynCommon::container_is_destroying | ( | CORBA::Boolean | val | ) |
Definition at line 1271 of file DynCommon.cpp.
{ this->container_is_destroying_ = val; }
DynamicAny::DynAny_ptr TAO_DynCommon::copy | ( | void | ) | [virtual] |
Definition at line 791 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::Any_var any = this->to_any (); DynamicAny::DynAny_ptr retval = TAO::MakeDynAnyUtils::make_dyn_any_t<const CORBA::Any&> ( any.in ()._tao_get_typecode (), any.in ()); return retval; }
CORBA::Boolean TAO_DynCommon::destroyed | ( | void | ) | const |
Definition at line 1259 of file DynCommon.cpp.
{ return this->destroyed_; }
CORBA::AbstractBase_ptr TAO_DynCommon::get_abstract | ( | void | ) | [virtual] |
Definition at line 895 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_abstract (); } else { CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in ()); if (kind != CORBA::tk_abstract_interface) { throw DynamicAny::DynAny::TypeMismatch (); } CORBA::AbstractBase_var retval; TAO::Any_Impl *any_impl = this->any_.impl (); if (any_impl == 0) { throw DynamicAny::DynAny::InvalidValue (); } // This should always be non-zero for dynamic anys. TAO::Unknown_IDL_Type *unk = dynamic_cast<TAO::Unknown_IDL_Type *> (any_impl); // Make a copy to extract from so we retain ownership of contents. TAO_InputCDR for_reading (unk->_tao_get_cdr ()); // The CDR extraction operator for AbstractBase handles // all cases. if (!(for_reading >> retval.inout ())) { throw DynamicAny::DynAny::InvalidValue (); } return retval._retn (); } }
CORBA::Any_ptr TAO_DynCommon::get_any | ( | void | ) | [virtual] |
Definition at line 625 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_any (); } else { const CORBA::Any *tmp = 0; if ((this->any_ >>= tmp) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } CORBA::Any *retval = 0; ACE_NEW_RETURN (retval, CORBA::Any (*tmp), 0); return retval; } }
CORBA::Boolean TAO_DynCommon::get_boolean | ( | void | ) | [virtual] |
Definition at line 393 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Boolean>::get_value (this); }
CORBA::BooleanSeq * TAO_DynCommon::get_boolean_seq | ( | void | ) | [virtual] |
Definition at line 1028 of file DynCommon.cpp.
{ CORBA::BooleanSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::BooleanSeq>::get_value (this); return new CORBA::BooleanSeq (*owned); }
CORBA::Char TAO_DynCommon::get_char | ( | void | ) | [virtual] |
Definition at line 405 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Char>::get_value (this); }
CORBA::CharSeq * TAO_DynCommon::get_char_seq | ( | void | ) | [virtual] |
Definition at line 1044 of file DynCommon.cpp.
{ CORBA::CharSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::CharSeq>::get_value (this); return new CORBA::CharSeq (*owned); }
CORBA::Double TAO_DynCommon::get_double | ( | void | ) | [virtual] |
Definition at line 441 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Double>::get_value (this); }
CORBA::DoubleSeq * TAO_DynCommon::get_double_seq | ( | void | ) | [virtual] |
Definition at line 1092 of file DynCommon.cpp.
{ CORBA::DoubleSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::DoubleSeq>::get_value (this); return new CORBA::DoubleSeq (*owned); }
DynamicAny::DynAny_ptr TAO_DynCommon::get_dyn_any | ( | void | ) | [virtual] |
Definition at line 659 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::Any_var any = this->get_any (); return TAO::MakeDynAnyUtils::make_dyn_any_t<const CORBA::Any&> ( any.in ()._tao_get_typecode (), any.in ()); }
CORBA::Float TAO_DynCommon::get_float | ( | void | ) | [virtual] |
Definition at line 435 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Float>::get_value (this); }
CORBA::FloatSeq * TAO_DynCommon::get_float_seq | ( | void | ) | [virtual] |
Definition at line 1084 of file DynCommon.cpp.
{ CORBA::FloatSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::FloatSeq>::get_value (this); return new CORBA::FloatSeq (*owned); }
CORBA::Long TAO_DynCommon::get_long | ( | void | ) | [virtual] |
Definition at line 423 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Long>::get_value (this); }
CORBA::LongSeq * TAO_DynCommon::get_long_seq | ( | void | ) | [virtual] |
Definition at line 1068 of file DynCommon.cpp.
{ CORBA::LongSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::LongSeq>::get_value (this); return new CORBA::LongSeq (*owned); }
CORBA::LongDouble TAO_DynCommon::get_longdouble | ( | void | ) | [virtual] |
Definition at line 558 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::LongDouble>::get_value (this); }
CORBA::LongDoubleSeq * TAO_DynCommon::get_longdouble_seq | ( | void | ) | [virtual] |
Definition at line 1116 of file DynCommon.cpp.
{ CORBA::LongDoubleSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::LongDoubleSeq>::get_value (this); return new CORBA::LongDoubleSeq (*owned); }
CORBA::LongLong TAO_DynCommon::get_longlong | ( | void | ) | [virtual] |
Definition at line 546 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::LongLong>::get_value (this); }
CORBA::LongLongSeq * TAO_DynCommon::get_longlong_seq | ( | void | ) | [virtual] |
Definition at line 1100 of file DynCommon.cpp.
{ CORBA::LongLongSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::LongLongSeq>::get_value (this); return new CORBA::LongLongSeq (*owned); }
CORBA::Octet TAO_DynCommon::get_octet | ( | void | ) | [virtual] |
Definition at line 399 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Octet>::get_value (this); }
CORBA::OctetSeq * TAO_DynCommon::get_octet_seq | ( | void | ) | [virtual] |
Definition at line 1036 of file DynCommon.cpp.
{ CORBA::OctetSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::OctetSeq>::get_value (this); return new CORBA::OctetSeq (*owned); }
CORBA::Object_ptr TAO_DynCommon::get_reference | ( | void | ) | [virtual] |
Definition at line 491 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_reference (); } else { CORBA::Object_var retval; if ((this->any_ >>= CORBA::Any::to_object (retval.inout ())) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } return retval._retn (); } }
CORBA::Short TAO_DynCommon::get_short | ( | void | ) | [virtual] |
Definition at line 411 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::Short>::get_value (this); }
CORBA::ShortSeq * TAO_DynCommon::get_short_seq | ( | void | ) | [virtual] |
Definition at line 1052 of file DynCommon.cpp.
{ CORBA::ShortSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::ShortSeq>::get_value (this); return new CORBA::ShortSeq (*owned); }
char * TAO_DynCommon::get_string | ( | void | ) | [virtual] |
Definition at line 447 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_string (); } else { CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); CORBA::TCKind kind = unaliased_tc->kind (); if (kind != CORBA::tk_string) { throw DynamicAny::DynAny::TypeMismatch (); } char *retval = 0; CORBA::ULong const bound = unaliased_tc->length (); // We will have caught a type mismatch above, so if this fails, // it must be for some other reason. if ((this->any_ >>= CORBA::Any::to_string (retval, bound)) == 0) { throw DynamicAny::DynAny::InvalidValue (); } return CORBA::string_dup (retval); } }
CORBA::TypeCode_ptr TAO_DynCommon::get_typecode | ( | void | ) | [virtual] |
Definition at line 519 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_typecode (); } else { CORBA::TypeCode_ptr retval; if ((this->any_ >>= retval) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } return CORBA::TypeCode::_duplicate (retval); } }
CORBA::ULong TAO_DynCommon::get_ulong | ( | void | ) | [virtual] |
Definition at line 429 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::ULong>::get_value (this); }
CORBA::ULongSeq * TAO_DynCommon::get_ulong_seq | ( | void | ) | [virtual] |
Definition at line 1076 of file DynCommon.cpp.
{ CORBA::ULongSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::ULongSeq>::get_value (this); return new CORBA::ULongSeq (*owned); }
CORBA::ULongLong TAO_DynCommon::get_ulonglong | ( | void | ) | [virtual] |
Definition at line 552 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::ULongLong>::get_value (this); }
CORBA::ULongLongSeq * TAO_DynCommon::get_ulonglong_seq | ( | void | ) | [virtual] |
Definition at line 1108 of file DynCommon.cpp.
{ CORBA::ULongLongSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::ULongLongSeq>::get_value (this); return new CORBA::ULongLongSeq (*owned); }
CORBA::UShort TAO_DynCommon::get_ushort | ( | void | ) | [virtual] |
Definition at line 417 of file DynCommon.cpp.
{ return TAO::DynAnyBasicTypeUtils<CORBA::UShort>::get_value (this); }
CORBA::UShortSeq * TAO_DynCommon::get_ushort_seq | ( | void | ) | [virtual] |
Definition at line 1060 of file DynCommon.cpp.
{ CORBA::UShortSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::UShortSeq>::get_value (this); return new CORBA::UShortSeq (*owned); }
CORBA::ValueBase * TAO_DynCommon::get_val | ( | void | ) | [virtual] |
Definition at line 675 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_val (); } else { CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in ()); if (kind != CORBA::tk_value) { throw DynamicAny::DynAny::TypeMismatch (); } CORBA::ValueBase_var retval; TAO::Any_Impl *any_impl = this->any_.impl (); if (any_impl == 0) { throw DynamicAny::DynAny::InvalidValue (); } // This should always be non-zero for dynamic anys. TAO::Unknown_IDL_Type *unk = dynamic_cast<TAO::Unknown_IDL_Type *> (any_impl); // Demarshal from a copy so we can retain ownership of our contents. TAO_InputCDR for_reading (unk->_tao_get_cdr ()); CORBA::Boolean good_extract = CORBA::ValueBase::_tao_unmarshal (for_reading, retval.inout ()); if (!good_extract) { throw DynamicAny::DynAny::InvalidValue (); } return retval._retn (); } }
CORBA::WChar TAO_DynCommon::get_wchar | ( | void | ) | [virtual] |
Definition at line 564 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_wchar (); } else { CORBA::WChar retval; if ((this->any_ >>= CORBA::Any::to_wchar (retval)) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } return retval; } }
CORBA::WCharSeq * TAO_DynCommon::get_wchar_seq | ( | void | ) | [virtual] |
Definition at line 1124 of file DynCommon.cpp.
{ CORBA::WCharSeq *owned = TAO::DynAnyBasicTypeUtils<CORBA::WCharSeq>::get_value (this); return new CORBA::WCharSeq (*owned); }
CORBA::WChar * TAO_DynCommon::get_wstring | ( | void | ) | [virtual] |
Definition at line 591 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); return cc->get_wstring (); } else { // @@@ (JP) Someday try to find a way to avoid checking for // type code equivalence twice without risking a throw of // BadKind. CORBA::TypeCode_var unaliased_tc = this->check_type_and_unalias (CORBA::_tc_wstring); CORBA::WChar *retval = 0; CORBA::ULong bound = unaliased_tc->length (); (void) (this->any_ >>= CORBA::Any::to_wstring (retval, bound)); return CORBA::wstring_dup (retval); } }
CORBA::Boolean TAO_DynCommon::has_components | ( | void | ) | const |
Definition at line 1253 of file DynCommon.cpp.
{ return this->has_components_; }
void TAO_DynCommon::insert_abstract | ( | CORBA::AbstractBase_ptr | value | ) | [virtual] |
Definition at line 822 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); cc->insert_abstract (value); } else { CORBA::Boolean good_type = true; CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in ()); if (kind != CORBA::tk_abstract_interface) { good_type = false; } else if (!CORBA::is_nil (value)) { const char *value_id = value->_interface_repository_id (); int cmp = ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/AbstractBase:1.0"); if (cmp != 0) { const char *my_id = this->type_->id (); if (ACE_OS::strcmp (value_id, my_id) != 0) { // If 'value' is an objref, this will be a virtual // call. If not, it will just compare to the repo id // above, which we already know won't match. We see // in insert_val() (see comment there) that there // is no way to check for derived valuetypes w/o // type knowledge at compile time. good_type = value->_is_a (my_id); } } } if (good_type) { TAO_OutputCDR out; // The CDR insertion operator for AbstractBase handles // all cases - nil, objref and valuetype - polymorphically. if (!(out << value)) { throw DynamicAny::DynAny::InvalidValue (); } TAO_InputCDR in (out); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); this->any_.replace (unk); } else { throw DynamicAny::DynAny::TypeMismatch (); } } }
void TAO_DynCommon::insert_any | ( | const CORBA::Any & | value | ) | [virtual] |
Definition at line 305 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Any>::insert_value (value,
this);
}
void TAO_DynCommon::insert_boolean | ( | CORBA::Boolean | value | ) | [virtual] |
Definition at line 72 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Boolean>::insert_value (value, this);
}
void TAO_DynCommon::insert_boolean_seq | ( | const CORBA::BooleanSeq & | value | ) | [virtual] |
Definition at line 948 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::BooleanSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_char | ( | CORBA::Char | value | ) | [virtual] |
Definition at line 84 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Char>::insert_value (value, this);
}
void TAO_DynCommon::insert_char_seq | ( | const CORBA::CharSeq & | value | ) | [virtual] |
Definition at line 960 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::CharSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_double | ( | CORBA::Double | value | ) | [virtual] |
Definition at line 120 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Double>::insert_value (value, this);
}
void TAO_DynCommon::insert_double_seq | ( | const CORBA::DoubleSeq & | value | ) | [virtual] |
Definition at line 996 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::DoubleSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_dyn_any | ( | DynamicAny::DynAny_ptr | value | ) | [virtual] |
Definition at line 314 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::Any_var any = value->to_any (); this->insert_any (any.in ()); }
void TAO_DynCommon::insert_float | ( | CORBA::Float | value | ) | [virtual] |
Definition at line 114 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Float>::insert_value (value, this);
}
void TAO_DynCommon::insert_float_seq | ( | const CORBA::FloatSeq & | value | ) | [virtual] |
Definition at line 990 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::FloatSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_long | ( | CORBA::Long | value | ) | [virtual] |
Definition at line 102 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Long>::insert_value (value, this);
}
void TAO_DynCommon::insert_long_seq | ( | const CORBA::LongSeq & | value | ) | [virtual] |
Definition at line 978 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::LongSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_longdouble | ( | CORBA::LongDouble | value | ) | [virtual] |
Definition at line 259 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::LongDouble>::insert_value (value,
this);
}
void TAO_DynCommon::insert_longdouble_seq | ( | const CORBA::LongDoubleSeq & | value | ) | [virtual] |
Definition at line 1014 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::LongDoubleSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_longlong | ( | CORBA::LongLong | value | ) | [virtual] |
Definition at line 247 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::LongLong>::insert_value (value, this);
}
void TAO_DynCommon::insert_longlong_seq | ( | const CORBA::LongLongSeq & | value | ) | [virtual] |
Definition at line 1002 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::LongLongSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_octet | ( | CORBA::Octet | value | ) | [virtual] |
Definition at line 78 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Octet>::insert_value (value, this);
}
void TAO_DynCommon::insert_octet_seq | ( | const CORBA::OctetSeq & | value | ) | [virtual] |
Definition at line 954 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::OctetSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_reference | ( | CORBA::Object_ptr | value | ) | [virtual] |
Definition at line 167 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); cc->insert_reference (value); } else { CORBA::Boolean good_type = true; CORBA::TCKind const kind = TAO_DynAnyFactory::unalias (this->type_.in ()); if (kind != CORBA::tk_objref) { good_type = false; } else if (!CORBA::is_nil (value)) { const char *value_id = value->_interface_repository_id (); if (ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/Object:1.0") != 0) { const char *my_id = this->type_->id (); if (ACE_OS::strcmp (value_id, my_id) != 0) { good_type = value->_is_a (my_id); } } } if (good_type) { TAO_OutputCDR cdr; if (CORBA::is_nil (value)) { // Empty type hint, no profile. cdr.write_ulong (1); cdr.write_char ('\0'); cdr.write_ulong (0); } else { if (!value->marshal (cdr)) { throw DynamicAny::DynAny::InvalidValue (); } } TAO_InputCDR in (cdr); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); this->any_.replace (unk); } else { throw DynamicAny::DynAny::TypeMismatch (); } } }
void TAO_DynCommon::insert_short | ( | CORBA::Short | value | ) | [virtual] |
Definition at line 90 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::Short>::insert_value (value, this);
}
void TAO_DynCommon::insert_short_seq | ( | const CORBA::ShortSeq & | value | ) | [virtual] |
Definition at line 966 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::ShortSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_string | ( | const char * | value | ) | [virtual] |
Definition at line 126 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); cc->insert_string (value); } else { CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); CORBA::TCKind const kind = unaliased_tc->kind (); if (kind != CORBA::tk_string) { throw DynamicAny::DynAny::TypeMismatch (); } CORBA::ULong const bound = unaliased_tc->length (); if (bound > 0 && bound < ACE_OS::strlen (value)) { throw DynamicAny::DynAny::InvalidValue (); } this->any_ <<= CORBA::Any::from_string (const_cast<char *> (value), bound); } }
void TAO_DynCommon::insert_typecode | ( | CORBA::TypeCode_ptr | value | ) | [virtual] |
Definition at line 241 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::TypeCode_ptr>::insert_value (value, this);
}
void TAO_DynCommon::insert_ulong | ( | CORBA::ULong | value | ) | [virtual] |
Definition at line 108 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::ULong>::insert_value (value, this);
}
void TAO_DynCommon::insert_ulong_seq | ( | const CORBA::ULongSeq & | value | ) | [virtual] |
Definition at line 984 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::ULongSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_ulonglong | ( | CORBA::ULongLong | value | ) | [virtual] |
Definition at line 253 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::ULongLong>::insert_value (value, this);
}
void TAO_DynCommon::insert_ulonglong_seq | ( | const CORBA::ULongLongSeq & | value | ) | [virtual] |
Definition at line 1008 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::ULongLongSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_ushort | ( | CORBA::UShort | value | ) | [virtual] |
Definition at line 96 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::UShort>::insert_value (value, this);
}
void TAO_DynCommon::insert_ushort_seq | ( | const CORBA::UShortSeq & | value | ) | [virtual] |
Definition at line 972 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::UShortSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_val | ( | CORBA::ValueBase * | value | ) | [virtual] |
Definition at line 327 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); cc->insert_val (value); } else { CORBA::TCKind kind = TAO_DynAnyFactory::unalias (this->type_.in ()); if (kind != CORBA::tk_value) { throw DynamicAny::DynAny::TypeMismatch (); } // If the arg is 0 we can't do this kind of type checking, // and the call to _tao_marshal() below will handle the // null value correctly. if (value != 0) { const char *value_id = value->_tao_obv_repository_id (); const char *my_id = this->type_->id (); // Valuetypes, unlike interfaces, don't have a virtual // method to check for a more derived type when the // repo ids don't match. Valuetypes have only // a static _downcast() method, which can't be used // here, so if the repo ids don't match, we're hosed. if (ACE_OS::strcmp (value_id, my_id) != 0) { throw DynamicAny::DynAny::TypeMismatch (); } } // This will handle null values correctly, or otherwise // make a virtual call to marshal the state. TAO_OutputCDR out; CORBA::Boolean const good_insert = CORBA::ValueBase::_tao_marshal (out, value); if (!good_insert) { throw DynamicAny::DynAny::InvalidValue (); } TAO_InputCDR in (out); TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); this->any_.replace (unk); } }
void TAO_DynCommon::insert_wchar | ( | CORBA::WChar | value | ) | [virtual] |
Definition at line 266 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::WChar>::insert_value (value,
this);
}
void TAO_DynCommon::insert_wchar_seq | ( | const CORBA::WCharSeq & | value | ) | [virtual] |
Definition at line 1020 of file DynCommon.cpp.
{
TAO::DynAnyBasicTypeUtils<CORBA::WCharSeq>::insert_value (value, this);
}
void TAO_DynCommon::insert_wstring | ( | const CORBA::WChar * | value | ) | [virtual] |
Definition at line 273 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_) { DynamicAny::DynAny_var cc = this->check_component (); cc->insert_wstring (value); } else { CORBA::TypeCode_var unaliased_tc = this->check_type_and_unalias (CORBA::_tc_wstring); CORBA::ULong const bound = unaliased_tc->length (); if (bound > 0 && bound < ACE_OS::wslen (value)) { throw DynamicAny::DynAny::InvalidValue (); } this->any_ <<= CORBA::Any::from_wstring (const_cast<CORBA::WChar *> (value), bound); } }
bool TAO_DynCommon::is_basic_type_seq | ( | CORBA::TypeCode_ptr | tc | ) | [static] |
Definition at line 1235 of file DynCommon.cpp.
{
return (tc == CORBA::_tc_BooleanSeq
|| tc == CORBA::_tc_OctetSeq
|| tc == CORBA::_tc_CharSeq
|| tc == CORBA::_tc_WCharSeq
|| tc == CORBA::_tc_ShortSeq
|| tc == CORBA::_tc_UShortSeq
|| tc == CORBA::_tc_LongSeq
|| tc == CORBA::_tc_ULongSeq
|| tc == CORBA::_tc_LongLongSeq
|| tc == CORBA::_tc_ULongLongSeq
|| tc == CORBA::_tc_FloatSeq
|| tc == CORBA::_tc_DoubleSeq
|| tc == CORBA::_tc_LongDoubleSeq);
}
CORBA::Boolean TAO_DynCommon::next | ( | void | ) | [virtual] |
Definition at line 768 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } CORBA::Long component_count = static_cast<CORBA::Long> (this->component_count_); if (this->has_components_ == 0 || this->current_position_ + 1 >= component_count) { this->current_position_ = -1; return false; } else { ++this->current_position_; return true; } }
void TAO_DynCommon::ref_to_component | ( | CORBA::Boolean | val | ) |
Definition at line 1277 of file DynCommon.cpp.
{ this->ref_to_component_ = val; }
void TAO_DynCommon::rewind | ( | void | ) | [virtual] |
Definition at line 757 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } (void) this->seek (0); }
CORBA::Boolean TAO_DynCommon::seek | ( | CORBA::Long | index | ) | [virtual] |
Definition at line 730 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } if (this->has_components_ == 0) { ACE_UNUSED_ARG (slot); this->current_position_ = -1; return false; } else if (slot < 0 || slot >= static_cast<CORBA::Long> (this->component_count_)) { this->current_position_ = -1; return false; } else { this->current_position_ = slot; return true; } }
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.
{ CORBA::TypeCode_var tc = component->type (); CORBA::TCKind tk = TAO_DynAnyFactory::unalias (tc.in ()); switch (tk) { case CORBA::tk_array: TAO::DynAnyFlagUtils<TAO_DynArray_i>::set_flag_t (component, destroying); break; case CORBA::tk_enum: TAO::DynAnyFlagUtils<TAO_DynEnum_i>::set_flag_t (component, destroying); break; case CORBA::tk_sequence: if (TAO_DynCommon::is_basic_type_seq (tc.in ())) { TAO::DynAnyFlagUtils<TAO_DynAny_i>::set_flag_t (component, destroying); } else { TAO::DynAnyFlagUtils<TAO_DynSequence_i>::set_flag_t (component, destroying); } break; case CORBA::tk_struct: TAO::DynAnyFlagUtils<TAO_DynStruct_i>::set_flag_t (component, destroying); break; case CORBA::tk_union: TAO::DynAnyFlagUtils<TAO_DynUnion_i>::set_flag_t (component, destroying); break; case CORBA::tk_fixed: case CORBA::tk_value: case CORBA::tk_value_box: throw ::CORBA::NO_IMPLEMENT (); default: TAO::DynAnyFlagUtils<TAO_DynAny_i>::set_flag_t (component, destroying); break; } }
CORBA::Any & TAO_DynCommon::the_any | ( | void | ) |
Definition at line 1265 of file DynCommon.cpp.
{ return this->any_; }
CORBA::TypeCode_ptr TAO_DynCommon::type | ( | void | ) | [virtual] |
Definition at line 37 of file DynCommon.cpp.
{ if (this->destroyed_) { throw ::CORBA::OBJECT_NOT_EXIST (); } return CORBA::TypeCode::_duplicate (this->type_.in ()); }
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.
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.
Flag to let destroy() call by container override the flag above.
Definition at line 227 of file DynCommon.h.
CORBA::Long TAO_DynCommon::current_position_ [protected] |
Slot of the current component (if any).
Definition at line 236 of file DynCommon.h.
CORBA::Boolean TAO_DynCommon::destroyed_ [protected] |
Has destroy() been called on us yet?
Definition at line 233 of file DynCommon.h.
CORBA::Boolean TAO_DynCommon::has_components_ [protected] |
Do we contain other Dynamic Anys?
Definition at line 230 of file DynCommon.h.
CORBA::Boolean TAO_DynCommon::ref_to_component_ [protected] |
Were we created by current_component()?
Definition at line 224 of file DynCommon.h.
CORBA::TypeCode_var TAO_DynCommon::type_ [protected] |
Holder for our type code.
Definition at line 242 of file DynCommon.h.