AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
anch::PoolableResource< T > Class Template Reference

Generic poolable resource. More...

#include <resourcePool.hpp>

Collaboration diagram for anch::PoolableResource< T >:

Public Member Functions

 PoolableResource (std::shared_ptr< anch::ResourcePoolState< T > > state, std::shared_ptr< T > ptr) noexcept
 PoolableResource (const PoolableResource &)=delete
 PoolableResource (PoolableResource &&other) noexcept=default
 ~PoolableResource () noexcept
PoolableResource & operator= (const PoolableResource &)=delete
PoolableResource & operator= (PoolableResource &&)=delete
T & get () noexcept

Detailed Description

template<anch::Validable T>
class anch::PoolableResource< T >

Generic poolable resource.

Borrowed resource which returns itself to its pool on destruction.
It can be moved but not copied: a resource is returned only once.

Author
Vincent Lachenal
Since
0.1

Constructor & Destructor Documentation

◆ PoolableResource() [1/3]

template<anch::Validable T>
anch::PoolableResource< T >::PoolableResource ( std::shared_ptr< anch::ResourcePoolState< T > > state,
std::shared_ptr< T > ptr )
noexcept

PoolableResource constructor (should only be called by ResourcePool)

Parameters
statethe pool state
ptrthe resource

◆ PoolableResource() [2/3]

template<anch::Validable T>
anch::PoolableResource< T >::PoolableResource ( const PoolableResource< T > & )
delete

Prohibits PoolableResource copy constructor

Here is the call graph for this function:

◆ PoolableResource() [3/3]

template<anch::Validable T>
anch::PoolableResource< T >::PoolableResource ( PoolableResource< T > && other)
defaultnoexcept

PoolableResource move constructor

Parameters
otherthe resource to move
Here is the call graph for this function:

◆ ~PoolableResource()

template<anch::Validable T>
anch::PoolableResource< T >::~PoolableResource ( )
noexcept

PoolableResource destructor
Returns the resource to its pool if it is valid, destroys it otherwise.

Member Function Documentation

◆ get()

template<anch::Validable T>
T & anch::PoolableResource< T >::get ( )
noexcept

Resource getter

Returns
the resource
Here is the call graph for this function:

◆ operator=() [1/2]

template<anch::Validable T>
PoolableResource & anch::PoolableResource< T >::operator= ( const PoolableResource< T > & )
delete

Prohibits PoolableResource copy assignment

Here is the call graph for this function:

◆ operator=() [2/2]

template<anch::Validable T>
PoolableResource & anch::PoolableResource< T >::operator= ( PoolableResource< T > && )
delete

Prohibits PoolableResource move assignment

Here is the call graph for this function:

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