00001 // $Id: String_TypeCode_Static.cpp 76995 2007-02-11 12:51:42Z johnnyw $ 00002 00003 #include "tao/AnyTypeCode/String_TypeCode_Static.h" 00004 #include "tao/CDR.h" 00005 #include "tao/SystemException.h" 00006 00007 #ifndef __ACE_INLINE__ 00008 # include "tao/AnyTypeCode/String_TypeCode_Static.inl" 00009 #endif /* !__ACE_INLINE__ */ 00010 00011 00012 ACE_RCSID (AnyTypeCode, 00013 String_TypeCode_Static, 00014 "$Id: String_TypeCode_Static.cpp 76995 2007-02-11 12:51:42Z johnnyw $") 00015 00016 00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00018 00019 bool 00020 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_marshal ( 00021 TAO_OutputCDR & cdr, 00022 CORBA::ULong) const 00023 { 00024 // A tk_string TypeCode has a "simple" parameter list type (see 00025 // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of 00026 // the CORBA specification), meaning that its parameter(s) must be 00027 // marshaled immediately following the TCKind. No CDR encapsulation 00028 // is to be created. 00029 00030 return (cdr << this->length_); 00031 } 00032 00033 void 00034 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_duplicate (void) 00035 { 00036 } 00037 00038 void 00039 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::tao_release (void) 00040 { 00041 } 00042 00043 CORBA::Boolean 00044 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::equal_i ( 00045 CORBA::TypeCode_ptr tc) const 00046 { 00047 // The following call won't throw since CORBA::TypeCode::equal() has 00048 // already established the kind of tc is the same as our kind. 00049 CORBA::ULong const tc_length = tc->length (); 00050 00051 return (this->length_ == tc_length); 00052 } 00053 00054 CORBA::Boolean 00055 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::equivalent_i ( 00056 CORBA::TypeCode_ptr tc 00057 ) const 00058 { 00059 // Since TCKind comparisons must be performed before equal_i() is 00060 // called, we can also call it to determine equivalence of 00061 // tk_string-based TypeCodes. 00062 return this->equal_i (tc); 00063 } 00064 00065 CORBA::TypeCode_ptr 00066 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::get_compact_typecode_i ( 00067 void) const 00068 { 00069 // Already compact since tk_string and tk_wstring TypeCodes have no 00070 // name or member names, meaning that we can simply call 00071 // _duplicate() on this TypeCode. 00072 00073 CORBA::TypeCode_ptr mutable_tc = 00074 const_cast<TAO::TypeCode::String<TAO::Null_RefCount_Policy> *> (this); 00075 00076 return CORBA::TypeCode::_duplicate (mutable_tc); 00077 } 00078 00079 CORBA::ULong 00080 TAO::TypeCode::String<TAO::Null_RefCount_Policy>::length_i ( 00081 void) const 00082 { 00083 return this->length_; 00084 } 00085 00086 TAO_END_VERSIONED_NAMESPACE_DECL