Go to the documentation of this file.00001
00002
00003 #ifndef TAO_TYPECODE_CASE_ENUM_T_CPP
00004 #define TAO_TYPECODE_CASE_ENUM_T_CPP
00005
00006 #include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h"
00007 #include "TypeCode_Case_T.h"
00008
00009 #include "tao/CDR.h"
00010 #include "tao/AnyTypeCode/Any.h"
00011
00012 #ifndef __ACE_INLINE__
00013 # include "tao/AnyTypeCode/TypeCode_Case_Enum_T.inl"
00014 #endif
00015
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018
00019
00020
00021 template <typename StringType,
00022 typename TypeCodeType>
00023 TAO::TypeCode::Case<StringType, TypeCodeType> *
00024 TAO::TypeCode::Case_Enum_T<StringType,
00025 TypeCodeType>::clone (void) const
00026 {
00027 Case<StringType, TypeCodeType> * p = 0;
00028
00029 typedef Case_Enum_T<StringType,
00030 TypeCodeType> case_type;
00031
00032
00033 ACE_NEW_RETURN (p,
00034 case_type (*this),
00035 p);
00036
00037 return p;
00038 }
00039
00040 template <typename StringType,
00041 typename TypeCodeType>
00042 bool
00043 TAO::TypeCode::Case_Enum_T<StringType,
00044 TypeCodeType>::marshal_label (TAO_OutputCDR & cdr) const
00045 {
00046 return
00047 (cdr << this->label_);
00048 }
00049
00050 template <typename StringType,
00051 typename TypeCodeType>
00052 bool
00053 TAO::TypeCode::Case_Enum_T<StringType,
00054 TypeCodeType>::equal_label (::CORBA::ULong index,
00055 ::CORBA::TypeCode_ptr tc
00056 ) const
00057 {
00058 CORBA::Any_var any = tc->member_label (index);
00059 TAO_OutputCDR out_cdr;
00060
00061 if (! any->impl ()->marshal_value (out_cdr))
00062 {
00063 return false;
00064 }
00065
00066 TAO_InputCDR in_cdr (out_cdr);
00067 CORBA::ULong tc_label = ACE_UINT32_MAX;
00068
00069 if (! in_cdr.read_ulong (tc_label))
00070 {
00071 return false;
00072 }
00073
00074 return (this->label_ == tc_label);
00075 }
00076
00077 template <typename StringType,
00078 typename TypeCodeType>
00079 CORBA::Any *
00080 TAO::TypeCode::Case_Enum_T<StringType,
00081 TypeCodeType>::label (void) const
00082 {
00083 TAO_OutputCDR out_cdr;
00084
00085 out_cdr.write_ulong (this->label_);
00086
00087 CORBA::Any *retval = 0;
00088 ACE_NEW_THROW_EX (retval,
00089 CORBA::Any,
00090 CORBA::NO_MEMORY ());
00091
00092 TAO_InputCDR in_cdr (out_cdr);
00093 TAO::Unknown_IDL_Type *unk = 0;
00094 ACE_NEW_THROW_EX (unk,
00095 TAO::Unknown_IDL_Type (this->discriminator_tc_.in (),
00096 in_cdr),
00097 CORBA::NO_MEMORY ());
00098
00099 CORBA::Any_var safe_value (retval);
00100
00101 retval->replace (unk);
00102
00103 return safe_value._retn ();
00104 }
00105
00106 TAO_END_VERSIONED_NAMESPACE_DECL
00107
00108 #endif