Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Object.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: Object.i,v 1.1.1.4 2003/02/21 18:36:45 chad Exp $
00004 
00005 // ****************************************************************
00006 
00007 ACE_INLINE
00008 CORBA_Object::CORBA_Object (int)
00009   : is_collocated_ (0),
00010     servant_ (0),
00011     is_local_ (1),
00012     proxy_broker_ (0),
00013     protocol_proxy_ (0),
00014     refcount_ (1),
00015     refcount_lock_ (0)
00016 {
00017 }
00018 
00019 ACE_INLINE CORBA::Object_ptr
00020 CORBA_Object::_duplicate (CORBA::Object_ptr obj)
00021 {
00022   if (obj)
00023     obj->_add_ref ();
00024   return obj;
00025 }
00026 
00027 // ************************************************************
00028 // These are in CORBA namespace
00029 
00030 ACE_INLINE void
00031 CORBA::release (CORBA::Object_ptr obj)
00032 {
00033   if (obj)
00034     obj->_remove_ref ();
00035 }
00036 
00037 ACE_INLINE CORBA::Boolean
00038 CORBA::is_nil (CORBA::Object_ptr obj)
00039 {
00040   if (obj == 0)
00041     {
00042       return 1;
00043     }
00044 
00045   return CORBA_Object::is_nil_i (obj);
00046 }
00047 
00048 // ************************************************************
00049 
00050 // Null pointers represent nil objects.
00051 
00052 ACE_INLINE CORBA::Object_ptr
00053 CORBA_Object::_nil (void)
00054 {
00055   return 0;
00056 }
00057 
00058 ACE_INLINE CORBA::Object_ptr
00059 CORBA_Object::_unchecked_narrow (CORBA::Object_ptr obj
00060                                  ACE_ENV_ARG_DECL_NOT_USED)
00061 {
00062   if (CORBA::is_nil (obj))
00063     return CORBA::Object::_nil ();
00064 
00065   if (obj->is_local_)
00066     return
00067       ACE_reinterpret_cast (CORBA::Object_ptr,
00068                             obj->_tao_QueryInterface
00069                             (ACE_reinterpret_cast (ptr_arith_t,
00070                                                    &CORBA::Object::_tao_class_id)));
00071   else
00072     return CORBA::Object::_duplicate (obj);
00073 }
00074 
00075 ACE_INLINE CORBA::Object_ptr
00076 CORBA_Object::_narrow (CORBA::Object_ptr obj
00077                        ACE_ENV_ARG_DECL)
00078 {
00079   return CORBA_Object::_unchecked_narrow (obj
00080                                           ACE_ENV_ARG_PARAMETER);
00081 }
00082 
00083 ACE_INLINE TAO_Stub *
00084 CORBA_Object::_stubobj (void) const
00085 {
00086   return this->protocol_proxy_;
00087 }
00088 
00089 // *************************************************************
00090 // Inline operations for class CORBA_Object_var
00091 // *************************************************************
00092 
00093 ACE_INLINE
00094 CORBA_Object_var::CORBA_Object_var (void)
00095   : ptr_ (CORBA_Object::_nil ())
00096 {
00097 }
00098 
00099 ACE_INLINE
00100 CORBA_Object_var::CORBA_Object_var (CORBA::Object_ptr p)
00101   : ptr_ (p)
00102 {
00103 }
00104 
00105 ACE_INLINE
00106 CORBA_Object_var::~CORBA_Object_var (void)
00107 {
00108   CORBA::release (this->ptr_);
00109 }
00110 
00111 ACE_INLINE CORBA::Object_ptr
00112 CORBA_Object_var::ptr (void) const
00113 {
00114   return this->ptr_;
00115 }
00116 
00117 ACE_INLINE
00118 CORBA_Object_var::CORBA_Object_var (const CORBA_Object_var &p)
00119   : ptr_ (CORBA_Object::_duplicate (p.ptr ()))
00120 {
00121 }
00122 
00123 ACE_INLINE CORBA_Object_var &
00124 CORBA_Object_var::operator= (CORBA::Object_ptr p)
00125 {
00126   CORBA::release (this->ptr_);
00127   this->ptr_ = p;
00128   return *this;
00129 }
00130 
00131 ACE_INLINE CORBA_Object_var &
00132 CORBA_Object_var::operator= (const CORBA_Object_var &p)
00133 {
00134   if (this != &p)
00135   {
00136     CORBA::release (this->ptr_);
00137     this->ptr_ = CORBA_Object::_duplicate (p.ptr ());
00138   }
00139   return *this;
00140 }
00141 
00142 ACE_INLINE
00143 CORBA_Object_var::operator const CORBA::Object_ptr &() const // cast
00144 {
00145   return this->ptr_;
00146 }
00147 
00148 ACE_INLINE
00149 CORBA_Object_var::operator CORBA::Object_ptr &() // cast
00150 {
00151   return this->ptr_;
00152 }
00153 
00154 ACE_INLINE CORBA::Object_ptr
00155 CORBA_Object_var::operator-> (void) const
00156 {
00157   return this->ptr_;
00158 }
00159 
00160 ACE_INLINE CORBA::Object_ptr
00161 CORBA_Object_var::in (void) const
00162 {
00163   return this->ptr_;
00164 }
00165 
00166 ACE_INLINE CORBA::Object_ptr &
00167 CORBA_Object_var::inout (void)
00168 {
00169   return this->ptr_;
00170 }
00171 
00172 ACE_INLINE CORBA::Object_ptr &
00173 CORBA_Object_var::out (void)
00174 {
00175   CORBA::release (this->ptr_);
00176   this->ptr_ = CORBA_Object::_nil ();
00177   return this->ptr_;
00178 }
00179 
00180 ACE_INLINE CORBA::Object_ptr
00181 CORBA_Object_var::_retn (void)
00182 {
00183   // yield ownership of managed obj reference
00184   CORBA::Object_ptr val = this->ptr_;
00185   this->ptr_ = CORBA_Object::_nil ();
00186   return val;
00187 }
00188 
00189 ACE_INLINE CORBA::Object_ptr
00190 CORBA_Object_var::tao_duplicate (CORBA::Object_ptr p)
00191 {
00192   return CORBA_Object::_duplicate (p);
00193 }
00194 
00195 ACE_INLINE void
00196 CORBA_Object_var::tao_release (CORBA::Object_ptr p)
00197 {
00198   CORBA::release (p);
00199 }
00200 
00201 ACE_INLINE CORBA::Object_ptr
00202 CORBA_Object_var::tao_nil (void)
00203 {
00204   return CORBA_Object::_nil ();
00205 }
00206 
00207 ACE_INLINE CORBA::Object_ptr
00208 CORBA_Object_var::tao_narrow (
00209     CORBA::Object *p
00210     ACE_ENV_ARG_DECL_NOT_USED
00211   )
00212 {
00213   return CORBA_Object::_duplicate (p);
00214 }
00215 
00216 ACE_INLINE CORBA::Object *
00217 CORBA_Object_var::tao_upcast (void *src)
00218 {
00219   CORBA_Object **tmp =
00220     ACE_static_cast (CORBA_Object **, src);
00221   return *tmp;
00222 }
00223 
00224 // *************************************************************
00225 // Inline operations for class CORBA_Object_out
00226 // *************************************************************
00227 
00228 ACE_INLINE
00229 CORBA_Object_out::CORBA_Object_out (CORBA::Object_ptr &p)
00230   : ptr_ (p)
00231 {
00232   this->ptr_ = CORBA_Object::_nil ();
00233 }
00234 
00235 ACE_INLINE
00236 CORBA_Object_out::CORBA_Object_out (CORBA_Object_var &p)
00237   : ptr_ (p.out ())
00238 {
00239   CORBA::release (this->ptr_);
00240   this->ptr_ = CORBA_Object::_nil ();
00241 }
00242 
00243 ACE_INLINE
00244 CORBA_Object_out::CORBA_Object_out (const CORBA_Object_out &p)
00245   : ptr_ (p.ptr_)
00246 {
00247 }
00248 
00249 ACE_INLINE CORBA_Object_out &
00250 CORBA_Object_out::operator= (const CORBA_Object_out &p)
00251 {
00252   this->ptr_ = p.ptr_;
00253   return *this;
00254 }
00255 
00256 ACE_INLINE CORBA_Object_out &
00257 CORBA_Object_out::operator= (const CORBA_Object_var &p)
00258 {
00259   this->ptr_ = CORBA_Object::_duplicate (p.ptr ());
00260   return *this;
00261 }
00262 
00263 ACE_INLINE CORBA_Object_out &
00264 CORBA_Object_out::operator= (CORBA::Object_ptr p)
00265 {
00266   this->ptr_ = p;
00267   return *this;
00268 }
00269 
00270 ACE_INLINE
00271 CORBA_Object_out::operator CORBA::Object_ptr &() // cast
00272 {
00273   return this->ptr_;
00274 }
00275 
00276 ACE_INLINE CORBA::Object_ptr &
00277 CORBA_Object_out::ptr (void) // ptr
00278 {
00279   return this->ptr_;
00280 }
00281 
00282 ACE_INLINE CORBA::Object_ptr
00283 CORBA_Object_out::operator-> (void)
00284 {
00285   return this->ptr_;
00286 }

Generated on Mon Jun 16 13:48:59 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002