16 #ifndef SURGSIM_DATASTRUCTURES_BUFFEREDVALUE_H
17 #define SURGSIM_DATASTRUCTURES_BUFFEREDVALUE_H
21 #include <boost/thread.hpp>
26 namespace DataStructures
56 std::shared_ptr<const T>
safeGet()
const;
59 typedef boost::shared_lock<boost::shared_mutex>
SharedLock;
60 typedef boost::unique_lock<boost::shared_mutex>
UniqueLock;
Definition: DriveElementFromInputBehavior.cpp:27
std::shared_ptr< const T > m_safeValue
The buffered value.
Definition: BufferedValue.h:66
~BufferedValue()
Destructor.
Definition: BufferedValue-inl.h:38
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.
Definition: BufferedValue.h:33
T & unsafeGet()
Get the value.
Definition: BufferedValue-inl.h:50
std::shared_ptr< const T > safeGet() const
Get the buffered value.
Definition: BufferedValue-inl.h:56
boost::unique_lock< boost::shared_mutex > UniqueLock
Definition: BufferedValue.h:60
BufferedValue()
Definition: BufferedValue-inl.h:25
boost::shared_lock< boost::shared_mutex > SharedLock
Definition: BufferedValue.h:59
boost::shared_mutex m_mutex
The mutex used to lock for reading and writing.
Definition: BufferedValue.h:69
The header that provides the assertion API.
void publish()
Make the current value the one returned by calls to safeGet.
Definition: BufferedValue-inl.h:43
T m_value
The raw value.
Definition: BufferedValue.h:63