CORBA::TypeCode
implementation for an OMG IDL enum
.
More...
#include <Enum_TypeCode.h>
Inheritance diagram for TAO::TypeCode::Enum< StringType, EnumeratorArrayType, RefCountPolicy >:
Public Member Functions | |
Enum (char const *id, char const *name, EnumeratorArrayType const &enumerators, CORBA::ULong nenumerators) | |
Constructor. | |
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 |
Private Attributes | |
Base_Attributes< StringType > | base_attributes_ |
CORBA::ULong const | nenumerators_ |
The number of enumerators in the OMG IDL enumeration. | |
EnumeratorArrayType const | enumerators_ |
CORBA::TypeCode
implementation for an OMG IDL enum
.
This class implements a CORBA::TypeCode
for an OMG IDL enum
.
Definition at line 46 of file Enum_TypeCode.h.
|
Constructor.
Definition at line 11 of file Enum_TypeCode.inl.
00016 : ::CORBA::TypeCode (CORBA::tk_enum) 00017 , RefCountPolicy () 00018 , base_attributes_ (id, name) 00019 , nenumerators_ (nenumerators) 00020 , enumerators_ (enumerators) 00021 { 00022 } |
|
Implements CORBA::TypeCode. Definition at line 83 of file Enum_TypeCode.cpp. References ACE_OS::strcmp().
00086 { 00087 // This call shouldn't throw since CORBA::TypeCode::equal() verified 00088 // that the TCKind is the same as our's prior to invoking this 00089 // method, meaning that member_count() is supported. 00090 00091 CORBA::ULong const tc_nenumerators = 00092 tc->member_count (); 00093 00094 if (tc_nenumerators != this->nenumerators_) 00095 return false; 00096 00097 for (CORBA::ULong i = 0; i < this->nenumerators_; ++i) 00098 { 00099 StringType const & lhs_enumerator = this->enumerators_[i]; 00100 00101 char const * const lhs_name = 00102 Traits<StringType>::get_string (lhs_enumerator); 00103 char const * const rhs_name = tc->member_name (i 00104 ); 00105 00106 if (ACE_OS::strcmp (lhs_name, rhs_name) != 0) 00107 return false; 00108 } 00109 00110 return true; 00111 } |
|
Implements CORBA::TypeCode. Definition at line 117 of file Enum_TypeCode.cpp.
00120 { 00121 // Perform a structural comparison, excluding the name() and 00122 // member_name() operations. 00123 00124 CORBA::ULong const tc_nenumerators = 00125 tc->member_count (); 00126 00127 if (tc_nenumerators != this->nenumerators_) 00128 return false; 00129 00130 return true; 00131 } |
|
Implements CORBA::TypeCode. Definition at line 137 of file Enum_TypeCode.cpp. References TAO_TypeCodeFactory_Adapter::create_enum_tc(), and ACE_Dynamic_Service< TYPE >::instance().
00139 { 00140 ACE_Array_Base<CORBA::String_var> tc_enumerators (this->nenumerators_); 00141 00142 // Dynamically construct a new array of enumerators stripped of 00143 // member names. 00144 00145 static char const empty_name[] = ""; 00146 00147 for (CORBA::ULong i = 0; i < this->nenumerators_; ++i) 00148 { 00149 // Member names will be stripped, i.e. not embedded within 00150 // the compact TypeCode. 00151 00152 tc_enumerators[i] = empty_name; 00153 } 00154 00155 TAO_TypeCodeFactory_Adapter * adapter = 00156 ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( 00157 TAO_ORB_Core::typecodefactory_adapter_name ()); 00158 00159 if (adapter == 0) 00160 { 00161 throw ::CORBA::INTERNAL (); 00162 } 00163 00164 return 00165 adapter->create_enum_tc (this->base_attributes_.id (), 00166 "" /* empty name */, 00167 tc_enumerators, 00168 this->nenumerators_ 00169 ); 00170 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 174 of file Enum_TypeCode.cpp. References TAO::TypeCode::Enum< StringType, EnumeratorArrayType, RefCountPolicy >::base_attributes_, and TAO::TypeCode::Base_Attributes< StringType >::id().
00176 { 00177 // Ownership is retained by the TypeCode, as required by the C++ 00178 // mapping. 00179 return this->base_attributes_.id (); 00180 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 196 of file Enum_TypeCode.cpp.
00198 { 00199 return this->nenumerators_; 00200 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 206 of file Enum_TypeCode.cpp.
00209 { 00210 // Ownership is retained by the TypeCode, as required by the C++ 00211 // mapping. 00212 if (index >= this->nenumerators_) 00213 throw ::CORBA::TypeCode::Bounds (); 00214 00215 return Traits<StringType>::get_string (this->enumerators_[index]); 00216 } |
|
Reimplemented from CORBA::TypeCode. Definition at line 184 of file Enum_TypeCode.cpp. References TAO::TypeCode::Enum< StringType, EnumeratorArrayType, RefCountPolicy >::base_attributes_, and TAO::TypeCode::Base_Attributes< StringType >::name().
00186 { 00187 // Ownership is retained by the TypeCode, as required by the C++ 00188 // mapping. 00189 return this->base_attributes_.name (); 00190 } |
|
Increase the reference count on this
Implements CORBA::TypeCode. Definition at line 65 of file Enum_TypeCode.cpp.
00066 { 00067 this->RefCountPolicy::add_ref (); 00068 } |
|
Marshal this
Marshal this
Implements CORBA::TypeCode. Definition at line 24 of file Enum_TypeCode.cpp. References ACE_OutputCDR::begin(), TAO_ENCAP_BYTE_ORDER, and ACE_OutputCDR::total_length().
00026 { 00027 // A tk_enum TypeCode has a "complex" parameter list type (see 00028 // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of 00029 // the CORBA specification), meaning that it must be marshaled into 00030 // a CDR encapsulation. 00031 00032 // Create a CDR encapsulation. 00033 TAO_OutputCDR enc; 00034 00035 bool const success = 00036 (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) 00037 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0)) 00038 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0)) 00039 && (enc << this->nenumerators_); 00040 00041 if (!success) 00042 return false; 00043 00044 StringType const * const begin = &this->enumerators_[0]; 00045 StringType const * const end = begin + this->nenumerators_; 00046 00047 for (StringType const * i = begin; i != end; ++i) 00048 { 00049 StringType const & enumerator = *i; 00050 00051 if (!(enc << TAO_OutputCDR::from_string ( 00052 Traits<StringType>::get_string (enumerator), 0))) 00053 return false; 00054 } 00055 00056 return 00057 cdr << static_cast<CORBA::ULong> (enc.total_length ()) 00058 && cdr.write_octet_array_mb (enc.begin ()); 00059 } |
|
Decrease the reference count on this object.
Implements CORBA::TypeCode. Definition at line 74 of file Enum_TypeCode.cpp.
00075 { 00076 this->RefCountPolicy::remove_ref (); 00077 } |
|
Base attributes containing repository ID and name of structure type. Definition at line 107 of file Enum_TypeCode.h. Referenced by TAO::TypeCode::Enum< StringType, EnumeratorArrayType, RefCountPolicy >::id_i(), and TAO::TypeCode::Enum< StringType, EnumeratorArrayType, RefCountPolicy >::name_i(). |
|
Array of Definition at line 114 of file Enum_TypeCode.h. |
|
The number of enumerators in the OMG IDL enumeration.
Definition at line 110 of file Enum_TypeCode.h. |