L4Re - L4 Runtime Environment
|
A reference-counting pointer with automatic cleanup. More...
Public Member Functions | |
Ref_ptr () throw () | |
Default constructor creates a pointer with no managed object. | |
Ref_ptr (Wp const &o) throw () | |
Create a shared pointer from a weak pointer. More... | |
Ref_ptr (decltype(nullptr) n) noexcept | |
allow creation from nullptr | |
template<typename X > | |
Ref_ptr (X *o) throw () | |
Create a shared pointer from a raw pointer. More... | |
Ref_ptr (T *o, bool d) throw () | |
Create a shared pointer from a raw pointer without creating a new reference. More... | |
T * | get () const throw () |
Return a raw pointer to the object this shared pointer points to. More... | |
T * | ptr () const throw () |
Return a raw pointer to the object this shared pointer points to. More... | |
T * | release () throw () |
Release the shared pointer without removing the reference. More... | |
A reference-counting pointer with automatic cleanup.
T | Type of object the pointer points to. |
CNT | Type of management class that manages the life time of the object. |
This pointer is similar to the standard C++-11 shared_ptr but it does the reference counting directly in the object being pointed to, so that no additional management structures need to be allocated from the heap.
Classes that use this pointer type must implement two functions:
int remove_ref()
is called when a reference is removed and must return 0 when there are no further references to the object.
void add_ref()
is called when another ref_ptr to the object is created.
Ref_obj provides a simple implementation of this interface from which classes may inherit.
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
Return a raw pointer to the object this shared pointer points to.
This does not release the pointer or decrease the reference count.
Definition at line 145 of file ref_ptr.
Referenced by cxx::Ref_ptr< Mount_tree >::release().
|
inline |
Return a raw pointer to the object this shared pointer points to.
This does not release the pointer or decrease the reference count.
Definition at line 151 of file ref_ptr.
Referenced by cxx::Ref_ptr< Mount_tree >::release().
|
inline |
Release the shared pointer without removing the reference.
Definition at line 162 of file ref_ptr.
Referenced by cxx::Ref_ptr< Mount_tree >::release().