|
rippled
|
A combination of a std::shared_ptr and a std::weak_pointer. More...
#include <SharedWeakCachePointer.h>

Public Member Functions | |
| SharedWeakCachePointer ()=default | |
| SharedWeakCachePointer (SharedWeakCachePointer const &rhs) | |
| template<class TT > requires std::convertible_to<TT*, T*> | |
| SharedWeakCachePointer (std::shared_ptr< TT > const &rhs) | |
| SharedWeakCachePointer (SharedWeakCachePointer &&rhs) | |
| template<class TT > requires std::convertible_to<TT*, T*> | |
| SharedWeakCachePointer (std::shared_ptr< TT > &&rhs) | |
| SharedWeakCachePointer & | operator= (SharedWeakCachePointer const &rhs) |
| template<class TT > requires std::convertible_to<TT*, T*> | |
| SharedWeakCachePointer & | operator= (std::shared_ptr< TT > const &rhs) |
| template<class TT > requires std::convertible_to<TT*, T*> | |
| SharedWeakCachePointer & | operator= (std::shared_ptr< TT > &&rhs) |
| ~SharedWeakCachePointer () | |
| std::shared_ptr< T > const & | getStrong () const |
| Return a strong pointer if this is already a strong pointer (i.e. | |
| operator bool () const noexcept | |
| Return true if this is a strong pointer and the strong pointer is seated. | |
| void | reset () |
| Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action. | |
| T * | get () const |
| If this is a strong pointer, return the raw pointer. | |
| std::size_t | use_count () const |
| If this is a strong pointer, return the strong count. | |
| bool | expired () const |
| Return true if there is a non-zero strong count. | |
| std::shared_ptr< T > | lock () const |
| If this is a strong pointer, return the strong pointer. | |
| bool | isStrong () const |
| Return true is this represents a strong pointer. | |
| bool | isWeak () const |
| Return true is this represents a weak pointer. | |
| bool | convertToStrong () |
| If this is a weak pointer, attempt to convert it to a strong pointer. | |
| bool | convertToWeak () |
| If this is a strong pointer, attempt to convert it to a weak pointer. | |
Private Attributes | |
| std::variant< std::shared_ptr< T >, std::weak_ptr< T > > | combo_ |
A combination of a std::shared_ptr and a std::weak_pointer.
This class is a wrapper to a std::variant<std::shared_ptr,std::weak_ptr> This class is useful for storing intrusive pointers in tagged caches using less memory than storing both pointers directly.
Definition at line 37 of file SharedWeakCachePointer.h.
|
default |
| ripple::SharedWeakCachePointer< T >::SharedWeakCachePointer | ( | SharedWeakCachePointer< T > const & | rhs | ) |
| ripple::SharedWeakCachePointer< T >::SharedWeakCachePointer | ( | std::shared_ptr< TT > const & | rhs | ) |
| ripple::SharedWeakCachePointer< T >::SharedWeakCachePointer | ( | SharedWeakCachePointer< T > && | rhs | ) |
| ripple::SharedWeakCachePointer< T >::SharedWeakCachePointer | ( | std::shared_ptr< TT > && | rhs | ) |
| ripple::SharedWeakCachePointer< T >::~SharedWeakCachePointer | ( | ) |
| SharedWeakCachePointer & ripple::SharedWeakCachePointer< T >::operator= | ( | SharedWeakCachePointer< T > const & | rhs | ) |
| SharedWeakCachePointer & ripple::SharedWeakCachePointer< T >::operator= | ( | std::shared_ptr< TT > const & | rhs | ) |
| SharedWeakCachePointer & ripple::SharedWeakCachePointer< T >::operator= | ( | std::shared_ptr< TT > && | rhs | ) |
| std::shared_ptr< T > const & ripple::SharedWeakCachePointer< T >::getStrong | ( | ) | const |
Return a strong pointer if this is already a strong pointer (i.e.
don't lock the weak pointer. Use the lock method if that's what's needed)
|
explicitnoexcept |
Return true if this is a strong pointer and the strong pointer is seated.
| void ripple::SharedWeakCachePointer< T >::reset | ( | ) |
Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action.
| T * ripple::SharedWeakCachePointer< T >::get | ( | ) | const |
If this is a strong pointer, return the raw pointer.
Otherwise return null.
| std::size_t ripple::SharedWeakCachePointer< T >::use_count | ( | ) | const |
If this is a strong pointer, return the strong count.
Otherwise return 0
| bool ripple::SharedWeakCachePointer< T >::expired | ( | ) | const |
Return true if there is a non-zero strong count.
| std::shared_ptr< T > ripple::SharedWeakCachePointer< T >::lock | ( | ) | const |
If this is a strong pointer, return the strong pointer.
Otherwise attempt to lock the weak pointer.
| bool ripple::SharedWeakCachePointer< T >::isStrong | ( | ) | const |
Return true is this represents a strong pointer.
| bool ripple::SharedWeakCachePointer< T >::isWeak | ( | ) | const |
Return true is this represents a weak pointer.
| bool ripple::SharedWeakCachePointer< T >::convertToStrong | ( | ) |
If this is a weak pointer, attempt to convert it to a strong pointer.
| bool ripple::SharedWeakCachePointer< T >::convertToWeak | ( | ) |
If this is a strong pointer, attempt to convert it to a weak pointer.
|
private |
Definition at line 132 of file SharedWeakCachePointer.h.