00001 // -*- C++ -*- 00002 // 00003 // Cache_Entries.inl,v 1.19 2005/11/02 07:13:02 ossama Exp 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 namespace TAO 00008 { 00009 ACE_INLINE 00010 Cache_IntId::Cache_IntId (void) 00011 : transport_ (0), 00012 recycle_state_ (ENTRY_UNKNOWN) 00013 { 00014 } 00015 00016 ACE_INLINE 00017 Cache_IntId::Cache_IntId (const Cache_IntId &rhs) 00018 : transport_ (0), 00019 recycle_state_ (ENTRY_UNKNOWN) 00020 { 00021 *this = rhs; 00022 } 00023 00024 ACE_INLINE bool 00025 Cache_IntId::operator== (const Cache_IntId &rhs) const 00026 { 00027 return (this->transport_ == rhs.transport_); 00028 } 00029 00030 ACE_INLINE bool 00031 Cache_IntId::operator!= (const Cache_IntId &rhs) const 00032 { 00033 return (this->transport_ != rhs.transport_); 00034 } 00035 00036 ACE_INLINE TAO_Transport * 00037 Cache_IntId::transport (void) 00038 { 00039 return this->transport_; 00040 } 00041 00042 ACE_INLINE const TAO_Transport * 00043 Cache_IntId::transport (void) const 00044 { 00045 return this->transport_; 00046 } 00047 00048 ACE_INLINE void 00049 Cache_IntId::recycle_state (Cache_Entries_State st) 00050 { 00051 this->recycle_state_ = st; 00052 } 00053 00054 ACE_INLINE Cache_Entries_State 00055 Cache_IntId::recycle_state (void) 00056 { 00057 return this->recycle_state_; 00058 } 00059 00060 ACE_INLINE TAO_Transport * 00061 Cache_IntId::relinquish_transport (void) 00062 { 00063 // Yield ownership of the TAO_Transport object. 00064 TAO_Transport *val = this->transport_; 00065 this->transport_ = 0; 00066 return val; 00067 } 00068 00069 /*******************************************************/ 00070 ACE_INLINE 00071 Cache_ExtId::Cache_ExtId (void) 00072 : transport_property_ (0), 00073 is_delete_ (0), 00074 index_ (0) 00075 { 00076 } 00077 00078 ACE_INLINE 00079 Cache_ExtId::Cache_ExtId (TAO_Transport_Descriptor_Interface *prop) 00080 : transport_property_ (prop), 00081 is_delete_ (0), 00082 index_ (0) 00083 { 00084 00085 } 00086 00087 ACE_INLINE 00088 Cache_ExtId::~Cache_ExtId (void) 00089 { 00090 if (this->is_delete_) 00091 delete this->transport_property_; 00092 } 00093 00094 ACE_INLINE Cache_ExtId & 00095 Cache_ExtId::operator= (const Cache_ExtId &rhs) 00096 { 00097 if (this != &rhs) 00098 { 00099 // Do a deep copy 00100 this->transport_property_ = 00101 rhs.transport_property_->duplicate (); 00102 00103 if (this->transport_property_ == 0) 00104 { 00105 this->is_delete_ = 0; 00106 this->index_ = 0; 00107 } 00108 else 00109 { 00110 this->is_delete_ = 1; 00111 this->index_ = rhs.index_; 00112 } 00113 } 00114 return *this; 00115 } 00116 00117 ACE_INLINE 00118 Cache_ExtId::Cache_ExtId (const Cache_ExtId &rhs) 00119 : transport_property_ (0), 00120 is_delete_ (0), 00121 index_ (0) 00122 { 00123 *this = rhs; 00124 } 00125 00126 ACE_INLINE bool 00127 Cache_ExtId::operator== (const Cache_ExtId &rhs) const 00128 { 00129 return (this->transport_property_->is_equivalent (rhs.transport_property_) && 00130 this->index_ == rhs.index_); 00131 } 00132 00133 ACE_INLINE bool 00134 Cache_ExtId::operator!= (const Cache_ExtId &rhs) const 00135 { 00136 if (this->transport_property_->is_equivalent (rhs.transport_property_) && 00137 this->index_ == rhs.index_) 00138 return false; 00139 00140 return true; 00141 } 00142 00143 ACE_INLINE u_long 00144 Cache_ExtId::hash (void) const 00145 { 00146 return (this->transport_property_->hash () + this->index_); 00147 } 00148 00149 ACE_INLINE void 00150 Cache_ExtId::duplicate (void) 00151 { 00152 TAO_Transport_Descriptor_Interface *prop = 0; 00153 00154 // Make a deep copy 00155 prop = this->transport_property_->duplicate (); 00156 00157 if (prop == 0) 00158 return; 00159 00160 // Release memory if there was some allocated in the first place 00161 if (this->is_delete_) 00162 delete this->transport_property_; 00163 00164 this->is_delete_ = 1; 00165 this->transport_property_ = prop; 00166 } 00167 00168 00169 ACE_INLINE CORBA::ULong 00170 Cache_ExtId::index (void) const 00171 { 00172 return this->index_; 00173 } 00174 00175 00176 ACE_INLINE void 00177 Cache_ExtId::index (CORBA::ULong index) 00178 { 00179 this->index_ = index; 00180 } 00181 00182 ACE_INLINE void 00183 Cache_ExtId::incr_index (void) 00184 { 00185 ++this->index_; 00186 } 00187 00188 ACE_INLINE TAO_Transport_Descriptor_Interface * 00189 Cache_ExtId::property (void) const 00190 { 00191 return this->transport_property_; 00192 } 00193 } 00194 00195 TAO_END_VERSIONED_NAMESPACE_DECL