00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ACE_INTRUSIVE_AUTO_PTR_H
00016 #define ACE_INTRUSIVE_AUTO_PTR_H
00017
00018 #include "ace/pre.h"
00019
00020 #include "ace/Auto_Ptr.h"
00021 #include "ace/Atomic_Op.h"
00022
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif
00026
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028
00029
00030 template <class X> class ACE_Intrusive_Auto_Ptr;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 template <class X>
00050 class ACE_Intrusive_Auto_Ptr
00051 {
00052 protected:
00053
00054
00055 static void unspecified_bool(ACE_Intrusive_Auto_Ptr<X>***){};
00056 typedef void (*unspecified_bool_type)(ACE_Intrusive_Auto_Ptr<X>***);
00057
00058 public:
00059
00060
00061 operator unspecified_bool_type() const
00062 {
00063 return rep_ == 0 ? 0: unspecified_bool;
00064 }
00065
00066
00067
00068
00069
00070
00071 ACE_Intrusive_Auto_Ptr (X *p = 0, bool addref = true);
00072
00073
00074
00075
00076 ACE_Intrusive_Auto_Ptr (const ACE_Intrusive_Auto_Ptr<X> &r);
00077
00078
00079 template<class U> ACE_Intrusive_Auto_Ptr(const ACE_Intrusive_Auto_Ptr<U> & rhs);
00080
00081
00082
00083
00084 virtual ~ACE_Intrusive_Auto_Ptr (void);
00085
00086
00087
00088
00089 void operator = (const ACE_Intrusive_Auto_Ptr<X> &r);
00090
00091
00092 X *operator-> (void) const;
00093
00094
00095 X &operator *() const;
00096
00097
00098
00099 X *release (void);
00100
00101
00102
00103 void reset (X *p = 0);
00104
00105
00106 X *get (void) const;
00107
00108
00109 long count (void) const;
00110
00111
00112
00113
00114
00115 ACE_ALLOC_HOOK_DECLARE;
00116
00117 protected:
00118
00119
00120 X *rep_;
00121 };
00122
00123
00124
00125
00126
00127
00128
00129
00130 template<class T, class U>
00131 bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b);
00132
00133
00134 template<class T, class U>
00135 bool operator!=(ACE_Intrusive_Auto_Ptr<T> const & a, ACE_Intrusive_Auto_Ptr<U> const & b);
00136
00137 template<class T, class U>
00138 bool operator==(ACE_Intrusive_Auto_Ptr<T> const & a, U * b);
00139
00140 template<class T, class U>
00141 bool operator!=(ACE_Intrusive_Auto_Ptr<T> & a, U * b);
00142
00143 template<class T, class U>
00144 bool operator==(T * a, ACE_Intrusive_Auto_Ptr<U> const & b);
00145
00146 template<class T, class U>
00147 bool operator!=(T * a, ACE_Intrusive_Auto_Ptr<U> const & b);
00148
00149 ACE_END_VERSIONED_NAMESPACE_DECL
00150
00151 #if defined (__ACE_INLINE__)
00152 #include "ace/Intrusive_Auto_Ptr.inl"
00153 #endif
00154
00155 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00156 #include "ace/Intrusive_Auto_Ptr.cpp"
00157 #endif
00158
00159 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00160 #pragma implementation ("Intrusive_Auto_Ptr.cpp")
00161 #endif
00162
00163 #include "ace/post.h"
00164
00165 #endif