opensurgsim
Public Member Functions | List of all members
SurgSim::DataStructures::BufferedValue< T > Class Template Reference

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 <BufferedValue.h>

Public Member Functions

 BufferedValue (const T &value)
 
 ~BufferedValue ()
 Destructor.
 
void publish ()
 Make the current value the one returned by calls to safeGet.
 
T & unsafeGet ()
 Get the value. More...
 
std::shared_ptr< const T > safeGet () const
 Get the buffered value. More...
 

Detailed Description

template<class T>
class SurgSim::DataStructures::BufferedValue< T >

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.

Template Parameters
TType that is used for the value.

Constructor & Destructor Documentation

§ BufferedValue()

template<class T>
SurgSim::DataStructures::BufferedValue< T >::BufferedValue ( const T &  value)
explicit
Parameters
valueDefault value.

Member Function Documentation

§ safeGet()

template<class T >
std::shared_ptr< const T > SurgSim::DataStructures::BufferedValue< T >::safeGet ( ) const

Get the buffered value.

Returns
The value at the last call to publish.

§ unsafeGet()

template<class T >
T & SurgSim::DataStructures::BufferedValue< T >::unsafeGet ( )

Get the value.

Returns
A reference to the value.

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