22#pragma warning( push ) 
   24#pragma warning(disable: 4189) 
   27#define NEBULA_UNUSED_ATTR 
   45    Ptr(std::nullptr_t rhs);
 
   52    template <
class OTHERTYPE>
 
   56    template<
class OTHERTYPE>
 
   60        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit cast assumes left hand side must be base of right");
 
   61        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs);
 
 
   70    template <
class OTHERTYPE>
 
   74        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit cast assumes left hand side must be base of right");
 
   75        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs.
ptr);
 
   79            if (
nullptr != this->
ptr) 
 
 
   84    template <
class OTHERTYPE>
 
   88        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit cast assumes left hand side must be base of right");
 
   89        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs.ptr);
 
 
  105    template<
class OTHERTYPE>
 
  108        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit assignment assumes left hand side must be base of right");
 
  109        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs);
 
  112            if (this->
ptr != 
nullptr)
 
  113                this->
ptr->Release();
 
  115            if (this->
ptr != 
nullptr) this->
ptr->AddRef();
 
 
  119    template<
class OTHERTYPE>
 
  122        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit assignment assumes left hand side must be base of right");
 
  123        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs.
ptr);
 
  126            if (this->
ptr != 
nullptr) 
 
  127                this->
ptr->Release();
 
  129            if (this->
ptr != 
nullptr) this->
ptr->AddRef();
 
 
  133    template<
class OTHERTYPE>
 
  136        static_assert(std::is_base_of<TYPE, OTHERTYPE>::value, 
"Implicit assignment assumes left hand side must be base of right");
 
  137        TYPE* p = 
reinterpret_cast<TYPE*
>(rhs.ptr);
 
  140            if (this->
ptr != 
nullptr)
 
  141                this->
ptr->Release();
 
 
  160    operator TYPE*() 
const;
 
  246        this->
ptr->Release();
 
 
  258    if (this->
ptr != rhs)
 
  260        if (this->
ptr != 
nullptr) 
 
  261            this->
ptr->Release();
 
  263        if (this->
ptr != 
nullptr) 
 
 
  277        if (this->
ptr != 
nullptr) 
 
  278            this->
ptr->Release();
 
  280        if (this->
ptr != 
nullptr) 
 
 
  292    if (this->
ptr != rhs.ptr)
 
  295            this->
ptr->Release();
 
 
  308    if (this->
ptr != rhs)
 
  310        if (this->
ptr != 
nullptr) this->
ptr->Release();
 
 
  322    return (this->
ptr == rhs.
ptr);
 
 
  332    return (this->
ptr != rhs.
ptr);
 
 
  342    return (this->
ptr == rhs);
 
 
  352    return (this->
ptr != rhs);
 
 
  362    n_assert2(this->
ptr, 
"NULL pointer access in Ptr::operator->()!");
 
 
  373    n_assert2(this->
ptr, 
"NULL pointer access in Ptr::operator*()!");
 
 
  383    n_assert2(this->
ptr, 
"NULL pointer access in Ptr::operator TYPE*()!");
 
 
  394#if (NEBULA_DEBUG == 1) 
  397    static_assert(std::is_base_of<TYPE, DERIVED>::value, 
"Incompatible types");
 
 
  410#if (NEBULA_DEBUG == 1) 
  413    static_assert(std::is_base_of<BASE, TYPE>::value, 
"Incompatible types");
 
  416    return *
reinterpret_cast<const Ptr<BASE>*
>(
this);
 
 
  437    return (
nullptr != this->
ptr);
 
 
  447    n_assert2(this->
ptr, 
"NULL pointer access in Ptr::get()!");
 
 
 
  474#if __WIN32__ && NEBULA_DEBUG 
  475#pragma warning( pop ) 
  477#ifdef NEBULA_UNUSED_ATTR 
  478#undef NEBULA_UNUSED_ATTR 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
The common base class of Nebula.
Definition refcounted.h:38
 
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
 
TYPE & operator*() const
safe dereference operator
Definition ptr.h:371
 
Ptr()
constructor
Definition ptr.h:186
 
const Ptr< DERIVED > & downcast() const
type-safe downcast operator to other smart pointer
Definition ptr.h:392
 
Ptr(const Ptr< OTHERTYPE > &rhs)
construct from smart pointer of other type
Definition ptr.h:71
 
TYPE * operator->() const
safe -> operator
Definition ptr.h:360
 
Ptr(TYPE *p)
construct from C++ pointer
Definition ptr.h:196
 
void operator=(const Ptr< TYPE > &rhs)
assignment operator
Definition ptr.h:273
 
const Ptr< OTHERTYPE > & cast() const
unsafe(!) cast to anything, unless classes have no inheritance-relationship, call upcast/downcast ins...
Definition ptr.h:424
 
Ptr(std::nullptr_t rhs)
constructor from nullptr
Definition ptr.h:210
 
bool operator!=(const Ptr< TYPE > &rhs) const
inequality operator
Definition ptr.h:330
 
const Ptr< BASE > & upcast() const
type-safe upcast operator to other smart pointer
Definition ptr.h:408
 
uint32_t HashCode() const
calculate hash code for Util::HashTable (basically just the adress)
Definition ptr.h:467
 
void operator=(Ptr< OTHERTYPE > &&rhs)
move assignment to Ptr of other type
Definition ptr.h:134
 
void operator=(Ptr< TYPE > &&rhs)
move operator
Definition ptr.h:290
 
TYPE * get() const
return direct pointer (asserts if null pointer)
Definition ptr.h:445
 
Ptr(OTHERTYPE *rhs)
construct from C++ pointer of other type
Definition ptr.h:57
 
Ptr(Ptr< OTHERTYPE > &&rhs)
construct from smart pointer of other type
Definition ptr.h:85
 
bool operator!=(const TYPE *rhs) const
shortcut inequality operator
Definition ptr.h:350
 
~Ptr()
destructor
Definition ptr.h:242
 
void operator=(OTHERTYPE *rhs)
assign operator to pointer of other type
Definition ptr.h:106
 
bool isvalid() const
check if pointer is valid
Definition ptr.h:435
 
TYPE * ptr
Definition ptr.h:179
 
friend class Ptr
make other type Ptr classes friend
Definition ptr.h:53
 
TYPE * get_unsafe() const
return direct pointer (returns null pointer)
Definition ptr.h:456
 
void operator=(std::nullptr_t rhs)
unassignment operator
Definition ptr.h:306
 
bool operator==(const TYPE *rhs) const
shortcut equality operator
Definition ptr.h:340
 
bool operator==(const Ptr< TYPE > &rhs) const
equality operator
Definition ptr.h:320
 
Ptr(Ptr< TYPE > &&p)
implement move constructor
Definition ptr.h:232
 
void operator=(TYPE *rhs)
assignment operator
Definition ptr.h:256
 
void operator=(const Ptr< OTHERTYPE > &rhs)
assign operator to Ptr of other type
Definition ptr.h:120
 
Ptr(const Ptr< TYPE > &p)
construct from smart pointer
Definition ptr.h:219
 
#define n_assert2(exp, msg)
Definition debug.h:51
 
Definition coreserver.cc:11
 
__forceinline uint32_t pointerhash(void *ptr)
cheap pointer hash using modulo with a mersenne prime
Definition scalar.h:817
 
Nebula's scalar datatype.