32 template<
typename TYPE,
typename DELETER>
51 template<
typename TYPE,
typename DERIVED,
typename DELETER>
53 public comparable<autoPtr<TYPE, DERIVED, DELETER>>,
54 public hashable<autoPtr<TYPE, DERIVED, DELETER>> {
145 explicit operator
bool() const;
151 bool operator!() const;
172 virtual const TYPE& operator*() const;
179 virtual const TYPE* operator->() const;
195 virtual TYPE& operator*();
202 virtual TYPE* operator->();
263 template<typename T, typename DER, typename DEL>
264 friend
bool operator==(const
autoPtr<T, DER, DEL>& ptr, const std::nullptr_t& null);
266 template<typename T, typename DER, typename DEL>
267 friend
bool operator!=(const
autoPtr<T, DER, DEL>& ptr, const std::nullptr_t& null);
269 template<typename T, typename DER, typename DEL>
270 friend
bool operator==(const std::nullptr_t& null, const
autoPtr<T, DER, DEL>& ptr);
272 template<typename T, typename DER, typename DEL>
273 friend
bool operator!=(const std::nullptr_t& null, const
autoPtr<T, DER, DEL>& ptr);
286 template<typename T, typename DER, typename DEL>
287 bool operator==(const
autoPtr<T, DER, DEL>& ptr, const std::nullptr_t& null);
299 template<typename T, typename DER, typename DEL>
300 bool operator!=(const
autoPtr<T, DER, DEL>& ptr, const std::nullptr_t& null);
312 template<typename T, typename DER, typename DEL>
313 bool operator==(const std::nullptr_t& null, const
autoPtr<T, DER, DEL>& ptr);
325 template<typename T, typename DER, typename DEL>
326 bool operator!=(const std::nullptr_t& null, const
autoPtr<T, DER, DEL>& ptr);
338 template<typename TYPE, typename DELETER>
340 template <
typename,
typename,
typename>
341 friend class autoPtr;
352 explicit refCount(TYPE* p =
nullptr);
357 void destroyPtr()
noexcept;
366template<
typename TYPE,
typename DERIVED,
typename DELETER>
371template<
typename TYPE,
typename DERIVED,
typename DELETER>
379template<
typename TYPE,
typename DERIVED,
typename DELETER>
384template<
typename TYPE,
typename DERIVED,
typename DELETER>
389template<
typename TYPE,
typename DERIVED,
typename DELETER>
394template<
typename TYPE,
typename DERIVED,
typename DELETER>
399template<
typename TYPE,
typename DERIVED,
typename DELETER>
405template<
typename TYPE,
typename DERIVED,
typename DELETER>
415template <
typename TYPE,
typename DERIVED,
typename DELETER>
421template<
typename TYPE,
typename DERIVED,
typename DELETER>
426template<
typename TYPE,
typename DERIVED,
typename DELETER>
431template<
typename TYPE,
typename DERIVED,
typename DELETER>
436template<
typename TYPE,
typename DERIVED,
typename DELETER>
441template<
typename TYPE,
typename DERIVED,
typename DELETER>
443 return this->
exist() && this->
get();
446template <
typename TYPE,
typename DERIVED,
typename DELETER>
448 return !this->
operator bool();
451template<
typename TYPE,
typename DERIVED,
typename DELETER>
459template<
typename TYPE,
typename DERIVED,
typename DELETER>
467template<
typename TYPE,
typename DERIVED,
typename DELETER>
469 const auto ptr = this->
get();
475template<
typename TYPE,
typename DERIVED,
typename DELETER>
478 const auto ptr = this->
get();
484template<
typename TYPE,
typename DERIVED,
typename DELETER>
486 const auto ptr = this->
get();
492template<
typename TYPE,
typename DERIVED,
typename DELETER>
494 auto ptr = this->
get();
500template<
typename TYPE,
typename DERIVED,
typename DELETER>
503 auto ptr = this->
get();
509template<
typename TYPE,
typename DERIVED,
typename DELETER>
511 auto ptr = this->
get();
517template<
typename TYPE,
typename DERIVED,
typename DELETER>
519 auto other_ref_count = other.ref_count;
524template<
typename TYPE,
typename DERIVED,
typename DELETER>
529template<
typename TYPE,
typename DERIVED,
typename DELETER>
534template<
typename TYPE,
typename DERIVED,
typename DELETER>
536 std::stringstream ss;
545template<
typename TYPE,
typename DERIVED,
typename DELETER>
550template<
typename TYPE,
typename DERIVED,
typename DELETER>
552 return *
this == other;
555template<
typename TYPE,
typename DERIVED,
typename DELETER>
560template<
typename T,
typename DER,
typename DEL>
562 return !ptr.operator bool();
565template<
typename T,
typename DER,
typename DEL>
567 return ptr.operator bool();
570template<
typename T,
typename DER,
typename DEL>
572 return !ptr.operator bool();
575template<
typename T,
typename DER,
typename DEL>
577 return ptr.operator bool();
580template<
typename TYPE,
typename DELETER>
581original::refCount<TYPE, DELETER>::refCount(TYPE *p)
582 : ptr(p), strong_refs(0), weak_refs(0) {}
584template<
typename TYPE,
typename DELETER>
585void original::refCount<TYPE, DELETER>::destroyPtr() noexcept {
586 TYPE* tmp = this->ptr;
591template<
typename TYPE,
typename DELETER>
592original::refCount<TYPE, DELETER>::~refCount() {
Base smart pointer with reference counting.
Definition autoPtr.h:54
static refCount< TYPE, deleter< TYPE > > * newRefCount(TYPE *p=nullptr)
Definition autoPtr.h:416
integer compareTo(const autoPtr &other) const override
Definition autoPtr.h:525
void destroyRefCnt() noexcept
Destroy reference counter.
Definition autoPtr.h:400
void removeStrongRef()
Decrement strong reference count.
Definition autoPtr.h:390
virtual const TYPE & operator[](u_integer index) const
Const array access operator.
Definition autoPtr.h:485
u_integer strongRefs() const
Definition autoPtr.h:422
~autoPtr() override
Destructor triggers reference cleanup.
Definition autoPtr.h:556
void addStrongRef()
Increment strong reference count.
Definition autoPtr.h:380
bool exist() const
Definition autoPtr.h:432
bool equals(const autoPtr &other) const noexcept override
Definition autoPtr.h:551
void setPtr(TYPE *p)
Replace managed pointer.
Definition autoPtr.h:372
void removeWeakRef()
Decrement weak reference count.
Definition autoPtr.h:395
bool operator!() const
Logical NOT operator.
Definition autoPtr.h:447
void addWeakRef()
Increment weak reference count.
Definition autoPtr.h:385
std::string className() const override
Definition autoPtr.h:530
void swap(autoPtr &other) noexcept
Definition autoPtr.h:518
u_integer toHash() const noexcept override
Definition autoPtr.h:546
bool expired() const
Definition autoPtr.h:437
void clean() noexcept
Definition autoPtr.h:406
u_integer weakRefs() const
Definition autoPtr.h:427
autoPtr(TYPE *p)
Construct from raw pointer.
Definition autoPtr.h:367
refCount< TYPE, DELETER > * ref_count
Reference counter object.
Definition autoPtr.h:56
virtual const TYPE & operator*() const
Const dereference operator.
Definition autoPtr.h:468
std::string toString(bool enter) const override
Definition autoPtr.h:535
const TYPE * get() const
Definition autoPtr.h:452
virtual const TYPE * operator->() const
Const member access operator.
Definition autoPtr.h:477
Base class for comparable objects.
Definition comparable.h:31
static u_integer hashFunc(const T &t) noexcept
Default hash function fallback.
Forward declaration of hashable interface template.
Definition hash.h:216
Exception for null pointer dereference attempts.
Definition error.h:110
Base class providing polymorphic string conversion capabilities.
Definition printable.h:29
static std::string formatString(const TYPE &t)
Universal value-to-string conversion.
Reference counting metadata container.
Definition autoPtr.h:339
Interface for objects that can be compared.
Platform-independent integer and floating-point type definitions.
Custom exception classes and callback validation utilities.
Provides a generic hashing utility and a base interface for hashable types.
Main namespace for the project Original.
Definition algorithms.h:21
std::uint32_t u_integer
32-bit unsigned integer type for sizes and indexes
Definition config.h:43
std::int64_t integer
64-bit signed integer type for arithmetic operations
Definition config.h:35
bool operator!=(const autoPtr< T, DER, DEL > &ptr, const std::nullptr_t &null)
Inequality comparison with nullptr.
Definition autoPtr.h:566
bool operator==(const autoPtr< T, DER, DEL > &ptr, const std::nullptr_t &null)
Equality comparison with nullptr.
Definition autoPtr.h:561
Interface for polymorphic string formatting and output.