Represents shared state wrapper for thread pool tasks.
More...
#include <SharedState.hpp>
|
class | Action |
| Represents possible actions for modification of the state. More...
|
|
|
template<typename... A, typename = std::enable_if_t<std::is_constructible_v<T, A...>>> |
| SharedState (A &&... args) |
| Constructor. More...
|
|
void | view (std::function< void(const T &)> block) const |
| Provides read access to state within a block. More...
|
|
template<typename R > |
R | view (std::function< R(const T &)> block) const |
| Provides read access to state within a block and return value. More...
|
|
void | modify (std::function< void(T &)> block) |
| Provides read and write access to state within a block. More...
|
|
Action | modify () |
| Provides read and write actions with state. More...
|
|
template<typename T>
class CppMate::SharedState< T >
Represents shared state wrapper for thread pool tasks.
◆ SharedState()
template<typename T >
template<typename... A, typename = std::enable_if_t<std::is_constructible_v<T, A...>>>
Constructor.
- Parameters
-
args | arguments to pass in T object constructor. |
◆ modify() [1/2]
Provides read and write actions with state.
- Returns
- an action to choose.
◆ modify() [2/2]
Provides read and write access to state within a block.
- Parameters
-
◆ view() [1/2]
template<typename T >
template<typename R >
Provides read access to state within a block and return value.
- Parameters
-
- Returns
- result of the block call.
◆ view() [2/2]
Provides read access to state within a block.
- Parameters
-
The documentation for this class was generated from the following file: