CORBA::TypeCode
implementation for an OMG IDL valuetype
or event
.
More...
#include <Value_TypeCode.h>
Inheritance diagram for TAO::TypeCode::Value< StringType, TypeCodeType, FieldArrayType, RefCountPolicy >:
Public Member Functions | |
Value (CORBA::TCKind kind, char const *id, char const *name, CORBA::ValueModifier modifier, TypeCodeType const &concrete_base, FieldArrayType const &fields, CORBA::ULong nfields) | |
Constructor. | |
Value (CORBA::TCKind kind, char const *id) | |
Constructor used for recursive TypeCodes. | |
TAO-specific @c CORBA::TypeCode Methods | |
virtual bool | tao_marshal (TAO_OutputCDR &cdr, CORBA::ULong offset) const |
Marshal this TypeCode into a CDR output stream. | |
virtual void | tao_duplicate (void) |
Increase the reference count on this TypeCode . | |
virtual void | tao_release (void) |
Decrease the reference count on this object. | |
Protected Member Functions | |
@c TAO CORBA::TypeCode Template Methods | |
virtual CORBA::Boolean | equal_i (CORBA::TypeCode_ptr tc) const |
virtual CORBA::Boolean | equivalent_i (CORBA::TypeCode_ptr tc) const |
virtual CORBA::TypeCode_ptr | get_compact_typecode_i (void) const |
virtual char const * | id_i (void) const |
virtual char const * | name_i (void) const |
virtual CORBA::ULong | member_count_i (void) const |
virtual char const * | member_name_i (CORBA::ULong index) const |
virtual CORBA::TypeCode_ptr | member_type_i (CORBA::ULong index) const |
virtual CORBA::Visibility | member_visibility_i (CORBA::ULong index) const |
virtual CORBA::ValueModifier | type_modifier_i (void) const |
virtual CORBA::TypeCode_ptr | concrete_base_type_i (void) const |
Protected Attributes | |
Base_Attributes< StringType > | base_attributes_ |
CORBA::ValueModifier | type_modifier_ |
TypeCodeType | concrete_base_ |
CORBA::ULong | nfields_ |
The number of fields in the OMG IDL value. | |
FieldArrayType | fields_ |
CORBA::TypeCode
implementation for an OMG IDL valuetype
or event
.
This class implements a CORBA::TypeCode
for an OMG IDL valuetype
or event
.
Definition at line 52 of file Value_TypeCode.h.
|
Constructor.
Definition at line 15 of file Value_TypeCode.inl.
00029 : ::CORBA::TypeCode (kind) 00030 , RefCountPolicy () 00031 , base_attributes_ (id, name) 00032 , type_modifier_ (modifier) 00033 , concrete_base_ (concrete_base) 00034 , nfields_ (nfields) 00035 , fields_ (fields) 00036 { 00037 } |
|
Constructor used for recursive TypeCodes.
Definition at line 47 of file Value_TypeCode.inl.
00050 : ::CORBA::TypeCode (kind) 00051 , RefCountPolicy () 00052 , base_attributes_ (id) 00053 , type_modifier_ (CORBA::VM_NONE) 00054 , concrete_base_ () 00055 , nfields_ (0) 00056 , fields_ () 00057 { 00058 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 418 of file Value_TypeCode.cpp. References CORBA::TypeCode::_duplicate().
00419 { 00420 return 00421 CORBA::TypeCode::_duplicate ( 00422 Traits<StringType>::get_typecode (this->concrete_base_)); 00423 } |
|
Implements CORBA::TypeCode. Definition at line 119 of file Value_TypeCode.cpp. References TAO::TypeCode::Value_Field< StringType, TypeCodeType >::name, ACE_OS::strcmp(), TAO::TypeCode::Value_Field< StringType, TypeCodeType >::type, and TAO::TypeCode::Value_Field< StringType, TypeCodeType >::visibility.
00122 { 00123 // None of these calls should throw since CORBA::TypeCode::equal() 00124 // verified that the TCKind is the same as our's prior to invoking 00125 // this method. 00126 00127 CORBA::ValueModifier const tc_type_modifier = 00128 tc->type_modifier (); 00129 00130 if (tc_type_modifier != this->type_modifier_) 00131 return false; 00132 00133 CORBA::TypeCode_var rhs_concrete_base_type = 00134 tc->concrete_base_type (); 00135 00136 CORBA::Boolean const equal_concrete_base_types = 00137 this->equal (rhs_concrete_base_type.in () 00138 ); 00139 00140 if (!equal_concrete_base_types) 00141 return false; 00142 00143 CORBA::ULong const tc_nfields = 00144 tc->member_count (); 00145 00146 if (tc_nfields != this->nfields_) 00147 return false; 00148 00149 for (CORBA::ULong i = 0; i < this->nfields_; ++i) 00150 { 00151 Value_Field<StringType, TypeCodeType> const & lhs_field = 00152 this->fields_[i]; 00153 00154 CORBA::Visibility const lhs_visibility = lhs_field.visibility; 00155 CORBA::Visibility const rhs_visibility = 00156 tc->member_visibility (i 00157 ); 00158 00159 if (lhs_visibility != rhs_visibility) 00160 return false; 00161 00162 char const * const lhs_name = 00163 Traits<StringType>::get_string (lhs_field.name); 00164 char const * const rhs_name = tc->member_name (i); 00165 00166 if (ACE_OS::strcmp (lhs_name, rhs_name) != 0) 00167 return false; 00168 00169 CORBA::TypeCode_ptr const lhs_tc = 00170 Traits<StringType>::get_typecode (lhs_field.type); 00171 CORBA::TypeCode_var const rhs_tc = 00172 tc->member_type (i); 00173 00174 CORBA::Boolean const equal_members = 00175 lhs_tc->equal (rhs_tc.in ()); 00176 00177 if (!equal_members) 00178 return false; 00179 } 00180 00181 return true; 00182 } |
|
Implements CORBA::TypeCode. Definition at line 192 of file Value_TypeCode.cpp. References TAO::TypeCode::Value_Field< StringType, TypeCodeType >::type, and TAO::TypeCode::Value_Field< StringType, TypeCodeType >::visibility.
00193 { 00194 CORBA::ValueModifier const tc_type_modifier = 00195 tc->type_modifier (); 00196 00197 if (tc_type_modifier != this->type_modifier_) 00198 return false; 00199 00200 CORBA::TypeCode_var rhs_concrete_base_type = 00201 tc->concrete_base_type (); 00202 00203 CORBA::Boolean const equivalent_concrete_base_types = 00204 this->equivalent (rhs_concrete_base_type.in ()); 00205 00206 if (!equivalent_concrete_base_types) 00207 return false; 00208 00209 // Perform a structural comparison, excluding the name() and 00210 // member_name() operations. 00211 00212 CORBA::ULong const tc_nfields = 00213 tc->member_count (); 00214 00215 if (tc_nfields != this->nfields_) 00216 return false; 00217 00218 for (CORBA::ULong i = 0; i < this->nfields_; ++i) 00219 { 00220 Value_Field<StringType, TypeCodeType> const & lhs_field = 00221 this->fields_[i]; 00222 00223 CORBA::Visibility const lhs_visibility = 00224 lhs_field.visibility; 00225 CORBA::Visibility const rhs_visibility = 00226 tc->member_visibility (i); 00227 00228 if (lhs_visibility != rhs_visibility) 00229 return false; 00230 00231 CORBA::TypeCode_ptr const lhs_tc = 00232 Traits<StringType>::get_typecode (lhs_field.type); 00233 CORBA::TypeCode_var const rhs_tc = 00234 tc->member_type (i); 00235 00236 CORBA::Boolean const equiv_types = 00237 lhs_tc->equivalent (rhs_tc.in () 00238 ); 00239 00240 if (!equiv_types) 00241 return false; 00242 } 00243 00244 return true; 00245 } |
|
Implements CORBA::TypeCode. Definition at line 255 of file Value_TypeCode.cpp. References TAO_TypeCodeFactory_Adapter::create_value_event_tc(), and ACE_Dynamic_Service< TYPE >::instance().
00256 { 00257 ACE_Array_Base<Value_Field<CORBA::String_var, CORBA::TypeCode_var> > 00258 tc_fields (this->nfields_); 00259 00260 if (this->nfields_ > 0) 00261 { 00262 // Dynamically construct a new array of fields stripped of 00263 // member names. 00264 00265 static char const empty_name[] = ""; 00266 00267 for (CORBA::ULong i = 0; i < this->nfields_; ++i) 00268 { 00269 // Member names will be stripped, i.e. not embedded within 00270 // the compact TypeCode. 00271 00272 tc_fields[i].name = empty_name; 00273 tc_fields[i].type = 00274 Traits<StringType>::get_typecode ( 00275 this->fields_[i].type)->get_compact_typecode ( 00276 ); 00277 tc_fields[i].visibility = this->fields_[i].visibility; 00278 } 00279 } 00280 00281 TAO_TypeCodeFactory_Adapter * const adapter = 00282 ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( 00283 TAO_ORB_Core::typecodefactory_adapter_name ()); 00284 00285 if (adapter == 0) 00286 { 00287 throw ::CORBA::INTERNAL (); 00288 } 00289 00290 return 00291 adapter->create_value_event_tc ( 00292 this->kind_, 00293 this->base_attributes_.id (), 00294 "", // empty name 00295 this->type_modifier_, 00296 Traits<StringType>::get_typecode (this->concrete_base_), 00297 tc_fields, 00298 this->nfields_ 00299 ); 00300 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 310 of file Value_TypeCode.cpp.
00311 { 00312 // Ownership is retained by the TypeCode, as required by the C++ 00313 // mapping. 00314 return this->base_attributes_.id (); 00315 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 340 of file Value_TypeCode.cpp.
00341 { 00342 return this->nfields_; 00343 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 353 of file Value_TypeCode.cpp.
00354 { 00355 // Ownership is retained by the TypeCode, as required by the C++ 00356 // mapping. 00357 if (index >= this->nfields_) 00358 throw ::CORBA::TypeCode::Bounds (); 00359 00360 return Traits<StringType>::get_string (this->fields_[index].name); 00361 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 371 of file Value_TypeCode.cpp. References CORBA::TypeCode::_duplicate().
00372 { 00373 if (index >= this->nfields_) 00374 throw ::CORBA::TypeCode::Bounds (); 00375 00376 return 00377 CORBA::TypeCode::_duplicate ( 00378 Traits<StringType>::get_typecode (this->fields_[index].type)); 00379 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 389 of file Value_TypeCode.cpp.
|
|
Reimplemented from CORBA::TypeCode. Definition at line 325 of file Value_TypeCode.cpp.
00326 { 00327 // Ownership is retained by the TypeCode, as required by the C++ 00328 // mapping. 00329 return this->base_attributes_.name (); 00330 } |
|
Increase the reference count on this
Implements CORBA::TypeCode. Definition at line 93 of file Value_TypeCode.cpp.
00094 { 00095 this->RefCountPolicy::add_ref (); 00096 } |
|
Marshal this
Marshal this
Implements CORBA::TypeCode. Definition at line 30 of file Value_TypeCode.cpp. References ACE_align_binary(), ACE_OutputCDR::begin(), TAO::TypeCode::Value_Field< StringType, TypeCodeType >::name, TAO_ENCAP_BYTE_ORDER, ACE_OutputCDR::total_length(), TAO::TypeCode::Value_Field< StringType, TypeCodeType >::type, and TAO::TypeCode::Value_Field< StringType, TypeCodeType >::visibility.
00033 { 00034 // A tk_value TypeCode has a "complex" parameter list type (see 00035 // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of 00036 // the CORBA specification), meaning that it must be marshaled into 00037 // a CDR encapsulation. 00038 00039 // Create a CDR encapsulation. 00040 TAO_OutputCDR enc; 00041 00042 // Account for the encoded CDR encapsulation length and byte order. 00043 // 00044 // Aligning on an octet since the next value after the CDR 00045 // encapsulation length will always be the byte order octet/boolean 00046 // in this case. 00047 offset = ACE_align_binary (offset + 4, 00048 ACE_CDR::OCTET_ALIGN); 00049 00050 bool const success = 00051 (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) 00052 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0)) 00053 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0)) 00054 && (enc << this->type_modifier_) 00055 && marshal (enc, 00056 Traits<StringType>::get_typecode (this->concrete_base_), 00057 offset + enc.total_length ()) 00058 && (enc << this->nfields_); 00059 00060 if (!success) 00061 return false; 00062 00063 Value_Field<StringType, TypeCodeType> const * const begin = 00064 &this->fields_[0]; 00065 Value_Field<StringType, TypeCodeType> const * const end = 00066 begin + this->nfields_; 00067 00068 for (Value_Field<StringType, TypeCodeType> const * i = begin; i != end; ++i) 00069 { 00070 Value_Field<StringType, TypeCodeType> const & field = *i; 00071 00072 if (!(enc << Traits<StringType>::get_string (field.name)) 00073 || !marshal (enc, 00074 Traits<StringType>::get_typecode (field.type), 00075 offset + enc.total_length ()) 00076 || !(enc << field.visibility)) 00077 return false; 00078 } 00079 00080 return 00081 cdr << static_cast<CORBA::ULong> (enc.total_length ()) 00082 && cdr.write_octet_array_mb (enc.begin ()); 00083 } |
|
Decrease the reference count on this object.
Implements CORBA::TypeCode. Definition at line 106 of file Value_TypeCode.cpp.
00107 { 00108 this->RefCountPolicy::remove_ref (); 00109 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 405 of file Value_TypeCode.cpp.
00406 { 00407 return this->type_modifier_; 00408 } |
|
Base attributes containing repository ID and name of Definition at line 132 of file Value_TypeCode.h. |
|
The Definition at line 140 of file Value_TypeCode.h. |
|
Array of Definition at line 147 of file Value_TypeCode.h. |
|
The number of fields in the OMG IDL value.
Definition at line 143 of file Value_TypeCode.h. |
|
The Definition at line 136 of file Value_TypeCode.h. |