#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 (void) |
virtual void | set_as_string (const char *value) |
virtual CORBA::ULong | get_as_ulong (void) |
virtual void | set_as_ulong (CORBA::ULong value) |
virtual void | from_any (const CORBA::Any &value) |
virtual CORBA::Any * | to_any (void) |
virtual CORBA::Boolean | equal (DynamicAny::DynAny_ptr dyn_any) |
virtual void | destroy (void) |
virtual DynamicAny::DynAny_ptr | current_component (void) |
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 18 of file DynEnum_i.cpp.
00019 { 00020 } |
|
Destructor.
Definition at line 22 of file DynEnum_i.cpp.
00023 { 00024 } |
|
|
|
Reimplemented from CORBA::LocalObject. Definition at line 96 of file DynEnum_i.cpp. References CORBA::is_nil(). Referenced by TAO_DynUnion_i::init(), and TAO_DynUnion_i::set_discriminator().
00097 { 00098 if (CORBA::is_nil (_tao_objref)) 00099 { 00100 return 0; 00101 } 00102 00103 return dynamic_cast<TAO_DynEnum_i *> (_tao_objref); 00104 } |
|
Implements DynamicAny::DynAny. Definition at line 289 of file DynEnum_i.cpp.
00290 { 00291 if (this->destroyed_) 00292 { 00293 throw ::CORBA::OBJECT_NOT_EXIST (); 00294 } 00295 00296 throw DynamicAny::DynAny::TypeMismatch (); 00297 } |
|
Implements DynamicAny::DynAny. Definition at line 275 of file DynEnum_i.cpp.
00276 { 00277 if (this->destroyed_) 00278 { 00279 throw ::CORBA::OBJECT_NOT_EXIST (); 00280 } 00281 00282 if (!this->ref_to_component_ || this->container_is_destroying_) 00283 { 00284 this->destroyed_ = true; 00285 } 00286 } |
|
Definition at line 234 of file DynEnum_i.cpp. References ACE_InputCDR::read_ulong().
00235 { 00236 CORBA::TypeCode_var tc = rhs->type (); 00237 00238 CORBA::Boolean equivalent = tc->equivalent (this->type_.in ()); 00239 00240 if (!equivalent) 00241 { 00242 return false; 00243 } 00244 00245 CORBA::Any_var any = rhs->to_any (); 00246 00247 TAO::Any_Impl *impl = any->impl (); 00248 CORBA::ULong value; 00249 00250 if (impl->encoded ()) 00251 { 00252 TAO::Unknown_IDL_Type * const unk = 00253 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00254 00255 if (!unk) 00256 throw CORBA::INTERNAL (); 00257 00258 // We don't want unk's rd_ptr to move, in case we are shared by 00259 // another Any, so we use this to copy the state, not the buffer. 00260 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00261 for_reading.read_ulong (value); 00262 } 00263 else 00264 { 00265 TAO_OutputCDR out; 00266 impl->marshal_value (out); 00267 TAO_InputCDR in (out); 00268 in.read_ulong (value); 00269 } 00270 00271 return value == this->value_; 00272 } |
|
Definition at line 173 of file DynEnum_i.cpp. References ACE_InputCDR::read_ulong(), and TAO_DynAnyFactory::unalias().
00174 { 00175 CORBA::TypeCode_var tc = any.type (); 00176 CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()); 00177 00178 if (kind == CORBA::tk_enum) 00179 { 00180 // Get the CDR stream of the Any, if there isn't one, make one. 00181 TAO::Any_Impl *impl = any.impl (); 00182 00183 if (impl->encoded ()) 00184 { 00185 TAO::Unknown_IDL_Type * const unk = 00186 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00187 00188 if (!unk) 00189 throw CORBA::INTERNAL (); 00190 00191 // We don't want unk's rd_ptr to move, in case we are shared by 00192 // another Any, so we use this to copy the state, not the buffer. 00193 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00194 for_reading.read_ulong (this->value_); 00195 } 00196 else 00197 { 00198 TAO_OutputCDR out; 00199 impl->marshal_value (out); 00200 TAO_InputCDR in (out); 00201 in.read_ulong (this->value_); 00202 } 00203 } 00204 else 00205 { 00206 throw DynamicAny::DynAny::TypeMismatch (); 00207 } 00208 } |
|
Implements DynamicAny::DynEnum. Definition at line 109 of file DynEnum_i.cpp. References CORBA::string_dup(), and TAO_DynAnyFactory::strip_alias().
00110 { 00111 CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ()); 00112 00113 const char *retval = ct.in ()->member_name (this->value_); 00114 00115 return CORBA::string_dup (retval); 00116 } |
|
Implements DynamicAny::DynEnum. Definition at line 149 of file DynEnum_i.cpp.
00150 { 00151 return this->value_; 00152 } |
|
Initialize using an Any.
Definition at line 38 of file DynEnum_i.cpp. References init_common(), ACE_InputCDR::read_ulong(), and TAO_DynAnyFactory::unalias().
00039 { 00040 CORBA::TypeCode_var tc = any.type (); 00041 CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()); 00042 00043 if (kind != CORBA::tk_enum) 00044 { 00045 throw DynamicAny::DynAnyFactory::InconsistentTypeCode (); 00046 } 00047 00048 this->type_ = tc; 00049 00050 TAO::Any_Impl *impl = any.impl (); 00051 00052 if (impl->encoded ()) 00053 { 00054 TAO::Unknown_IDL_Type * const unk = 00055 dynamic_cast<TAO::Unknown_IDL_Type *> (impl); 00056 00057 if (!unk) 00058 throw CORBA::INTERNAL (); 00059 00060 // We don't want unk's rd_ptr to move, in case we are shared by 00061 // another Any, so we use this to copy the state, not the buffer. 00062 TAO_InputCDR for_reading (unk->_tao_get_cdr ()); 00063 for_reading.read_ulong (this->value_); 00064 } 00065 else 00066 { 00067 TAO_OutputCDR out; 00068 impl->marshal_value (out); 00069 TAO_InputCDR in (out); 00070 in.read_ulong (this->value_); 00071 } 00072 00073 this->init_common (); 00074 } |
|
Initialize using just a TypeCode.
Definition at line 77 of file DynEnum_i.cpp. References init_common(), and TAO_DynAnyFactory::unalias().
00078 { 00079 CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc); 00080 00081 if (kind != CORBA::tk_enum) 00082 { 00083 throw DynamicAny::DynAnyFactory::InconsistentTypeCode (); 00084 } 00085 00086 this->type_ = CORBA::TypeCode::_duplicate (tc); 00087 00088 this->value_ = 0; 00089 00090 this->init_common (); 00091 } |
|
Definition at line 27 of file DynEnum_i.cpp. Referenced by init().
00028 { 00029 this->ref_to_component_ = false; 00030 this->container_is_destroying_ = false; 00031 this->has_components_ = false; 00032 this->destroyed_ = false; 00033 this->current_position_ = -1; 00034 this->component_count_ = 0; 00035 } |
|
|
|
Definition at line 119 of file DynEnum_i.cpp. References ACE_OS::strcmp(), and TAO_DynAnyFactory::strip_alias().
00120 { 00121 CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ()); 00122 00123 CORBA::ULong count = ct.in ()->member_count (); 00124 00125 CORBA::ULong i; 00126 const char *temp = 0; 00127 00128 for (i = 0; i < count; ++i) 00129 { 00130 temp = ct.in ()->member_name (i); 00131 00132 if (!ACE_OS::strcmp (value_as_string, temp)) 00133 { 00134 break; 00135 } 00136 } 00137 00138 if (i < count) 00139 { 00140 this->value_ = i; 00141 } 00142 else 00143 { 00144 throw DynamicAny::DynAny::InvalidValue (); 00145 } 00146 } |
|
Definition at line 155 of file DynEnum_i.cpp. References TAO_DynAnyFactory::strip_alias(). Referenced by TAO_DynUnion_i::init(), and TAO_DynUnion_i::set_discriminator().
00156 { 00157 CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ()); 00158 CORBA::ULong const max = ct.in ()->member_count (); 00159 00160 if (value_as_ulong < max) 00161 { 00162 this->value_ = value_as_ulong; 00163 } 00164 else 00165 { 00166 throw DynamicAny::DynAny::InvalidValue (); 00167 } 00168 } |
|
Implements DynamicAny::DynAny. Definition at line 211 of file DynEnum_i.cpp. References ACE_NEW_THROW_EX, and ACE_OutputCDR::write_ulong().
00212 { 00213 TAO_OutputCDR out_cdr; 00214 00215 out_cdr.write_ulong (this->value_); 00216 00217 CORBA::Any *retval; 00218 ACE_NEW_THROW_EX (retval, 00219 CORBA::Any, 00220 CORBA::NO_MEMORY ()); 00221 00222 TAO_InputCDR in_cdr (out_cdr); 00223 TAO::Unknown_IDL_Type *unk = 0; 00224 ACE_NEW_THROW_EX (unk, 00225 TAO::Unknown_IDL_Type (this->type_.in (), 00226 in_cdr), 00227 CORBA::NO_MEMORY ()); 00228 00229 retval->replace (unk); 00230 return retval; 00231 } |
|
Current numeric value of the enum.
Definition at line 95 of file DynEnum_i.h. |