00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file ORB_Core_Auto_Ptr.h 00006 * 00007 * $Id: ORB_Core_Auto_Ptr.h 74014 2006-08-14 13:52:22Z johnnyw $ 00008 * 00009 * @author DOC Center - Washington University at St. Louis 00010 * @author DOC Laboratory - University of California at Irvine 00011 */ 00012 // =================================================================== 00013 00014 #ifndef TAO_ORB_CORE_AUTO_PTR_H 00015 #define TAO_ORB_CORE_AUTO_PTR_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include /**/ "tao/TAO_Export.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include /**/ "tao/Versioned_Namespace.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 class TAO_ORB_Core; 00030 00031 /** 00032 * @class TAO_ORB_Core_Auto_Ptr 00033 * 00034 * @brief Define a TAO_ORB_Core auto_ptr class. 00035 * 00036 * This class is used as an aid to make ORB initialization exception 00037 * safe. It ensures that the ORB core is deallocated through its 00038 * reference counting mechanism if an exception is thrown. 00039 */ 00040 class TAO_Export TAO_ORB_Core_Auto_Ptr 00041 { 00042 public: 00043 00044 /** 00045 * @name Initialization and termination methods 00046 */ 00047 //@{ 00048 explicit TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core *p = 0); 00049 TAO_ORB_Core_Auto_Ptr (TAO_ORB_Core_Auto_Ptr &ap); 00050 TAO_ORB_Core_Auto_Ptr &operator= (TAO_ORB_Core_Auto_Ptr &rhs); 00051 ~TAO_ORB_Core_Auto_Ptr (void); 00052 //@} 00053 00054 /** 00055 * @name Accessor methods. 00056 */ 00057 //@{ 00058 TAO_ORB_Core &operator *() const; 00059 TAO_ORB_Core *get (void) const; 00060 TAO_ORB_Core *release (void); 00061 void reset (TAO_ORB_Core *p = 0); 00062 TAO_ORB_Core *operator-> () const; 00063 //@} 00064 00065 protected: 00066 00067 TAO_ORB_Core *p_; 00068 00069 }; 00070 00071 TAO_END_VERSIONED_NAMESPACE_DECL 00072 00073 #if defined (__ACE_INLINE__) 00074 # include "tao/ORB_Core_Auto_Ptr.inl" 00075 #endif /* __ACE_INLINE__ */ 00076 00077 #include /**/ "ace/post.h" 00078 00079 #endif /* TAO_ORB_CORE_AUTO_PTR_H */