62 #if defined(SHARED_FROM_MANUAL) 65 #elif __cplusplus>=201103L || (defined(_MSC_VER) && (_MSC_VER>=1600)) || defined(_LIBCPP_VERSION) 68 # define SHARED_FROM_STD 70 #elif defined(__GNUC__) && __GNUC__>=4 && !defined(vxWorks) 72 # define SHARED_FROM_TR1 74 #elif defined(_MSC_VER) && _MSC_VER==1500 78 # define SHARED_TR1_FROM_STD 80 #elif defined(_MSC_VER) && (_MSC_VER>1500 || defined(_HAS_TR1)) 82 # define SHARED_FROM_TR1 85 # define SHARED_FROM_BOOST 90 #if defined(SHARED_FROM_MANUAL) 92 #elif defined(SHARED_FROM_STD) 96 #ifndef DEBUG_SHARED_PTR 100 using ::std::shared_ptr;
101 using ::std::weak_ptr;
105 using ::std::enable_shared_from_this;
106 using ::std::bad_weak_ptr;
110 #else // DEBUG_SHARED_PTR 116 using ::epics::debug::shared_ptr;
117 using ::epics::debug::weak_ptr;
121 using ::epics::debug::enable_shared_from_this;
122 using ::std::bad_weak_ptr;
127 #endif // DEBUG_SHARED_PTR 129 #elif defined(SHARED_TR1_FROM_STD) 132 #elif defined(SHARED_FROM_TR1) 133 # include <tr1/memory> 135 #elif defined(SHARED_FROM_BOOST) 137 #if defined(__GNUC__) && __GNUC__ < 3 138 #define BOOST_EXCEPTION_DISABLE 139 #define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION 145 # error No shared_ptr selection 150 #ifdef SHARED_FROM_STD 151 # undef SHARED_FROM_STD 154 #ifdef SHARED_FROM_TR1 155 # undef SHARED_FROM_TR1 158 #ifdef SHARED_FROM_BOOST 159 # undef SHARED_FROM_BOOST 165 const std::tr1::shared_ptr<T>&
ptr;
167 ref_shower(
const std::tr1::shared_ptr<T>& ptr,
bool self,
bool weak) :ptr(ptr),self(self),weak(weak) {}
182 inline ::detail::ref_shower<T>
show_referrers(
const std::tr1::shared_ptr<T>& ptr,
bool self=
true,
bool weak=
false)
184 return ::detail::ref_shower<T>(ptr,
self, weak);
189 inline std::ostream& operator<<(std::ostream& strm, const ::detail::ref_shower<T>& refs)
191 #ifdef HAVE_SHOW_REFS 192 refs.ptr.show_refs(strm, refs.self, refs.weak);
193 #endif // HAVE_SHOW_REFS 198 #define POINTER_DEFINITIONS(clazz) \ 199 typedef std::tr1::shared_ptr<clazz> shared_pointer; \ 200 typedef std::tr1::shared_ptr<const clazz> const_shared_pointer; \ 201 typedef std::tr1::weak_ptr<clazz> weak_pointer; \ 202 typedef std::tr1::weak_ptr<const clazz> const_weak_pointer 218 #if __cplusplus>=201103L 220 using auto_ptr = std::unique_ptr<T>;
222 static inline void swap(auto_ptr<T>& lhs, auto_ptr<T>& rhs) {
228 static inline void swap(auto_ptr<T>& lhs, auto_ptr<T>& rhs) {
229 auto_ptr<T> temp(lhs);
236 #endif // SHAREDPTR_H
const std::tr1::shared_ptr< T > & ptr
ref_shower(const std::tr1::shared_ptr< T > &ptr, bool self, bool weak)
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
TODO only here because of the Lockable.
inline::detail::ref_shower< T > show_referrers(const std::tr1::shared_ptr< T > &ptr, bool self=true, bool weak=false)
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
shared_ptr< T > const_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT