38 template<
typename TYPE,
typename DERIVED,
typename DELETER>
40 template<
typename,
typename,
typename>
friend class refCntPtr;
58 template<
typename O_DERIVED>
67 template<
typename O_DERIVED>
89 template<
typename TYPE,
typename DELETER = deleter<TYPE>>
92 template<
typename TYPE,
typename DELETER = deleter<TYPE>>
107 template<
typename TYPE,
typename DELETER>
109 template<
typename,
typename>
friend class strongPtr;
110 template<
typename,
typename>
friend class weakPtr;
153 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
163 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<const U>>
173 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
183 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<const U>>
193 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
245 template<
typename,
typename>
friend class weakPtr;
246 template<
typename,
typename>
friend class strongPtr;
326 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
336 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<const U>>
346 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
356 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<const U>>
366 template<
typename U,
typename DEL = DELETER::
template rebound_deleter<U>>
454 template <
typename T,
typename DEL = deleter<T>,
typename... Args>
473 template <
typename T,
typename DEL = deleter<T[]>,
typename... Args>
479 template<
typename TYPE,
typename DERIVED,
typename DELETER>
483 template<
typename TYPE,
typename DERIVED,
typename DELETER>
484 template<
typename O_DERIVED>
486 return this->
get() == other.
get();
489 template<
typename TYPE,
typename DERIVED,
typename DELETER>
490 template<
typename O_DERIVED>
492 return this->
get() != other.
get();
495 template<
typename TYPE,
typename DERIVED,
typename DELETER>
500 template<
typename TYPE,
typename DERIVED,
typename DELETER>
502 std::stringstream
ss;
505 ss <<
"strong ref: " << this->
strongRefs() <<
", " <<
"weak ref: " << this->
weakRefs();
512 template <
typename TYPE,
typename DELETER>
522 template<
typename TYPE,
typename DELETER>
528 template<
typename TYPE,
typename DELETER>
533 template<
typename TYPE,
typename DELETER>
546 template<
typename TYPE,
typename DELETER>
548 this->operator=(std::move(
other));
551 template <
typename TYPE,
typename DELETER>
552 template <
typename U,
typename DEL>
560 template <
typename TYPE,
typename DELETER>
561 template <
typename U,
typename DEL>
569 template <
typename TYPE,
typename DELETER>
570 template <
typename U,
typename DEL>
573 auto alias =
dynamic_cast<U*
>(this->
get());
574 if (alias ==
nullptr) {
580 template <
typename TYPE,
typename DELETER>
581 template <
typename U,
typename DEL>
584 auto alias =
dynamic_cast<const U*
>(this->
get());
585 if (alias ==
nullptr) {
591 template <
typename TYPE,
typename DELETER>
592 template <
typename U,
typename DEL>
595 auto alias =
const_cast<U*
>(this->
get());
599 template<
typename TYPE,
typename DELETER>
608 template<
typename TYPE,
typename DELETER>
613 this->removeStrongRef();
622 template<
typename TYPE,
typename DELETER>
627 template<
typename TYPE,
typename DELETER>
632 template<
typename T,
typename DEL,
typename ...
Args>
637 template<
typename T,
typename DEL,
typename ...
Args>
647 template <
typename TYPE,
typename DELETER>
657 template<
typename TYPE,
typename DELETER>
663 template<
typename TYPE,
typename DELETER>
669 template<
typename TYPE,
typename DELETER>
682 template<
typename TYPE,
typename DELETER>
688 template<
typename TYPE,
typename DELETER>
701 template<
typename TYPE,
typename DELETER>
703 this->operator=(std::move(
other));
706 template<
typename TYPE,
typename DELETER>
711 this->removeWeakRef();
720 template <
typename TYPE,
typename DELETER>
721 template <
typename U,
typename DEL>
729 template <
typename TYPE,
typename DELETER>
730 template <
typename U,
typename DEL>
738 template <
typename TYPE,
typename DELETER>
739 template <
typename U,
typename DEL>
742 auto alias =
dynamic_cast<U*
>(this->
get());
743 if (alias ==
nullptr) {
749 template <
typename TYPE,
typename DELETER>
750 template <
typename U,
typename DEL>
753 auto alias =
dynamic_cast<const U*
>(this->
get());
754 if (alias ==
nullptr) {
760 template <
typename TYPE,
typename DELETER>
761 template <
typename U,
typename DEL>
764 auto alias =
const_cast<U*
>(this->
get());
768 template<
typename TYPE,
typename DELETER>
781 template<
typename TYPE,
typename DELETER>
783 return this->lock().operator*();
786 template<
typename TYPE,
typename DELETER>
788 return this->lock().operator->();
791 template<
typename TYPE,
typename DELETER>
793 return this->lock().operator[](index);
796 template<
typename TYPE,
typename DELETER>
798 return this->lock().operator*();
801 template<
typename TYPE,
typename DELETER>
803 return this->lock().operator->();
806 template<
typename TYPE,
typename DELETER>
808 return this->lock().operator[](index);
811 template<
typename TYPE,
typename DELETER>
816 template<
typename TYPE,
typename DELETER>
Base class for reference-counted smart pointers.
Base smart pointer with reference counting.
Definition autoPtr.h:68
void addWeakRef() const
Increment weak reference count.
Definition autoPtr.h:521
static refCount< TYPE, DELETER > * newRefCount(TYPE *p=nullptr)
Create new reference counter.
Definition autoPtr.h:581
virtual const TYPE & operator[](u_integer index) const
Const array access operator.
Definition autoPtr.h:670
u_integer strongRefs() const
Get strong reference count.
Definition autoPtr.h:587
void removeWeakRef() const
Decrement weak reference count.
Definition autoPtr.h:537
void addStrongRef() const
Increment strong reference count.
Definition autoPtr.h:513
TYPE * alias_ptr
Aliased pointer for type casting scenarios.
Definition autoPtr.h:72
atomic< refCountBase * > ref_count
Reference counter object.
Definition autoPtr.h:71
void removeStrongRef() const
Decrement strong reference count.
Definition autoPtr.h:529
bool expired() const
Check resource validity.
Definition autoPtr.h:608
void clean() noexcept
Cleanup resources when expired.
Definition autoPtr.h:561
u_integer weakRefs() const
Get weak reference count.
Definition autoPtr.h:594
friend bool operator!=(const autoPtr< T, DER, DEL > &ptr, const std::nullptr_t &null)
Inequality comparison with nullptr.
virtual const TYPE & operator*() const
Const dereference operator.
Definition autoPtr.h:653
const TYPE * get() const
Get managed pointer const version.
Definition autoPtr.h:629
virtual const TYPE * operator->() const
Const member access operator.
Definition autoPtr.h:662
friend bool operator==(const autoPtr< T, DER, DEL > &ptr, const std::nullptr_t &null)
Equality comparison with nullptr.
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
std::string className() const override
Get class name identifier.
Definition ownerPtr.h:223
static std::string formatString(const TYPE &t)
Universal value-to-string conversion with type-specific formatting.
Definition printable.h:339
Base class for reference-counted pointers.
Definition refCntPtr.h:39
std::string className() const override
Get class identifier.
Definition refCntPtr.h:496
std::string toString(bool enter) const override
Formatted string with reference info.
Definition refCntPtr.h:501
bool operator!=(const refCntPtr< TYPE, O_DERIVED, DELETER > &other) const
Inequality comparison operator.
Definition refCntPtr.h:491
bool operator==(const refCntPtr< TYPE, O_DERIVED, DELETER > &other) const
Equality comparison operator.
Definition refCntPtr.h:485
~refCntPtr() override=default
Default destructor of refCntPtr.
refCntPtr(TYPE *p=std::nullptr_t{})
Construct from raw pointer.
Definition refCntPtr.h:480
Base class for reference counting metadata.
Definition autoPtr.h:377
Shared ownership smart pointer with strong references.
Definition refCntPtr.h:108
strongPtr(strongPtr &&other) noexcept
Move constructor transfers ownership.
Definition refCntPtr.h:547
void reset() noexcept
Resets the smart pointer and releases the managed object.
Definition refCntPtr.h:600
std::string className() const override
Get class identifier.
Definition refCntPtr.h:623
friend strongPtr< T, DEL > makeStrongPtr(Args &&... args)
Creates a new strongPtr managing a shared object.
Definition refCntPtr.h:633
strongPtr< const U, DEL > staticCastTo() const
Static cast to const pointer type.
Definition refCntPtr.h:562
strongPtr & operator=(const strongPtr &other)
Copy assignment shares ownership.
Definition refCntPtr.h:534
strongPtr< U, DEL > staticCastTo()
Static cast to different pointer type.
Definition refCntPtr.h:553
strongPtr(TYPE *p=std::nullptr_t{})
Construct from raw pointer.
Definition refCntPtr.h:523
strongPtr< const U, DEL > dynamicCastTo() const
Dynamic cast to const pointer type.
Definition refCntPtr.h:582
friend strongPtr< T, DEL > makeStrongPtrArray(u_integer size, Args &&... args)
Creates a new strongPtr managing a shared array.
Definition refCntPtr.h:638
~strongPtr() override
Destructor decreases strong references count.
Definition refCntPtr.h:628
strongPtr< U, DEL > constCastTo() const
Const cast to remove/add const qualifier.
Definition refCntPtr.h:593
strongPtr< U, DEL > dynamicCastTo()
Dynamic cast to different pointer type.
Definition refCntPtr.h:571
strongPtr(const strongPtr &other)
Copy constructor shares ownership.
Definition refCntPtr.h:529
Non-owning reference to shared resource.
Definition refCntPtr.h:244
const TYPE & operator*() const override
Const dereference via temporary strong reference.
Definition refCntPtr.h:782
weakPtr< U, DEL > staticCastTo()
Static cast to different pointer type.
Definition refCntPtr.h:722
std::string className() const override
Get class type identifier.
Definition refCntPtr.h:812
strongPtr< TYPE, DELETER > lock() const
Attempt to acquire ownership.
Definition refCntPtr.h:769
weakPtr< U, DEL > constCastTo() const
Const cast to remove/add const qualifier.
Definition refCntPtr.h:762
weakPtr & operator=(const strongPtr< TYPE, DELETER > &other)
Assign observation from strongPtr.
Definition refCntPtr.h:670
weakPtr< U, DEL > dynamicCastTo()
Dynamic cast to different pointer type.
Definition refCntPtr.h:740
~weakPtr() override
Destructor releases weak reference.
Definition refCntPtr.h:817
const TYPE & operator[](u_integer index) const override
Const array element access via temporary strong reference.
Definition refCntPtr.h:792
const TYPE * operator->() const override
Const member access via temporary strong reference.
Definition refCntPtr.h:787
Default deleters for resource management.
Main namespace for the project Original.
Definition algorithms.h:21
strongPtr< T, DEL > makeStrongPtrArray(u_integer size, Args &&... args)
Creates a new strongPtr managing a shared array.
Definition refCntPtr.h:638
strongPtr< T, DEL > makeStrongPtr(Args &&... args)
Creates a new strongPtr managing a shared object.
Definition refCntPtr.h:633
Standard namespace extensions for original::alternative.
Definition allocator.h:351
Reference-counted smart pointer hierarchy.