Fixed_TypeCode.cpp

Go to the documentation of this file.
00001 // $Id: Fixed_TypeCode.cpp 76727 2007-01-30 11:16:45Z johnnyw $
00002 
00003 #ifndef TAO_FIXED_TYPECODE_CPP
00004 #define TAO_FIXED_TYPECODE_CPP
00005 
00006 #include "tao/AnyTypeCode/Fixed_TypeCode.h"
00007 #include "tao/CDR.h"
00008 
00009 #ifndef __ACE_INLINE__
00010 # include "tao/AnyTypeCode/Fixed_TypeCode.inl"
00011 #endif  /* !__ACE_INLINE__ */
00012 
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014 
00015 template <class RefCountPolicy>
00016 bool
00017 TAO::TypeCode::Fixed<RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
00018                                                    CORBA::ULong) const
00019 {
00020   // A tk_fixed 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->digits_) && (cdr << this->scale_);
00027 }
00028 
00029 template <class RefCountPolicy>
00030 void
00031 TAO::TypeCode::Fixed<RefCountPolicy>::tao_duplicate (void)
00032 {
00033   this->RefCountPolicy::add_ref ();
00034 }
00035 
00036 template <class RefCountPolicy>
00037 void
00038 TAO::TypeCode::Fixed<RefCountPolicy>::tao_release (void)
00039 {
00040   this->RefCountPolicy::remove_ref ();
00041 }
00042 
00043 template <class RefCountPolicy>
00044 CORBA::Boolean
00045 TAO::TypeCode::Fixed<RefCountPolicy>::equal_i (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::UShort const tc_digits = tc->fixed_digits ();
00050 
00051   CORBA::UShort const tc_scale = tc->fixed_scale ();
00052 
00053   return (this->digits_ == tc_digits
00054           && this->scale_ == tc_scale);
00055 }
00056 
00057 template <class RefCountPolicy>
00058 CORBA::Boolean
00059 TAO::TypeCode::Fixed<RefCountPolicy>::equivalent_i (CORBA::TypeCode_ptr tc) const
00060 {
00061   // Since TCKind comparisons must be performed before equal_i() is
00062   // called, we can also call it to determine equivalence of
00063   // tk_fixed TypeCodes.
00064   return this->equal_i (tc);
00065 }
00066 
00067 template <class RefCountPolicy>
00068 CORBA::TypeCode_ptr
00069 TAO::TypeCode::Fixed<RefCountPolicy>::get_compact_typecode_i (void) const
00070 {
00071   // Already compact since tk_fixed TypeCodes have no name or member
00072   // names, meaning that we can simply call _duplicate() on this
00073   // TypeCode.
00074 
00075 
00076   // @@ There is a potential problem here if this TypeCode is a static
00077   //    and const since it may have been placed in read-only memory by
00078   //    the compiler.  A const_cast<> can return undefined results in
00079   //    that case.
00080 
00081   CORBA::TypeCode_ptr mutable_tc =
00082     const_cast<TAO::TypeCode::Fixed<RefCountPolicy> *> (this);
00083 
00084   return CORBA::TypeCode::_duplicate (mutable_tc);
00085 }
00086 
00087 template <class RefCountPolicy>
00088 CORBA::UShort
00089 TAO::TypeCode::Fixed<RefCountPolicy>::fixed_digits_i (void) const
00090 {
00091   return this->digits_;
00092 }
00093 
00094 template <class RefCountPolicy>
00095 CORBA::UShort
00096 TAO::TypeCode::Fixed<RefCountPolicy>::fixed_scale_i (void) const
00097 {
00098   return this->scale_;
00099 }
00100 
00101 TAO_END_VERSIONED_NAMESPACE_DECL
00102 
00103 #endif  /* TAO_FIXED_TYPECODE_CPP */

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