#include <DynEnum_i.h>
Inheritance diagram for TAO_DynEnum_i:
Public Member Functions | |
TAO_DynEnum_i (void) | |
Constructor. | |
~TAO_DynEnum_i (void) | |
Destructor. | |
void | init (CORBA::TypeCode_ptr tc) |
Initialize using just a TypeCode. | |
void | init (const CORBA::Any &any) |
Initialize using an Any. | |
virtual char * | get_as_string () throw ( CORBA::SystemException ) |
virtual void | set_as_string (const char *value) throw ( CORBA::SystemException, DynamicAny::DynAny::InvalidValue ) |
virtual CORBA::ULong | get_as_ulong () throw ( CORBA::SystemException ) |
virtual void | set_as_ulong (CORBA::ULong value) throw ( CORBA::SystemException, DynamicAny::DynAny::InvalidValue ) |
virtual void | from_any (const CORBA::Any &value) throw ( CORBA::SystemException, DynamicAny::DynAny::TypeMismatch, DynamicAny::DynAny::InvalidValue ) |
virtual CORBA::Any * | to_any () throw ( CORBA::SystemException ) |
virtual CORBA::Boolean | equal (DynamicAny::DynAny_ptr dyn_any) throw ( CORBA::SystemException ) |
virtual void | destroy () throw ( CORBA::SystemException ) |
virtual DynamicAny::DynAny_ptr | current_component () throw ( CORBA::SystemException, DynamicAny::DynAny::TypeMismatch ) |
Static Public Member Functions | |
TAO_DynEnum_i * | _narrow (CORBA::Object_ptr obj) |
Private Member Functions | |
void | init_common (void) |
TAO_DynEnum_i (const TAO_DynEnum_i &src) | |
TAO_DynEnum_i & | operator= (const TAO_DynEnum_i &src) |
Private Attributes | |
CORBA::ULong | value_ |
Current numeric value of the enum. |
Definition at line 42 of file DynEnum_i.h.
|
Constructor.
Definition at line 17 of file DynEnum_i.cpp.
00018 { 00019 } |
|
Destructor.
Definition at line 21 of file DynEnum_i.cpp.
00022 { 00023 } |
|
|
|
Implements DynamicAny::DynEnum. Definition at line 100 of file DynEnum_i.cpp. References CORBA::is_nil(). Referenced by TAO_DynCommon::set_flag().
00102 { 00103 if (CORBA::is_nil (_tao_objref)) 00104 { 00105 return 0; 00106 } 00107 00108 return dynamic_cast<TAO_DynEnum_i *> (_tao_objref); 00109 } |
|
Implements DynamicAny::DynAny. Definition at line 333 of file DynEnum_i.cpp. References ACE_THROW_RETURN.
00338 { 00339 if (this->destroyed_) 00340 { 00341 ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 00342 DynamicAny::DynAny::_nil ()); 00343 } 00344 00345 ACE_THROW_RETURN (DynamicAny::DynAny::TypeMismatch (), 00346 DynamicAny::DynAny::_nil ()); 00347 } |
|
Implements DynamicAny::DynAny. Definition at line 316 of file DynEnum_i.cpp. References ACE_THROW.
00320 { 00321 if (this->destroyed_) 00322 { 00323 ACE_THROW (CORBA::OBJECT_NOT_EXIST ()); 00324 } 00325 00326 if (!this->ref_to_component_ || this->container_is_destroying_) 00327 { 00328 this->destroyed_ = 1; 00329 } 00330 } |
|
Definition at line 270 of file DynEnum_i.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, DynamicAny::DynAny_ptr, and ACE_InputCDR::read_ulong().
00275 { 00276 CORBA::TypeCode_var tc = rhs->type (ACE_ENV_SINGLE_ARG_PARAMETER); 00277 ACE_CHECK_RETURN (0); 00278 00279 CORBA::Boolean equivalent = tc->equivalent (this->type_.in () 00280 ACE_ENV_ARG_PARAMETER); 00281 ACE_CHECK_RETURN (0); 00282 00283 if (!equivalent) 00284 { 00285 return 0; 00286 } 00287 00288 CORBA::Any_var any = rhs->to_any (ACE_ENV_SINGLE_ARG_PARAMETER); 00289 ACE_CHECK_RETURN (0); 00290 00291 TAO::Any_Impl *impl = any->impl (); 00292 CORBA::ULong value; 00293 00294 if (impl->encoded ()) 00295 { 00296 TAO::Unknown_IDL_Type *unk = 00297 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00298 00299 // We don't want unk's rd_ptr to move, in case we are shared by 00300 // another Any, so we use this to copy the state, not the buffer. 00301 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00302 for_reading.read_ulong (value); 00303 } 00304 else 00305 { 00306 TAO_OutputCDR out; 00307 impl->marshal_value (out); 00308 TAO_InputCDR in (out); 00309 in.read_ulong (value); 00310 } 00311 00312 return value == this->value_; 00313 } |
|
Definition at line 199 of file DynEnum_i.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_THROW, ACE_InputCDR::read_ulong(), and TAO_DynAnyFactory::unalias().
00206 { 00207 CORBA::TypeCode_var tc = any.type (); 00208 CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in () 00209 ACE_ENV_ARG_PARAMETER); 00210 ACE_CHECK; 00211 00212 if (kind == CORBA::tk_enum) 00213 { 00214 // Get the CDR stream of the Any, if there isn't one, make one. 00215 TAO::Any_Impl *impl = any.impl (); 00216 00217 if (impl->encoded ()) 00218 { 00219 TAO::Unknown_IDL_Type *unk = 00220 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00221 00222 // We don't want unk's rd_ptr to move, in case we are shared by 00223 // another Any, so we use this to copy the state, not the buffer. 00224 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00225 for_reading.read_ulong (this->value_); 00226 } 00227 else 00228 { 00229 TAO_OutputCDR out; 00230 impl->marshal_value (out); 00231 TAO_InputCDR in (out); 00232 in.read_ulong (this->value_); 00233 } 00234 } 00235 else 00236 { 00237 ACE_THROW (DynamicAny::DynAny::TypeMismatch ()); 00238 } 00239 } |
|
Implements DynamicAny::DynEnum. Definition at line 114 of file DynEnum_i.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, and CORBA::string_dup().
00118 { 00119 const char *retval = 00120 this->type_.in ()->member_name (this->value_ 00121 ACE_ENV_ARG_PARAMETER); 00122 ACE_CHECK_RETURN (0); 00123 00124 return CORBA::string_dup (retval); 00125 } |
|
Implements DynamicAny::DynEnum. Definition at line 166 of file DynEnum_i.cpp.
00170 { 00171 return this->value_; 00172 } |
|
Initialize using an Any.
Definition at line 37 of file DynEnum_i.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_THROW, init_common(), ACE_InputCDR::read_ulong(), and TAO_DynAnyFactory::unalias().
00039 { 00040 CORBA::TypeCode_var tc = any.type (); 00041 00042 CORBA::TCKind kind = 00043 TAO_DynAnyFactory::unalias (tc.in () 00044 ACE_ENV_ARG_PARAMETER); 00045 ACE_CHECK; 00046 00047 if (kind != CORBA::tk_enum) 00048 { 00049 ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ()); 00050 } 00051 00052 this->type_ = tc; 00053 00054 TAO::Any_Impl *impl = any.impl (); 00055 00056 if (impl->encoded ()) 00057 { 00058 TAO::Unknown_IDL_Type *unk = 00059 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00060 00061 // We don't want unk's rd_ptr to move, in case we are shared by 00062 // another Any, so we use this to copy the state, not the buffer. 00063 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00064 for_reading.read_ulong (this->value_); 00065 } 00066 else 00067 { 00068 TAO_OutputCDR out; 00069 impl->marshal_value (out); 00070 TAO_InputCDR in (out); 00071 in.read_ulong (this->value_); 00072 } 00073 00074 this->init_common (); 00075 } |
|
Initialize using just a TypeCode.
Definition at line 78 of file DynEnum_i.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_THROW, init_common(), and TAO_DynAnyFactory::unalias(). Referenced by TAO_DynAnyFactory::make_dyn_any().
00080 { 00081 CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc 00082 ACE_ENV_ARG_PARAMETER); 00083 ACE_CHECK; 00084 00085 if (kind != CORBA::tk_enum) 00086 { 00087 ACE_THROW (DynamicAny::DynAnyFactory::InconsistentTypeCode ()); 00088 } 00089 00090 this->type_ = CORBA::TypeCode::_duplicate (tc); 00091 00092 this->value_ = 0; 00093 00094 this->init_common (); 00095 } |
|
Definition at line 26 of file DynEnum_i.cpp. Referenced by init().
00027 { 00028 this->ref_to_component_ = 0; 00029 this->container_is_destroying_ = 0; 00030 this->has_components_ = 0; 00031 this->destroyed_ = 0; 00032 this->current_position_ = -1; 00033 this->component_count_ = 0; 00034 } |
|
|
|
Implements DynamicAny::DynEnum. Definition at line 128 of file DynEnum_i.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW, and ACE_OS::strcmp().
00134 { 00135 CORBA::ULong count = 00136 this->type_.in ()->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); 00137 ACE_CHECK; 00138 00139 CORBA::ULong i; 00140 const char *temp = 0; 00141 00142 for (i = 0; i < count; ++i) 00143 { 00144 temp = this->type_.in ()->member_name (i 00145 ACE_ENV_ARG_PARAMETER); 00146 ACE_CHECK; 00147 00148 if (!ACE_OS::strcmp (value_as_string, 00149 temp)) 00150 { 00151 break; 00152 } 00153 } 00154 00155 if (i < count) 00156 { 00157 this->value_ = i; 00158 } 00159 else 00160 { 00161 ACE_THROW (DynamicAny::DynAny::InvalidValue ()); 00162 } 00163 } |
|
Definition at line 175 of file DynEnum_i.cpp. References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, and ACE_THROW.
00181 { 00182 CORBA::ULong max = 00183 this->type_.in ()->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); 00184 ACE_CHECK; 00185 00186 if (value_as_ulong < max) 00187 { 00188 this->value_ = value_as_ulong; 00189 } 00190 else 00191 { 00192 ACE_THROW (DynamicAny::DynAny::InvalidValue ()); 00193 } 00194 } |
|
Implements DynamicAny::DynAny. Definition at line 242 of file DynEnum_i.cpp. References ACE_CHECK_RETURN, ACE_NEW_THROW_EX, and ACE_OutputCDR::write_ulong().
00246 { 00247 TAO_OutputCDR out_cdr; 00248 00249 out_cdr.write_ulong (this->value_); 00250 00251 CORBA::Any *retval; 00252 ACE_NEW_THROW_EX (retval, 00253 CORBA::Any, 00254 CORBA::NO_MEMORY ()); 00255 ACE_CHECK_RETURN (0); 00256 00257 TAO_InputCDR in_cdr (out_cdr); 00258 TAO::Unknown_IDL_Type *unk = 0; 00259 ACE_NEW_THROW_EX (unk, 00260 TAO::Unknown_IDL_Type (this->type_.in (), 00261 in_cdr), 00262 CORBA::NO_MEMORY ()); 00263 ACE_CHECK_RETURN (0); 00264 00265 retval->replace (unk); 00266 return retval; 00267 } |
|
Current numeric value of the enum.
Definition at line 153 of file DynEnum_i.h. |