|
LibCXX 0.26.1
|
A singleton reference. More...
#include <singletonptr.H>
Public Member Functions | |
| singletonptr () | |
| Default constructor. | |
| singletonptr (const ptr< ref_type, baseClass > &p) | |
| Explicit constructor. | |
| ~singletonptr () | |
| Destructor. | |
Public Member Functions inherited from x::ptr< objClass, baseClass > | |
| ptr () noexcept LIBCXX_INLINE | |
| Default constructor. | |
| ptr (const ptr< objClass, baseClass > &o) noexcept LIBCXX_INLINE | |
| Copy constructor. | |
| template<typename objClass2 , typename baseClass2 > | |
| ptr (const ptr< objClass2, baseClass2 > &o) LIBCXX_INLINE | |
| Construct from a reference to a subclass or a superclass. | |
| template<typename baseClass2 > | |
| ptr (const ref< objClass, baseClass2 > &o) noexcept | |
| Copy constructor. | |
| ptr (objClass *pArg) noexcept LIBCXX_INLINE | |
The default constructor from this. | |
| ptr (ptr< objClass, baseClass > &&o) noexcept LIBCXX_INLINE | |
| Move constructor. | |
| template<typename objClass2 , typename baseClass2 > | |
| ptr (ptr< objClass2, baseClass2 > &&o) LIBCXX_INLINE | |
| Move constructor from a subclass or a superclass. | |
| template<typename baseClass2 > | |
| ptr (ref< objClass, baseClass2 > &&o) noexcept | |
| Move constructor. | |
| ~ptr () LIBCXX_INLINE | |
| The default destructor. | |
| objClass & | operator* () const LIBCXX_INLINE |
| Implement the "*" operator for object references. | |
| objClass * | operator-> () const LIBCXX_INLINE |
| Implement the "->" operator for object references. | |
| ptr< objClass, baseClass > & | operator= (const ptr< objClass, baseClass > &o) noexcept LIBCXX_INLINE |
| The assignment operator. | |
| template<typename objClass2 , typename baseClass2 > | |
| ptr< objClass, baseClass > & | operator= (const ptr< objClass2, baseClass2 > &o) |
| Convert from a reference to a different type. | |
| template<typename objClass2 > | |
| ptr< objClass, baseClass > & | operator= (objClass2 *o) |
| Convert from a reference to a different type. | |
| ptr< objClass, baseClass > & | operator= (ptr< objClass, baseClass > &&o) noexcept LIBCXX_INLINE |
| The move operator. | |
| template<typename objClass2 , typename baseClass2 > | |
| ptr< objClass, baseClass > & | operator= (ptr< objClass2, baseClass2 > &&o) |
| Move from a reference to a different type. | |
| ptr< objClass, baseClass > & | operator= (std::nullptr_t) LIBCXX_INLINE |
| Convert from a nullptr. | |
| auto | weaken () const |
| Make a weak pointer out of me. | |
Public Member Functions inherited from x::const_ptr< objClass, baseClass > | |
| const_ptr () noexcept LIBCXX_INLINE | |
| template<typename baseClass2 > | |
| const_ptr (const const_ref< objClass, baseClass2 > &o) noexcept | |
| Copy constructor. | |
| const_ptr (const objClass *pArg) noexcept LIBCXX_INLINE | |
| const_ptr (const ptrImpl< objClass > &o) noexcept LIBCXX_INLINE | |
| Copy constructor. | |
| template<typename objClass2 > | |
| const_ptr (const ptrImpl< objClass2 > &o) | |
| template<typename baseClass2 > | |
| const_ptr (const ref< objClass, baseClass2 > &o) noexcept | |
| Copy constructor called by const_ref. | |
| template<typename baseClass2 > | |
| const_ptr (const_ptr< objClass, baseClass2 > &&o) noexcept | |
| template<typename baseClass2 > | |
| const_ptr (const_ref< objClass, baseClass2 > &&o) noexcept | |
| Move constructor. | |
| template<typename baseClass2 > | |
| const_ptr (ptr< objClass, baseClass2 > &&o) noexcept | |
| template<typename baseClass2 > | |
| const_ptr (ref< objClass, baseClass2 > &&o) noexcept | |
| Move constructor called by const_ref. | |
| ~const_ptr () LIBCXX_INLINE | |
| The default destructor. | |
| const objClass & | operator* () const LIBCXX_INLINE |
| Implement the "*" operator for pointer references. | |
| const objClass * | operator-> () const LIBCXX_INLINE |
| Implement the "->" operator for pointer references. | |
| template<typename T > requires is_derived_from_ref_or_ptr<T> | |
| std::strong_ordering | operator<=> (const T &o) const noexcept LIBCXX_INLINE |
| Comparison operator. | |
| template<typename objClass2 > | |
| const_ptr< objClass, baseClass > & | operator= (const objClass2 *o) |
| const_ptr< objClass, baseClass > & | operator= (const ptrImpl< objClass > &o) noexcept |
| The assignment operator. | |
| template<typename objClass2 > | |
| const_ptr< objClass, baseClass > & | operator= (const ptrImpl< objClass2 > &o) |
| Convert from a pointer reference to a different type. | |
| const_ptr< objClass, baseClass > & | operator= (ptrImpl< objClass > &&o) noexcept LIBCXX_INLINE |
| The move operator. | |
| template<typename T > requires is_derived_from_ref_or_ptr<T> | |
| bool | operator== (const T &o) const noexcept LIBCXX_INLINE |
Public Member Functions inherited from x::ptrImpl< objClass > | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (const const_ref< objClass, baseClass > &o) noexcept | |
| ptrImpl (const ptrImpl< objClass > &o) noexcept LIBCXX_INLINE | |
| The default copy constructor. | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (const ref< objClass, baseClass > &o) noexcept | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (const_ptr< objClass, baseClass > &&o) noexcept | |
| Move constructor. | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (const_ref< objClass, baseClass > &&o) noexcept | |
| template<typename impl_objClass = objClass> requires derived_from_obj<impl_objClass> | |
| ptrImpl (objClass *pArg) noexcept LIBCXX_INLINE | |
| Default constructor. | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (ptr< objClass, baseClass > &&o) noexcept | |
| Move constructor. | |
| ptrImpl (ptrImpl< objClass > &&o) noexcept LIBCXX_INLINE | |
| Move constructor. | |
| template<typename baseClass > requires derived_from_obj<objClass> | |
| ptrImpl (ref< objClass, baseClass > &&o) noexcept | |
| ~ptrImpl () LIBCXX_INLINE | |
| Default destructor. | |
| bool | null () const noexcept LIBCXX_INLINE |
| Check if this is an unbound reference. | |
| operator bool () const noexcept | |
| Make it work in boolean context. | |
| bool | operator! () const noexcept |
| Make it work in boolean context. | |
| ptrImpl< objClass > & | operator= (const ptrImpl< objClass > &o) noexcept LIBCXX_INLINE |
| The default assignment operator. | |
| ptrImpl< objClass > & | operator= (ptrImpl< objClass > &&o) noexcept LIBCXX_INLINE |
| The move operator. | |
Static Private Member Functions | |
| static pthread_mutex_t & | get_instance_mutex () |
| The global instance. | |
| static ref_type *& | get_object () |
Private Attributes | |
| bool | initial |
| Whether this is the initial one. | |
Additional Inherited Members | |
Public Types inherited from x::ptr< objClass, baseClass > | |
| typedef std_refptr_traits< objClass, baseClass, ptr< objClass, baseClass > > | traits_t |
| Our traits. | |
Public Types inherited from x::const_ptr< objClass, baseClass > | |
| typedef baseClass | base |
| Provide for this pointer's base class. | |
| typedef objClass | obj_type |
| Define this pointer's object class. | |
| typedef std_refptr_traits< objClass, baseClass, const_ptr< objClass, baseClass > > | traits_t |
| Our traits. | |
Public Types inherited from x::ptrImpl< objClass > | |
| typedef objClass | obj_type |
| Define this reference's base type. | |
Static Public Member Functions inherited from x::ptr< objClass, baseClass > | |
| template<typename... Args_t> | |
| static auto | create (Args_t &&...args) LIBCXX_INLINE |
| Forward create() to the base type. | |
Static Public Member Functions inherited from x::const_ptr< objClass, baseClass > | |
| template<typename... Args_t> | |
| static auto | create (Args_t &&...args) LIBCXX_INLINE |
| Forward create() to the base type. | |
Protected Member Functions inherited from x::ptrImpl< objClass > | |
| objClass * | getrefP () const noexcept LIBCXX_INLINE |
| Return the underlying pointer. | |
| void | setRef (objClass *newRefP) noexcept LIBCXX_INLINE |
| Update reference pointer. | |
| void | setRef_noconscheck (objClass *newRefP) noexcept LIBCXX_INLINE |
| Update reference pointer. | |
Protected Attributes inherited from x::ptrImpl< objClass > | |
| objClass * | refP |
| Object that this reference is bound to. | |
A singleton reference.
A singletonptr wraps a global reference to an object. Instances of singletonptr should always be constructed in automatic scope.
Passing a ref to an existing object to singletonptr's constructor makes the object available to any other instances of default-constructed singletonptr. The referenced object remains available until all instances of singletonptr go out of their automatic scope.
A singletonptr is a subclass of a ptr. The default constructor results in a null ptr if no other existing instance of a singleton exists which was constructed with an explicit object.
|
inline |
Explicit constructor.
|
inline |
Default constructor.
|
inline |
Destructor.
|
inlinestaticprivate |
The global instance.
Reverting to pthread_mutex_t, since there is no guarantee that std::mutex is trivially destructible, and the singleton can be in static scope, and global destruction phase can begin while some thread is still in its death throes.
|
inlinestaticprivate |
|
private |
Whether this is the initial one.