WeakPluginPtr is a non-reference-holding smart pointer for a Plugin. WeakPluginPtr is analogous to std::weak_ptr where PluginPtr is analogous to std::shared_ptr. More...
#include <WeakPluginPtr.hh>
Public Member Functions | |
WeakPluginPtr () | |
Default constructor. More... | |
WeakPluginPtr (const PluginPtr &_ptr) | |
Construct from a live PluginPtr. More... | |
WeakPluginPtr (const WeakPluginPtr &_other) | |
Copy constructor. More... | |
WeakPluginPtr (WeakPluginPtr &&_other) | |
Move constructor. More... | |
~WeakPluginPtr () | |
Destructor. More... | |
bool | IsExpired () const |
Check whether the referenced Plugin has already expired. More... | |
PluginPtr | Lock () const |
Retrieve the PluginPtr that this WeakPluginPtr refers to, if it is still available. Otherwise, retrieve an empty PluginPtr. More... | |
WeakPluginPtr & | operator= (const PluginPtr &_ptr) |
Assign from a live PluginPtr. More... | |
WeakPluginPtr & | operator= (const WeakPluginPtr &_other) |
Copy assignment operator. More... | |
WeakPluginPtr & | operator= (WeakPluginPtr &&_other) |
Move assignment operator. More... | |
Detailed Description
WeakPluginPtr is a non-reference-holding smart pointer for a Plugin. WeakPluginPtr is analogous to std::weak_ptr where PluginPtr is analogous to std::shared_ptr.
Use Lock() to receive a reference-holding PluginPtr that points to the Plugin that this WeakPluginPtr is meant to reference.
If the Plugin is deleted while this WeakPluginPtr is referring to it, then Lock() will return an empty PluginPtr, and IsExpired() will return true.
Constructor & Destructor Documentation
◆ WeakPluginPtr() [1/4]
WeakPluginPtr | ( | ) |
Default constructor.
◆ WeakPluginPtr() [2/4]
WeakPluginPtr | ( | const WeakPluginPtr & | _other | ) |
Copy constructor.
- Parameters
-
[in] _other Another WeakPluginPtr to copy
◆ WeakPluginPtr() [3/4]
WeakPluginPtr | ( | WeakPluginPtr && | _other | ) |
Move constructor.
- Parameters
-
[in] _other Another WeakPluginPtr to move from
◆ WeakPluginPtr() [4/4]
WeakPluginPtr | ( | const PluginPtr & | _ptr | ) |
◆ ~WeakPluginPtr()
~WeakPluginPtr | ( | ) |
Destructor.
Member Function Documentation
◆ IsExpired()
bool IsExpired | ( | ) | const |
Check whether the referenced Plugin has already expired.
- Returns
- true if this PluginPtr is expired, false otherwise.
◆ Lock()
PluginPtr Lock | ( | ) | const |
Retrieve the PluginPtr that this WeakPluginPtr refers to, if it is still available. Otherwise, retrieve an empty PluginPtr.
- Returns
- The PluginPtr that this WeakPluginPtr refers to.
◆ operator=() [1/3]
WeakPluginPtr& operator= | ( | const PluginPtr & | _ptr | ) |
◆ operator=() [2/3]
WeakPluginPtr& operator= | ( | const WeakPluginPtr & | _other | ) |
Copy assignment operator.
- Parameters
-
[in] _other Another WeakPluginPtr to copy
- Returns
- reference to this
◆ operator=() [3/3]
WeakPluginPtr& operator= | ( | WeakPluginPtr && | _other | ) |
Move assignment operator.
- Parameters
-
[in] _other Another WeakPluginPtr to move from
- Returns
- reference to this
The documentation for this class was generated from the following file: