DART
6.7.3
|
sub_ptr is a pointer to a Subject. More...
#include <sub_ptr.hpp>
Public Member Functions | |
sub_ptr () | |
Default constructor. More... | |
sub_ptr (T *_ptr) | |
Alternative constructor. More... | |
sub_ptr & | operator= (const sub_ptr &_sp) |
Change the Subject of this sub_ptr. More... | |
sub_ptr & | operator= (T *_ptr) |
Change the Subject of this sub_ptr. More... | |
operator T* () const | |
Implicit conversion to pointer type. More... | |
T & | operator* () const |
Dereferencing operator. More... | |
T * | operator-> () const |
Dereferencing operation. More... | |
T * | get () const |
Get the Subject of this sub_ptr. More... | |
void | set (T *_ptr) |
Set the subject of this sub_ptr. More... | |
bool | valid () |
True if and only if this sub_ptr still points to a valid Subject. More... | |
Protected Member Functions | |
void | handleDestructionNotification (const Subject *_subject) override |
Called by receiveDestructionNotification(). More... | |
void | receiveDestructionNotification (const Subject *_subject) |
Called whenever a Subject is destroyed (or sends out a destruction notification). More... | |
void | addSubject (const Subject *_subject) |
Add a Subject for this Observer. More... | |
void | removeSubject (const Subject *_subject) |
Remove a Subject from this Observer. More... | |
void | removeAllSubjects () |
Remove all Subjects from this Observer. More... | |
Protected Attributes | |
T * | mT |
Store the pointer to the full object. More... | |
Subject * | mSubjectBase |
Store the pointer to the virtual Subject base. More... | |
std::set< const Subject * > | mSubjects |
List of current Subjects for this Observer. More... | |
sub_ptr is a pointer to a Subject.
It can be used as a pointer to any class that publicly inherits Subject. If the instance that it is pointing to is ever destroyed, the sub_ptr class will start pointing to a nullptr. You can check the return of sub_ptr::valid() to see if the pointer is still valid.
dart::common::sub_ptr< T >::sub_ptr |
Default constructor.
dart::common::sub_ptr< T >::sub_ptr | ( | T * | _ptr | ) |
Alternative constructor.
_ptr must be a valid pointer when passed to this constructor.
|
protectedinherited |
T * dart::common::sub_ptr< T >::get |
|
overrideprotectedvirtual |
Called by receiveDestructionNotification().
Override this function to customize your class's response to destruction notifications.
Reimplemented from dart::common::Observer.
dart::common::sub_ptr< T >::operator T* |
Implicit conversion to pointer type.
T & dart::common::sub_ptr< T >::operator* |
Dereferencing operator.
T * dart::common::sub_ptr< T >::operator-> |
Dereferencing operation.
sub_ptr< T > & dart::common::sub_ptr< T >::operator= | ( | const sub_ptr< T > & | _sp | ) |
sub_ptr< T > & dart::common::sub_ptr< T >::operator= | ( | T * | _ptr | ) |
|
protectedinherited |
Called whenever a Subject is destroyed (or sends out a destruction notification).
Override handleDestructionNotification() in order to customize your class's response to destruction notifications.
|
protectedinherited |
Remove all Subjects from this Observer.
|
protectedinherited |
void dart::common::sub_ptr< T >::set | ( | T * | _ptr | ) |
Set the subject of this sub_ptr.
bool dart::common::sub_ptr< T >::valid |
|
protected |
Store the pointer to the virtual Subject base.
|
protectedinherited |
List of current Subjects for this Observer.
|
protected |
Store the pointer to the full object.