String_TypeCode.cpp

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

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