TypeCode_Case_Base_T.cpp

Go to the documentation of this file.
00001 // $Id: TypeCode_Case_Base_T.cpp 77590 2007-03-07 14:07:57Z johnnyw $
00002 
00003 #ifndef TAO_TYPECODE_CASE_CPP
00004 #define TAO_TYPECODE_CASE_CPP
00005 
00006 #include "tao/AnyTypeCode/TypeCode_Case_Base_T.h"
00007 #include "ace/OS_NS_string.h"
00008 
00009 #ifndef __ACE_INLINE__
00010 # include "tao/AnyTypeCode/TypeCode_Case_Base_T.inl"
00011 #endif /* __ACE_INLINE__ */
00012 
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014 
00015 template <typename StringType, typename TypeCodeType>
00016 TAO::TypeCode::Case<StringType, TypeCodeType>::~Case (void)
00017 {
00018 }
00019 
00020 template <typename StringType, typename TypeCodeType>
00021 bool
00022 TAO::TypeCode::Case<StringType, TypeCodeType>::equal (CORBA::ULong index,
00023                                                       CORBA::TypeCode_ptr tc
00024                                                       ) const
00025 {
00026   // Check case names.
00027   char const * const lhs_name = this->name ();
00028   char const * const rhs_name = tc->member_name (index
00029                                                 );
00030 
00031   if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
00032     return false;
00033 
00034   // Check case TypeCodes.
00035   CORBA::TypeCode_ptr const lhs_tc = this->type ();
00036   CORBA::TypeCode_var const rhs_tc =
00037     tc->member_type (index
00038                     );
00039 
00040   CORBA::Boolean const equal_members =
00041     lhs_tc->equal (rhs_tc.in ()
00042                   );
00043 
00044   if (!equal_members)
00045     return false;
00046 
00047   // Check case label.
00048   return this->equal_label (index,
00049                             tc
00050                            );
00051 }
00052 
00053 template <typename StringType, typename TypeCodeType>
00054 bool
00055 TAO::TypeCode::Case<StringType, TypeCodeType>::equivalent (
00056   CORBA::ULong index,
00057   CORBA::TypeCode_ptr tc
00058   ) const
00059 {
00060   // Member names are ignore when determining equivalence.
00061 
00062   // Check case TypeCodes.
00063   CORBA::TypeCode_ptr const lhs_tc = this->type ();
00064   CORBA::TypeCode_var const rhs_tc =
00065     tc->member_type (index
00066                     );
00067 
00068   CORBA::Boolean const equivalent_members =
00069     lhs_tc->equivalent (rhs_tc.in ()
00070                        );
00071 
00072   if (!equivalent_members)
00073     return 0;
00074 
00075   // Check case label.
00076   // The label must be equal when determining equivalence, too.
00077   return this->equal_label (index,
00078                             tc
00079                            );
00080 }
00081 
00082 TAO_END_VERSIONED_NAMESPACE_DECL
00083 
00084 #endif  /* TAO_TYPECODE_CASE_CPP */

Generated on Sun Jan 27 13:21:07 2008 for TAO_AnyTypeCode by doxygen 1.3.6