Dev Essential  1.6.3
Loading...
Searching...
No Matches
a_util::result::detail::ReferenceCountedObject< Interface, Implementation > Class Template Reference

Default implementation of a reference counter. More...

#include <reference_counted_object.h>

Inherits a_util::result::detail::ReferenceCountedObjectInterface< Interface >.

Public Member Functions

template<typename... Args>
 ReferenceCountedObject (Args &&... args)
 
virtual void addReference () const
 Increase the reference count by 1.
 
virtual void removeReference () const
 Decrease the reference count by 1, deleting *this if it was the last reference.
 
virtual const Interface & getObject () const
 
virtual Interface & getObject ()
 

Additional Inherited Members

- Protected Member Functions inherited from a_util::result::detail::ReferenceCountedObjectInterface< Interface >
 ~ReferenceCountedObjectInterface ()
 DTOR.
 

Detailed Description

template<typename Interface, typename Implementation>
class a_util::result::detail::ReferenceCountedObject< Interface, Implementation >

Default implementation of a reference counter.

Template Parameters
InterfaceThe interface of the resource to handle
ImplementationThe type implementing the Interface type

Constructor & Destructor Documentation

◆ ReferenceCountedObject()

template<typename Interface, typename Implementation>
template<typename... Args>
a_util::result::detail::ReferenceCountedObject< Interface, Implementation >::ReferenceCountedObject ( Args &&... args)
inline

CTOR constructing the managed resource and the reference counter to an initial value of zero

Template Parameters
ArgsArgument types of the resource's constructor
Parameters
[in]argsValues to forward to the resource's constructor

Member Function Documentation

◆ addReference()

template<typename Interface, typename Implementation>
virtual void a_util::result::detail::ReferenceCountedObject< Interface, Implementation >::addReference ( ) const
inlinevirtual

Increase the reference count by 1.

Implements a_util::result::detail::ReferenceCountedObjectInterface< Interface >.

◆ getObject() [1/2]

template<typename Interface, typename Implementation>
virtual Interface & a_util::result::detail::ReferenceCountedObject< Interface, Implementation >::getObject ( )
inlinevirtual

Get a reference to the handled object's interface

Returns
Reference to the handled object

Implements a_util::result::detail::ReferenceCountedObjectInterface< Interface >.

◆ getObject() [2/2]

template<typename Interface, typename Implementation>
virtual const Interface & a_util::result::detail::ReferenceCountedObject< Interface, Implementation >::getObject ( ) const
inlinevirtual

Get a reference to the handled object's interface - provided for const correctness

Returns
Const reference to the handled object

Implements a_util::result::detail::ReferenceCountedObjectInterface< Interface >.

◆ removeReference()

template<typename Interface, typename Implementation>
virtual void a_util::result::detail::ReferenceCountedObject< Interface, Implementation >::removeReference ( ) const
inlinevirtual

Decrease the reference count by 1, deleting *this if it was the last reference.

Implements a_util::result::detail::ReferenceCountedObjectInterface< Interface >.


The documentation for this class was generated from the following file: