#include <Enum_TypeCode_Static.h>
Inheritance diagram for TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >:
Public Member Functions | |
Enum (char const *id, char const *name, char const *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< char const * > | base_attributes_ |
CORBA::ULong const | nenumerators_ |
The number of enumerators in the OMG IDL enumeration. | |
char const *const *const | enumerators_ |
Definition at line 49 of file Enum_TypeCode_Static.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::Enum | ( | char const * | id, | |
char const * | name, | |||
char const *const * | enumerators, | |||
CORBA::ULong | nenumerators | |||
) |
Constructor.
Definition at line 11 of file Enum_TypeCode_Static.inl.
00016 : ::CORBA::TypeCode (CORBA::tk_enum) 00017 , ::TAO::Null_RefCount_Policy () 00018 , base_attributes_ (id, name) 00019 , nenumerators_ (nenumerators) 00020 , enumerators_ (enumerators) 00021 { 00022 }
CORBA::Boolean TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::equal_i | ( | CORBA::TypeCode_ptr | tc | ) | const [protected, virtual] |
Implements CORBA::TypeCode.
Definition at line 81 of file Enum_TypeCode_Static.cpp.
References ACE_OS::strcmp().
00084 { 00085 // This call shouldn't throw since CORBA::TypeCode::equal() verified 00086 // that the TCKind is the same as our's prior to invoking this 00087 // method, meaning that member_count() is supported. 00088 00089 CORBA::ULong const tc_nenumerators = 00090 tc->member_count (); 00091 00092 if (tc_nenumerators != this->nenumerators_) 00093 return false; 00094 00095 for (CORBA::ULong i = 0; i < this->nenumerators_; ++i) 00096 { 00097 char const * const & lhs_enumerator = this->enumerators_[i]; 00098 00099 char const * const lhs_name = 00100 Traits<char const *>::get_string (lhs_enumerator); 00101 char const * const rhs_name = tc->member_name (i 00102 ); 00103 00104 if (ACE_OS::strcmp (lhs_name, rhs_name) != 0) 00105 return false; 00106 } 00107 00108 return true; 00109 }
CORBA::Boolean TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::equivalent_i | ( | CORBA::TypeCode_ptr | tc | ) | const [protected, virtual] |
Implements CORBA::TypeCode.
Definition at line 114 of file Enum_TypeCode_Static.cpp.
00117 { 00118 // Perform a structural comparison, excluding the name() and 00119 // member_name() operations. 00120 00121 CORBA::ULong const tc_nenumerators = 00122 tc->member_count (); 00123 00124 if (tc_nenumerators != this->nenumerators_) 00125 return false; 00126 00127 return true; 00128 }
CORBA::TypeCode_ptr TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::get_compact_typecode_i | ( | void | ) | const [protected, virtual] |
Implements CORBA::TypeCode.
Definition at line 133 of file Enum_TypeCode_Static.cpp.
References TAO_TypeCodeFactory_Adapter::create_enum_tc(), ACE_Dynamic_Service< TYPE >::instance(), and TAO_ORB_Core::typecodefactory_adapter_name().
00135 { 00136 ACE_Array_Base<CORBA::String_var> tc_enumerators (this->nenumerators_); 00137 00138 // Dynamically construct a new array of enumerators stripped of 00139 // member names. 00140 00141 static char const empty_name[] = ""; 00142 00143 for (CORBA::ULong i = 0; i < this->nenumerators_; ++i) 00144 { 00145 // Member names will be stripped, i.e. not embedded within 00146 // the compact TypeCode. 00147 00148 tc_enumerators[i] = empty_name; 00149 } 00150 00151 TAO_TypeCodeFactory_Adapter * adapter = 00152 ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( 00153 TAO_ORB_Core::typecodefactory_adapter_name ()); 00154 00155 if (adapter == 0) 00156 { 00157 throw ::CORBA::INTERNAL (); 00158 } 00159 00160 return 00161 adapter->create_enum_tc (this->base_attributes_.id (), 00162 "" /* empty name */, 00163 tc_enumerators, 00164 this->nenumerators_ 00165 ); 00166 }
char const * TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::id_i | ( | void | ) | const [protected, virtual] |
Reimplemented from CORBA::TypeCode.
Definition at line 171 of file Enum_TypeCode_Static.cpp.
References CORBA::TypeCode::id().
00173 { 00174 // Ownership is retained by the TypeCode, as required by the C++ 00175 // mapping. 00176 return this->base_attributes_.id (); 00177 }
CORBA::ULong TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::member_count_i | ( | void | ) | const [protected, virtual] |
Reimplemented from CORBA::TypeCode.
Definition at line 193 of file Enum_TypeCode_Static.cpp.
00195 { 00196 return this->nenumerators_; 00197 }
char const * TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::member_name_i | ( | CORBA::ULong | index | ) | const [protected, virtual] |
Reimplemented from CORBA::TypeCode.
Definition at line 202 of file Enum_TypeCode_Static.cpp.
00205 { 00206 // Ownership is retained by the TypeCode, as required by the C++ 00207 // mapping. 00208 if (index >= this->nenumerators_) 00209 throw ::CORBA::TypeCode::Bounds (); 00210 00211 return Traits<char const *>::get_string (this->enumerators_[index]); 00212 }
char const * TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::name_i | ( | void | ) | const [protected, virtual] |
Reimplemented from CORBA::TypeCode.
Definition at line 182 of file Enum_TypeCode_Static.cpp.
00184 { 00185 // Ownership is retained by the TypeCode, as required by the C++ 00186 // mapping. 00187 return this->base_attributes_.name (); 00188 }
void TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::tao_duplicate | ( | void | ) | [virtual] |
Increase the reference count on this TypeCode
.
Implements CORBA::TypeCode.
Definition at line 67 of file Enum_TypeCode_Static.cpp.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL bool TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::tao_marshal | ( | TAO_OutputCDR & | cdr, | |
CORBA::ULong | offset | |||
) | const [virtual] |
Marshal this TypeCode
into a CDR output stream.
Marshal this TypeCode
into the cdr output CDR stream, excluding the TypeCode
kind. Existing cdr contents will not be altered. The marshaled TypeCode
will be appended to the given cdr CDR output stream.
cdr | Output CDR stream into which the TypeCode will be marshaled. | |
offset | Number of bytes currently in the output CDR stream, including the top-level TypeCode TCKind . This argument is useful for recursive TypeCodes . TypeCodes that contain other TypeCodes should pass an updated offset value to the marshaling operation for those contained TypeCodes . |
true
if marshaling was successful.CORBA::TypeCode
interface.If this method returns false, the contents of the cdr output CDR stream are undefined.
Implements CORBA::TypeCode.
Definition at line 26 of file Enum_TypeCode_Static.cpp.
References ACE_OutputCDR::begin(), TAO_ENCAP_BYTE_ORDER, and ACE_OutputCDR::total_length().
00029 { 00030 // A tk_enum TypeCode has a "complex" parameter list type (see 00031 // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of 00032 // the CORBA specification), meaning that it must be marshaled into 00033 // a CDR encapsulation. 00034 00035 // Create a CDR encapsulation. 00036 TAO_OutputCDR enc; 00037 00038 bool const success = 00039 (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) 00040 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0)) 00041 && (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0)) 00042 && (enc << this->nenumerators_); 00043 00044 if (!success) 00045 return false; 00046 00047 char const * const * const begin = &this->enumerators_[0]; 00048 char const * const * const end = begin + this->nenumerators_; 00049 00050 for (char const * const * i = begin; i != end; ++i) 00051 { 00052 char const * const & enumerator = *i; 00053 00054 if (!(enc << TAO_OutputCDR::from_string ( 00055 Traits<char const *>::get_string (enumerator), 0))) 00056 return false; 00057 } 00058 00059 return 00060 cdr << static_cast<CORBA::ULong> (enc.total_length ()) 00061 && cdr.write_octet_array_mb (enc.begin ()); 00062 }
void TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::tao_release | ( | void | ) | [virtual] |
Decrease the reference count on this object.
Implements CORBA::TypeCode.
Definition at line 74 of file Enum_TypeCode_Static.cpp.
Base_Attributes<char const *> TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::base_attributes_ [private] |
Base attributes containing repository ID and name of structure type.
Definition at line 113 of file Enum_TypeCode_Static.h.
char const* const* const TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::enumerators_ [private] |
Array of TAO::TypeCode
enumerators representing enumerators in the OMG IDL defined enum
.
Definition at line 120 of file Enum_TypeCode_Static.h.
CORBA::ULong const TAO::TypeCode::Enum< char const *, char const *const *, TAO::Null_RefCount_Policy >::nenumerators_ [private] |
The number of enumerators in the OMG IDL enumeration.
Definition at line 116 of file Enum_TypeCode_Static.h.