FireSTARR
Loading...
Searching...
No Matches
fs::util::SafeVector Class Reference

A vector with added thread safety. More...

#include <SafeVector.h>

Collaboration diagram for fs::util::SafeVector:

Public Member Functions

 ~SafeVector ()=default
 Destructor.
 
 SafeVector ()=default
 Construct empty SafeVector.
 
 SafeVector (const SafeVector &rhs)
 Copy constructor.
 
 SafeVector (SafeVector &&rhs) noexcept
 Move constructor.
 
SafeVectoroperator= (const SafeVector &rhs) noexcept
 Copy assignment operator.
 
SafeVectoroperator= (SafeVector &&rhs) noexcept
 Move assignment operator.
 
void addValue (MathSize value)
 Add a value to the SafeVector.
 
std::vector< MathSize > getValues () const
 Get a vector with the stored values.
 
Statistics getStatistics () const
 Calculate Statistics for values in this SafeVector.
 
size_t size () const noexcept
 Number of values in the SafeVector.
 

Private Attributes

std::vector< MathSize > values_ {}
 Vector of stored values.
 
mutex mutex_ {}
 Mutex for parallel access.
 

Detailed Description

A vector with added thread safety.

Constructor & Destructor Documentation

◆ SafeVector() [1/2]

fs::util::SafeVector::SafeVector ( const SafeVector & rhs)

Copy constructor.

Parameters
rhsSafeVector to copy from

◆ SafeVector() [2/2]

fs::util::SafeVector::SafeVector ( SafeVector && rhs)
noexcept

Move constructor.

Parameters
rhsSafeVector to move from

Member Function Documentation

◆ addValue()

void fs::util::SafeVector::addValue ( MathSize value)

Add a value to the SafeVector.

Parameters
valueValue to add
Here is the caller graph for this function:

◆ getStatistics()

Statistics fs::util::SafeVector::getStatistics ( ) const
nodiscard

Calculate Statistics for values in this SafeVector.

Returns
Statistics for values in this SafeVector
Here is the call graph for this function:

◆ getValues()

vector< MathSize > fs::util::SafeVector::getValues ( ) const
nodiscard

Get a vector with the stored values.

Returns
A vector with the stored values
Here is the caller graph for this function:

◆ operator=() [1/2]

SafeVector & fs::util::SafeVector::operator= ( const SafeVector & rhs)
noexcept

Copy assignment operator.

Parameters
rhsSafeVector to copy from
Returns
This, after assignment

◆ operator=() [2/2]

SafeVector & fs::util::SafeVector::operator= ( SafeVector && rhs)
noexcept

Move assignment operator.

Parameters
rhsSafeVector to move from
Returns
This, after assignment

◆ size()

size_t fs::util::SafeVector::size ( ) const
nodiscardnoexcept

Number of values in the SafeVector.

Returns
Size of the SafeVector

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