Go to the documentation of this file.00001
00002
00003 #ifndef TAO_OBJREF_TYPECODE_CPP
00004 #define TAO_OBJREF_TYPECODE_CPP
00005
00006 #include "tao/AnyTypeCode/Objref_TypeCode.h"
00007
00008 #ifndef __ACE_INLINE__
00009 # include "tao/AnyTypeCode/Objref_TypeCode.inl"
00010 #endif
00011
00012 #include "tao/CDR.h"
00013 #include "tao/ORB_Core.h"
00014 #include "tao/TypeCodeFactory_Adapter.h"
00015
00016 #include "ace/OS_NS_string.h"
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 template <typename StringType, class RefCountPolicy>
00021 bool
00022 TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_marshal (
00023 TAO_OutputCDR & cdr,
00024 CORBA::ULong) const
00025 {
00026
00027
00028
00029
00030
00031
00032 TAO_OutputCDR enc;
00033
00034 return
00035 enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
00036 && enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
00037 && enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
00038 && cdr << static_cast<CORBA::ULong> (enc.total_length ())
00039 && cdr.write_octet_array_mb (enc.begin ());
00040 }
00041
00042 template <typename StringType, class RefCountPolicy>
00043 void
00044 TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_duplicate (void)
00045 {
00046 this->RefCountPolicy::add_ref ();
00047 }
00048
00049 template <typename StringType, class RefCountPolicy>
00050 void
00051 TAO::TypeCode::Objref<StringType, RefCountPolicy>::tao_release (void)
00052 {
00053 this->RefCountPolicy::remove_ref ();
00054 }
00055
00056 template <typename StringType, class RefCountPolicy>
00057 CORBA::Boolean
00058 TAO::TypeCode::Objref<StringType, RefCountPolicy>::equal_i (
00059 CORBA::TypeCode_ptr ) const
00060 {
00061
00062
00063
00064 return true;
00065 }
00066
00067 template <typename StringType, class RefCountPolicy>
00068 CORBA::Boolean
00069 TAO::TypeCode::Objref<StringType, RefCountPolicy>::equivalent_i (
00070 CORBA::TypeCode_ptr) const
00071 {
00072
00073
00074
00075 return true;
00076 }
00077
00078 template <typename StringType, class RefCountPolicy>
00079 CORBA::TypeCode_ptr
00080 TAO::TypeCode::Objref<StringType,
00081 RefCountPolicy>::get_compact_typecode_i (void) const
00082 {
00083 TAO_TypeCodeFactory_Adapter * const adapter =
00084 ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
00085 TAO_ORB_Core::typecodefactory_adapter_name ()
00086 );
00087
00088 if (adapter == 0)
00089 {
00090 throw ::CORBA::INTERNAL ();
00091 }
00092
00093 if (this->kind_ == CORBA::tk_abstract_interface)
00094 {
00095 return adapter->create_abstract_interface_tc (this->attributes_.id (),
00096 "" );
00097 }
00098 else if (this->kind_ == CORBA::tk_component)
00099 {
00100 return adapter->create_component_tc (this->attributes_.id (),
00101 "" );
00102 }
00103 else if (this->kind_ == CORBA::tk_home)
00104 {
00105 return adapter->create_home_tc (this->attributes_.id (),
00106 "" );
00107 }
00108 else if (this->kind_ == CORBA::tk_local_interface)
00109 {
00110 return adapter->create_local_interface_tc (this->attributes_.id (),
00111 "" );
00112
00113 }
00114 else if (this->kind_ == CORBA::tk_native)
00115 {
00116 return adapter->create_native_tc (this->attributes_.id (),
00117 "" );
00118 }
00119 else
00120 {
00121 return adapter->create_interface_tc (this->attributes_.id (),
00122 "" );
00123 }
00124 }
00125
00126 template <typename StringType, class RefCountPolicy>
00127 char const *
00128 TAO::TypeCode::Objref<StringType, RefCountPolicy>::id_i (void) const
00129 {
00130
00131
00132 return this->attributes_.id ();
00133 }
00134
00135 template <typename StringType, class RefCountPolicy>
00136 char const *
00137 TAO::TypeCode::Objref<StringType, RefCountPolicy>::name_i (void) const
00138 {
00139
00140
00141 return this->attributes_.name ();
00142 }
00143
00144 TAO_END_VERSIONED_NAMESPACE_DECL
00145
00146 #endif