Murl::DoubleBuffer< DataType > Class Template Reference

A double buffer template class. More...

#include "murl_double_buffer.h"

Public Types

using ValueType = DataType
 The template parameter value type.
 

Public Member Functions

 DoubleBuffer ()
 The default constructor.
 
 DoubleBuffer (const DataType &value)
 The constructor taking a default value. More...
 
void Reset ()
 Reset the read and write value with the value's default constructor.
 
void Reset (const DataType &value)
 Reset the read and write value with a given value. More...
 
void ResetReadValue ()
 Reset the read value with the value's default constructor.
 
void ResetReadValue (const DataType &value)
 Reset the read value with a given value. More...
 
void ResetWriteValue ()
 Reset the write value with the value's default constructor.
 
void ResetWriteValue (const DataType &value)
 Reset the write value with a given value. More...
 
void Update ()
 Assign the write value to the read value.
 
void Update (const DataType &value)
 Assign the write value to the read value and set the write value. More...
 
Bool HasChanged () const
 Check if the write value has changed. More...
 
Bool UpdateChanged ()
 Check if the write value has changed and update. More...
 
void SetValue (const DataType &value)
 Set the write value. More...
 
const DataType & GetValue () const
 Get the read value. More...
 
DataType & GetValue ()
 Get the mutable read value. More...
 
const DataType & GetWriteValue () const
 Get the write value. More...
 
DataType & GetWriteValue ()
 Get the mutable write value. More...
 
DoubleBufferoperator= (const DataType &value)
 Set the write value (assignment operator). More...
 
 operator const DataType & () const
 Get the read value (conversion operator). More...
 

Detailed Description

template<class DataType>
class Murl::DoubleBuffer< DataType >

A double buffer template class.

The double buffer holds a read and write value and can check the change of the values.

Constructor & Destructor Documentation

◆ DoubleBuffer()

template<class DataType >
Murl::DoubleBuffer< DataType >::DoubleBuffer ( const DataType &  value)
inlineexplicit

The constructor taking a default value.

Parameters
valueThe read and write value.

Member Function Documentation

◆ Reset()

template<class DataType >
void Murl::DoubleBuffer< DataType >::Reset ( const DataType &  value)
inline

Reset the read and write value with a given value.

Parameters
valueThe read and write value.

◆ ResetReadValue()

template<class DataType >
void Murl::DoubleBuffer< DataType >::ResetReadValue ( const DataType &  value)
inline

Reset the read value with a given value.

Parameters
valueThe read value.

◆ ResetWriteValue()

template<class DataType >
void Murl::DoubleBuffer< DataType >::ResetWriteValue ( const DataType &  value)
inline

Reset the write value with a given value.

Parameters
valueThe write value.

◆ Update()

template<class DataType >
void Murl::DoubleBuffer< DataType >::Update ( const DataType &  value)
inline

Assign the write value to the read value and set the write value.

Parameters
valueThe write value.

References Murl::DoubleBuffer< DataType >::Update().

◆ HasChanged()

template<class DataType >
Bool Murl::DoubleBuffer< DataType >::HasChanged ( ) const
inline

Check if the write value has changed.

Returns
true if the write value is not equal to the read value.

Referenced by Murl::DoubleBuffer< DataType >::UpdateChanged().

◆ UpdateChanged()

template<class DataType >
Bool Murl::DoubleBuffer< DataType >::UpdateChanged ( )
inline

Check if the write value has changed and update.

If true assign the write value to the read value.

Returns
true if the write value was not equal to the read value.

References Murl::DoubleBuffer< DataType >::HasChanged(), and Murl::DoubleBuffer< DataType >::Update().

◆ SetValue()

template<class DataType >
void Murl::DoubleBuffer< DataType >::SetValue ( const DataType &  value)
inline

Set the write value.

Parameters
valueThe write value.

Referenced by Murl::DoubleBuffer< DataType >::operator=().

◆ GetValue() [1/2]

template<class DataType >
const DataType& Murl::DoubleBuffer< DataType >::GetValue ( ) const
inline

Get the read value.

Returns
The read value.

Referenced by Murl::DoubleBuffer< AccountStatus >::operator const AccountStatus &().

◆ GetValue() [2/2]

template<class DataType >
DataType& Murl::DoubleBuffer< DataType >::GetValue ( )
inline

Get the mutable read value.

Returns
The mutable read value.

◆ GetWriteValue() [1/2]

template<class DataType >
const DataType& Murl::DoubleBuffer< DataType >::GetWriteValue ( ) const
inline

Get the write value.

Returns
The write value.

◆ GetWriteValue() [2/2]

template<class DataType >
DataType& Murl::DoubleBuffer< DataType >::GetWriteValue ( )
inline

Get the mutable write value.

Returns
The mutable write value.

◆ operator=()

template<class DataType >
DoubleBuffer& Murl::DoubleBuffer< DataType >::operator= ( const DataType &  value)
inline

Set the write value (assignment operator).

Parameters
valueThe write value.
Returns
The object itself.

References Murl::DoubleBuffer< DataType >::SetValue().

◆ operator const DataType &()

template<class DataType >
Murl::DoubleBuffer< DataType >::operator const DataType & ( ) const
inline

Get the read value (conversion operator).

Returns
The read value.

The documentation for this class was generated from the following file:
  • murl_double_buffer.h


Copyright © 2011-2024 Spraylight GmbH.