Gazebo Plugin

API Reference

2.0.3
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. 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...
 
WeakPluginPtroperator= (const PluginPtr &_ptr)
 Assign from a live PluginPtr. More...
 
WeakPluginPtroperator= (const WeakPluginPtr &_other)
 Copy assignment operator. More...
 
WeakPluginPtroperator= (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]

Default constructor.

◆ WeakPluginPtr() [2/4]

WeakPluginPtr ( const WeakPluginPtr _other)

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]

WeakPluginPtr ( const PluginPtr _ptr)

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]

WeakPluginPtr& operator= ( const PluginPtr _ptr)

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]

WeakPluginPtr& operator= ( const WeakPluginPtr _other)

Copy assignment operator.

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

◆ operator=() [3/3]

WeakPluginPtr& operator= ( WeakPluginPtr &&  _other)

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: