118 #ifndef _StrongPtr_H__ 119 #define _StrongPtr_H__ 177 other.pointer_ =
nullptr;
178 other.base_ =
nullptr;
219 inline T*
get()
const 231 inline operator T*()
const 251 inline explicit operator bool()
const 262 other.pointer_ = temp;
266 this->
base_ = other.base_;
290 template <
class T,
class U>
293 return static_cast<T*
>(p.get());
297 template <
class T,
class U>
300 return const_cast<T*
>(p.get());
304 template <
class T,
class U>
void decrementReferenceCount()
Decrements the reference counter (for strong pointers).
Definition: Destroyable.h:75
StrongPtr(const StrongPtr< O > &other)
Copy-constructor for strong pointers to objects of another class.
Definition: StrongPtr.h:160
T * operator->() const
Overloaded operator, returns a pointer to the stored object.
Definition: StrongPtr.h:237
StrongPtr< T > static_pointer_cast(const StrongPtr< U > &p)
Uses a static_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new Stron...
Definition: StrongPtr.h:291
Shared library macros, enums, constants and forward declarations for the core library ...
A strong pointer which wraps a pointer to an object and keeps this object alive as long as the strong...
Definition: CorePrereqs.h:227
StrongPtr & operator=(const StrongPtr< O > &other)
Assigns the wrapped pointer of a StrongPtr of another class.
Definition: StrongPtr.h:204
void swap(StrongPtr &other)
Swaps the contents of two strong pointers.
Definition: StrongPtr.h:257
~StrongPtr()
Destructor: Decrements the reference counter.
Definition: StrongPtr.h:182
Definition of WeakPtr<T>, wraps a pointer to an object.
StrongPtr()
Constructor: Initializes the strong pointer with a null pointer.
Definition: StrongPtr.h:140
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
StrongPtr(const WeakPtr< O > &other)
Constructor: Initializes the strong pointer with the pointer that is stored in a WeakPtr.
Definition: StrongPtr.h:168
void incrementReferenceCount()
Increments the reference counter (for strong pointers).
Definition: Destroyable.h:72
Destroyable * base_
The wrapped pointer, casted up to Destroyable (this is needed because with just a T* pointer...
Definition: StrongPtr.h:279
StrongPtr(T *pointer)
Constructor: Initializes the strong pointer with a pointer to an object.
Definition: StrongPtr.h:145
T * get() const
Returns the wrapped pointer as T*.
Definition: StrongPtr.h:219
Destroyable * getBase() const
Returns the wrapped pointer as Destroyable*.
Definition: StrongPtr.h:225
T * pointer_
The wrapped pointer to an object of type T.
Definition: StrongPtr.h:278
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Declaration of Destroyable, the base class of all objects which can be used with StrongPtr and WeakPt...
ORX_FORCEINLINE T orxonox_cast(U *source)
Casts on object of type Identifiable to any derived type that is registered in the class hierarchy...
Definition: Identifier.h:485
Definition: InputPrereqs.h:78
T & operator*() const
Overloaded operator, returns a reference to the stored object.
Definition: StrongPtr.h:244
StrongPtr< T > dynamic_pointer_cast(const StrongPtr< U > &p)
Uses a dynamic_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new Stro...
Definition: StrongPtr.h:305
StrongPtr & operator=(T *pointer)
Assigns a new pointer.
Definition: StrongPtr.h:189
Classes must inherit from this class if they should be used with StrongPtr or WeakPtr.
Definition: Destroyable.h:47
StrongPtr(StrongPtr &&other)
Move-constructor.
Definition: StrongPtr.h:175
StrongPtr & operator=(const WeakPtr< O > &other)
Assigns the wrapped pointer of a WeakPtr.
Definition: StrongPtr.h:212
void reset()
Resets the strong pointer (equivalent to assigning a nullptr).
Definition: StrongPtr.h:272
StrongPtr(const StrongPtr &other)
Copy-constructor.
Definition: StrongPtr.h:152
StrongPtr< T > const_pointer_cast(const StrongPtr< U > &p)
Uses a const_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new Strong...
Definition: StrongPtr.h:298
StrongPtr & operator=(StrongPtr other)
Assigns the wrapped pointer of another StrongPtr.
Definition: StrongPtr.h:196