Objref_TypeCode_Static.cpp

Go to the documentation of this file.
00001 // $Id: Objref_TypeCode_Static.cpp 76995 2007-02-11 12:51:42Z johnnyw $
00002 
00003 #include "tao/AnyTypeCode/Objref_TypeCode_Static.h"
00004 
00005 #ifndef __ACE_INLINE__
00006 # include "tao/AnyTypeCode/Objref_TypeCode_Static.inl"
00007 #endif  /* !__ACE_INLINE__ */
00008 
00009 #include "tao/CDR.h"
00010 #include "tao/TypeCodeFactory_Adapter.h"
00011 #include "tao/ORB_Core.h"
00012 #include "tao/SystemException.h"
00013 
00014 #include "ace/Dynamic_Service.h"
00015 #include "ace/OS_NS_string.h"
00016 
00017 
00018 ACE_RCSID (AnyTypeCode,
00019            Objref_TypeCode_Static,
00020            "$Id: Objref_TypeCode_Static.cpp 76995 2007-02-11 12:51:42Z johnnyw $")
00021 
00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 bool
00025 TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::tao_marshal (
00026   TAO_OutputCDR & cdr,
00027   CORBA::ULong) const
00028 {
00029   // A tk_objref TypeCode has a "complex" parameter list type (see
00030   // Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
00031   // the CORBA specification), meaning that it must be marshaled into
00032   // a CDR encapsulation.
00033 
00034   // Create a CDR encapsulation.
00035   TAO_OutputCDR enc;
00036 
00037   return
00038     enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
00039     && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
00040     && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
00041     && cdr << static_cast<CORBA::ULong> (enc.total_length ())
00042     && cdr.write_octet_array_mb (enc.begin ());
00043 }
00044 
00045 void
00046 TAO::TypeCode::Objref<char const *,
00047                       TAO::Null_RefCount_Policy>::tao_duplicate (void)
00048 {
00049 }
00050 
00051 void
00052 TAO::TypeCode::Objref<char const *,
00053                       TAO::Null_RefCount_Policy>::tao_release (void)
00054 {
00055 }
00056 
00057 CORBA::Boolean
00058 TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::equal_i (
00059   CORBA::TypeCode_ptr /* tc */) const
00060 {
00061   // Equality has already been established in the
00062   // CORBA::TypeCode base class.
00063 
00064   return true;
00065 }
00066 
00067 CORBA::Boolean
00068 TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::equivalent_i (
00069   CORBA::TypeCode_ptr) const
00070 {
00071   // Equivalence already verified in the base class
00072   // CORBA::TypeCode::equivalent() method.
00073 
00074   return true;
00075 }
00076 
00077 CORBA::TypeCode_ptr
00078 TAO::TypeCode::Objref<char const *,
00079                       TAO::Null_RefCount_Policy>::get_compact_typecode_i (
00080   void) const
00081 {
00082   TAO_TypeCodeFactory_Adapter * const adapter =
00083     ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
00084         TAO_ORB_Core::typecodefactory_adapter_name ()
00085       );
00086 
00087   if (adapter == 0)
00088     {
00089       throw ::CORBA::INTERNAL ();
00090     }
00091 
00092   if (this->kind_ == CORBA::tk_abstract_interface)
00093     {
00094       return adapter->create_abstract_interface_tc (this->attributes_.id (),
00095                                                     ""  /* empty name */);
00096     }
00097   else if (this->kind_ == CORBA::tk_component)
00098     {
00099       return adapter->create_component_tc (this->attributes_.id (),
00100                                            ""  /* empty name */);
00101     }
00102   else if (this->kind_ == CORBA::tk_home)
00103     {
00104       return adapter->create_home_tc (this->attributes_.id (),
00105                                       ""  /* empty name */);
00106     }
00107   else if (this->kind_ == CORBA::tk_local_interface)
00108     {
00109       return adapter->create_local_interface_tc (this->attributes_.id (),
00110                                                  ""  /* empty name */);
00111 
00112     }
00113   else if (this->kind_ == CORBA::tk_native)
00114     {
00115       return adapter->create_native_tc (this->attributes_.id (),
00116                                         ""  /* empty name */);
00117     }
00118   else // CORBA::tk_objref
00119     {
00120       return adapter->create_interface_tc (this->attributes_.id (),
00121                                            ""  /* empty name */);
00122     }
00123 }
00124 
00125 char const *
00126 TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::id_i (
00127   void) const
00128 {
00129   // Ownership is retained by the TypeCode, as required by the C++
00130   // mapping.
00131   return this->attributes_.id ();
00132 }
00133 
00134 char const *
00135 TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::name_i (
00136   void) const
00137 {
00138   // Ownership is retained by the TypeCode, as required by the C++
00139   // mapping.
00140   return this->attributes_.name ();
00141 }
00142 
00143 TAO_END_VERSIONED_NAMESPACE_DECL

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