Gazebo Plugin

API Reference

3.0.0
WeakPluginPtr Class Reference

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.
 
 WeakPluginPtr (const PluginPtr &_ptr)
 Construct from a live PluginPtr.
 
 WeakPluginPtr (const WeakPluginPtr &_other)
 Copy constructor.
 
 WeakPluginPtr (WeakPluginPtr &&_other)
 Move constructor.
 
 ~WeakPluginPtr ()
 Destructor.
 
bool IsExpired () const
 Check whether the referenced Plugin has already expired.
 
PluginPtr Lock () const
 Retrieve the PluginPtr that this WeakPluginPtr refers to, if it is still available. Otherwise, retrieve an empty PluginPtr.
 
WeakPluginPtroperator= (const PluginPtr &_ptr)
 Assign from a live PluginPtr.
 
WeakPluginPtroperator= (const WeakPluginPtr &_other)
 Copy assignment operator.
 
WeakPluginPtroperator= (WeakPluginPtr &&_other)
 Move assignment operator.
 

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]

Default constructor.

◆ WeakPluginPtr() [2/4]

Copy constructor.

Parameters
[in]_otherAnother WeakPluginPtr to copy

◆ WeakPluginPtr() [3/4]

WeakPluginPtr ( WeakPluginPtr &&  _other)

Move constructor.

Parameters
[in]_otherAnother WeakPluginPtr to move from

◆ WeakPluginPtr() [4/4]

Construct from a live PluginPtr.

Parameters
[in]_ptrA live PluginPtr to refer to. As long as the Plugin instance continues to be held by PluginPtr containers, you can use Lock() to retrieve a reference to it.

◆ ~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]

Assign from a live PluginPtr.

Parameters
[in]_ptrA live PluginPtr to refer to. As long as the Plugin instance continues to be held by PluginPtr containers, you can use Lock() to retrieve a reference to it.

◆ operator=() [2/3]

Copy assignment operator.

Parameters
[in]_otherAnother WeakPluginPtr to copy
Returns
reference to this

◆ operator=() [3/3]

Move assignment operator.

Parameters
[in]_otherAnother WeakPluginPtr to move from
Returns
reference to this

The documentation for this class was generated from the following file: