template<typename RCImpl>
class openvpn::RC< RCImpl >
Reference count base class for objects tracked by RCPtr. Disallows copying and assignment.
Implements basic reference counting functionality for objects.
The purpose of RC is to provide a base class that other classes can inherit from to enable reference counting and automatic memory management. It takes a template parameter RCImpl which specifies the actual reference count implementation class that will be used, either thread_safe_refcount or thread_unsafe_refcount.
RC provides a common base class for enabling reference counting on other classes via inheritance. It delegates the actual reference count tracking to the RCImpl implementation specified as a template parameter. It also prohibits copy or assignment of the inheriting object.
The member functions just delegate to the refcount_ object that's injected via template.
- Template Parameters
-
Definition at line 911 of file rc.hpp.
template<typename RCImpl >
template<typename R >
void intrusive_ptr_add_ref |
( |
R * |
rcptr | ) |
|
|
friend |
Helper to increment a ref count.
- Template Parameters
-
R | type that has an incrementable member refcount_ |
- Parameters
-
rcptr | pointer to instance of R |
- Todo:
- consider removing debug cout
Helper function template to implement incrementing of a member 'refcount_' of a type R; acts as an adapter layer to implement this funtionality as well as some conditionally built debug logging.
Definition at line 1400 of file rc.hpp.
template<typename RCImpl >
template<typename R >
void intrusive_ptr_release |
( |
R * |
rcptr | ) |
|
|
friend |
Helper to decrement a ref count.
- Template Parameters
-
R | type that has an decrementable member refcount_ |
- Parameters
-
rcptr | pointer to instance of R |
- Todo:
- consider removing debug cout
Helper function template to implement decrementing of a member 'refcount_' of a type R; acts as an adapter layer to implement this funtionality as well as some conditionally built debug logging and a conditionally built notify hook.
Definition at line 1418 of file rc.hpp.