|
BufferedValue is a class to enable a representation of two values for one variable, where both values need to be accessible at the same time, one in a thread safe, single threaded context, the other in a thread unsafe context. More...
#include <SurgSim/DataStructures/BufferedValue.h>
Public Member Functions | |
| BufferedValue () | |
| BufferedValue (const T &value) | |
| ~BufferedValue () | |
| Destructor. More... | |
| void | publish () |
| Make the current value the one returned by calls to safeGet. More... | |
| T & | unsafeGet () |
| Get the value. More... | |
| std::shared_ptr< const T > | safeGet () const |
| Get the buffered value. More... | |
Private Types | |
| typedef boost::shared_lock< boost::shared_mutex > | SharedLock |
| typedef boost::unique_lock< boost::shared_mutex > | UniqueLock |
Private Attributes | |
| T | m_value |
| The raw value. More... | |
| std::shared_ptr< const T > | m_safeValue |
| The buffered value. More... | |
| boost::shared_mutex | m_mutex |
| The mutex used to lock for reading and writing. More... | |
BufferedValue is a class to enable a representation of two values for one variable, where both values need to be accessible at the same time, one in a thread safe, single threaded context, the other in a thread unsafe context.
| T | Type that is used for the value. |
|
private |
|
private |
| SurgSim::DataStructures::BufferedValue< T >::BufferedValue | ( | ) |
|
explicit |
| value | Default value. |
| SurgSim::DataStructures::BufferedValue< T >::~BufferedValue | ( | ) |
Destructor.
| void SurgSim::DataStructures::BufferedValue< T >::publish | ( | ) |
Make the current value the one returned by calls to safeGet.
| std::shared_ptr< const T > SurgSim::DataStructures::BufferedValue< T >::safeGet | ( | ) | const |
Get the buffered value.
| T & SurgSim::DataStructures::BufferedValue< T >::unsafeGet | ( | ) |
Get the value.
|
mutableprivate |
The mutex used to lock for reading and writing.
|
private |
The buffered value.
|
private |
The raw value.
1.8.13