1 #ifndef XAPIAN_INCLUDED_INTRUSIVE_PTR_H
2 #define XAPIAN_INCLUDED_INTRUSIVE_PTR_H
39 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
40 # error Never use <xapian/intrusive_ptr.h> directly; include <xapian.h> instead.
96 if(
px != 0 ) ++
px->_refs;
103 if(
px != 0 ) ++
px->_refs;
108 if(
px != 0 ) ++
px->_refs;
113 if(
px != 0 && --
px->_refs == 0 )
delete px;
176 explicit operator bool()
const
178 return px !=
nullptr;
188 return a.
get() == b.
get();
193 return a.
get() != b.
get();
250 if(
px && --
px->_refs == 0 )
delete px;
325 return a.
get() == b.
get();
330 return a.
get() != b.
get();
516 explicit operator bool()
const
518 return px !=
nullptr;
530 return a.
get() == b.
get();
535 return a.
get() != b.
get();
Compiler attribute macros.
#define XAPIAN_NONNULL(LIST)
Annotate function parameters which should be non-NULL pointers.
Base class for objects managed by intrusive_ptr.
intrusive_base()
Construct with no references.
void operator=(const intrusive_base &)
Prevent assignment.
intrusive_base(const intrusive_base &)
Prevent copying.
unsigned _refs
Reference count.
A normally non-NULL smart pointer using intrusive reference counting.
intrusive_ptr_nonnull(intrusive_ptr_nonnull< U > &&rhs)
intrusive_ptr_nonnull & operator=(intrusive_ptr_nonnull &&rhs)
void swap(intrusive_ptr_nonnull &rhs)
intrusive_ptr_nonnull & operator=(T *rhs) XAPIAN_NONNULL()
intrusive_ptr_nonnull(intrusive_ptr_nonnull< U > const &rhs)
intrusive_ptr_nonnull(T *p) XAPIAN_NONNULL()
intrusive_ptr_nonnull this_type
intrusive_ptr_nonnull(intrusive_ptr_nonnull &&rhs)
intrusive_ptr_nonnull & operator=(intrusive_ptr_nonnull< U > &&rhs)
intrusive_ptr_nonnull(intrusive_ptr_nonnull const &rhs)
intrusive_ptr_nonnull & operator=(intrusive_ptr_nonnull const &rhs)
A smart pointer that uses intrusive reference counting.
intrusive_ptr(intrusive_ptr< U > const &rhs)
intrusive_ptr(intrusive_ptr const &rhs)
intrusive_ptr(intrusive_ptr< U > &&rhs)
intrusive_ptr & operator=(intrusive_ptr< U > &&rhs)
intrusive_ptr(intrusive_ptr &&rhs)
intrusive_ptr & operator=(intrusive_ptr &&rhs)
intrusive_ptr & operator=(intrusive_ptr const &rhs)
intrusive_ptr & operator=(T *rhs)
void swap(intrusive_ptr &rhs)
Base class for objects managed by opt_intrusive_ptr.
opt_intrusive_base()
Construct object which is initially not reference counted.
opt_intrusive_base & operator=(const opt_intrusive_base &)
void release() const
Start reference counting.
opt_intrusive_base(const opt_intrusive_base &)
unsigned _refs
Reference count.
virtual ~opt_intrusive_base()
A smart pointer that optionally uses intrusive reference counting.
opt_intrusive_ptr(opt_intrusive_ptr< U > const &rhs)
opt_intrusive_ptr & operator=(opt_intrusive_ptr const &rhs)
opt_intrusive_ptr this_type
opt_intrusive_ptr & operator=(opt_intrusive_ptr &&rhs)
opt_intrusive_ptr & operator=(opt_intrusive_ptr< U > &&rhs)
opt_intrusive_ptr(opt_intrusive_ptr &&rhs)
void swap(opt_intrusive_ptr &rhs)
opt_intrusive_ptr(opt_intrusive_ptr< U > &&rhs)
opt_intrusive_ptr(opt_intrusive_ptr const &rhs)
opt_intrusive_ptr & operator=(T *rhs)
bool operator!=(intrusive_ptr< T > const &a, intrusive_ptr< U > const &b)
bool operator==(intrusive_ptr< T > const &a, intrusive_ptr< U > const &b)
The Xapian namespace contains public interfaces for the Xapian library.
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT