00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file TypeCode_Case_Enum_T.h 00006 * 00007 * $Id: TypeCode_Case_Enum_T.h 76551 2007-01-24 13:42:44Z johnnyw $ 00008 * 00009 * Header file for @c TAO::TypeCode::Case_T template. 00010 * 00011 * @author Ossama Othman 00012 */ 00013 //============================================================================= 00014 00015 #ifndef TAO_TYPECODE_CASE_ENUM_T_H 00016 #define TAO_TYPECODE_CASE_ENUM_T_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "ace/config-all.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include "tao/AnyTypeCode/TypeCode_Case_Base_T.h" 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 namespace TAO 00031 { 00032 namespace TypeCode 00033 { 00034 /** 00035 * @class Case_Enum_T 00036 * 00037 * @brief Representation of an OMG IDL defined @c union @c case for 00038 * unions with Enum discriminators. 00039 * 00040 * When dynamically creating a union type with a enum 00041 * discriminator, there is not way that the template 00042 * parameter DiscriminatorType can be specified at runtime. 00043 * 00044 * Since enums are encoded as ULongs, DiscriminatorType has 00045 * been replaced with CORBA::ULong. 00046 */ 00047 template <typename StringType, 00048 typename TypeCodeType> 00049 class Case_Enum_T : public Case<StringType, TypeCodeType> 00050 { 00051 public: 00052 00053 /// Constructor. 00054 Case_Enum_T (CORBA::TypeCode_ptr discriminator_tc, 00055 CORBA::ULong member_label, 00056 char const * member_name, 00057 TypeCodeType member_type); 00058 00059 /// Constructor. 00060 /** 00061 * Constructor only used in the dynamically constructed @c union 00062 * @c TypeCode case. 00063 */ 00064 Case_Enum_T (CORBA::TypeCode_ptr discriminator_tc, 00065 CORBA::ULong member_label); 00066 00067 /** 00068 * @name @c TAO::TypeCode::Case Methods 00069 * 00070 * Methods required by the @c TAO::TypeCode::Case abstract base 00071 * class. 00072 * 00073 * @see @c TAO::TypeCode::Case 00074 */ 00075 //@{ 00076 Case<StringType, TypeCodeType> * clone (void) const; 00077 virtual CORBA::Any * label (void) const; 00078 virtual bool marshal_label (TAO_OutputCDR & cdr) const; 00079 virtual bool equal_label (CORBA::ULong index, 00080 CORBA::TypeCode_ptr tc 00081 ) const; 00082 //@} 00083 00084 private: 00085 00086 /// IDL @c union case/member label value. 00087 ::CORBA::ULong const label_; 00088 00089 /// IDL @c union discriminator typecode. 00090 CORBA::TypeCode_var discriminator_tc_; 00091 }; 00092 00093 } // End namespace TypeCode 00094 } // End namespace TAO 00095 00096 TAO_END_VERSIONED_NAMESPACE_DECL 00097 00098 00099 #ifdef __ACE_INLINE__ 00100 # include "tao/AnyTypeCode/TypeCode_Case_Enum_T.inl" 00101 #endif /* __ACE_INLINE__ */ 00102 00103 #ifdef ACE_TEMPLATES_REQUIRE_SOURCE 00104 # include "tao/AnyTypeCode/TypeCode_Case_Enum_T.cpp" 00105 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00106 00107 #ifdef ACE_TEMPLATES_REQUIRE_PRAGMA 00108 # pragma implementation ("TypeCode_Case_Enum_T.cpp") 00109 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00110 00111 #include /**/ "ace/post.h" 00112 00113 #endif /* TAO_TYPECODE_CASE_T_H */