Class real_time_tools::ThreadsafeObject¶
-
template<typename ...
Types
>
classreal_time_tools
::
ThreadsafeObject
¶ This object can have several types depending on what ones want to store.
- Template Parameters
Types
:
Public Types
Public Functions
-
ThreadsafeObject
()¶ Construct a new ThreadsafeObject object.
-
void
wait_for_update
(unsigned index) const¶ Wait until the data with the deignated index is changed.
- Parameters
index
:
-
template<unsigned
INDEX
= 0>
voidwait_for_update
() const¶ Wait until the data with the designated index is changed.
- Template Parameters
INDEX=0
:
-
size_t
wait_for_update
() const¶ Wait until any data has been changed.
- Return
size_t
-
template<int
INDEX
= 0>
Type<INDEX>get
() const¶ Getters.
Get the data with the designated index. The index is resolved at compile time.
- Return
Type<INDEX>
- Template Parameters
INDEX=0
:
-
template<int
INDEX
= 0>
voidset
(Type<INDEX> datum)¶ Setters.
Set the data with the designated index. The index is resolved at compile time.
- Template Parameters
INDEX=0
:
- Parameters
datum
:
-
template<int
INDEX
>
voidset
(ThreadsafeObject<Types...>::Type<INDEX> datum)¶ Setters.
Set the data with the designated index. The index is resolved at compile time.
- Template Parameters
INDEX=0
:
- Parameters
datum
:
Public Static Attributes
Private Members
-
std::shared_ptr<std::condition_variable>
condition_
¶ a condition variable that allow to wait until one data has been changed in the buffer.
-
std::shared_ptr<std::mutex>
condition_mutex_
¶ The mutex of the condition variable.
-
std::shared_ptr<std::array<size_t, SIZE>>
modification_counts_
¶ This is counting the data modification occurences for each individual buffers.
-
std::shared_ptr<size_t>
total_modification_count_
¶ This is counting the all data modification occurences for all buffer.
/todo Can’t we just some the modification_counts_ array whenever needed?