CARLA
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
carla::RecurrentSharedFuture< T > Class Template Reference

This class is meant to be used similar to a shared future, but the value can be set any number of times. More...

#include <RecurrentSharedFuture.h>

+ Inheritance diagram for carla::RecurrentSharedFuture< T >:
+ Collaboration diagram for carla::RecurrentSharedFuture< T >:

Classes

struct  mapped_type
 

Public Types

using SharedException = detail::SharedException
 

Public Member Functions

template<typename ExceptionT >
void SetException (ExceptionT &&exception)
 Set a exception, this exception will be thrown on all the threads waiting. More...
 
template<typename T2 >
void SetValue (const T2 &value)
 Set the value and notify all waiting threads. More...
 
boost::optional< T > WaitFor (time_duration timeout)
 Wait until the next value is set. More...
 

Private Attributes

std::condition_variable _cv
 
std::map< const char *, mapped_type_map
 
std::mutex _mutex
 

Detailed Description

template<typename T>
class carla::RecurrentSharedFuture< T >

This class is meant to be used similar to a shared future, but the value can be set any number of times.

Definition at line 35 of file RecurrentSharedFuture.h.

Member Typedef Documentation

◆ SharedException

Definition at line 38 of file RecurrentSharedFuture.h.

Member Function Documentation

◆ SetException()

template<typename T >
template<typename ExceptionT >
void carla::RecurrentSharedFuture< T >::SetException ( ExceptionT &&  exception)

Set a exception, this exception will be thrown on all the threads waiting.

Note
The exception will be stored on a SharedException and thrown as such.

Definition at line 131 of file RecurrentSharedFuture.h.

Referenced by TEST().

+ Here is the caller graph for this function:

◆ SetValue()

template<typename T >
template<typename T2 >
void carla::RecurrentSharedFuture< T >::SetValue ( const T2 &  value)

Set the value and notify all waiting threads.

Definition at line 120 of file RecurrentSharedFuture.h.

Referenced by TEST().

+ Here is the caller graph for this function:

◆ WaitFor()

template<typename T >
boost::optional< T > carla::RecurrentSharedFuture< T >::WaitFor ( time_duration  timeout)

Wait until the next value is set.

Any number of threads can be waiting simultaneously.

Returns
empty optional if the timeout is met.

Definition at line 105 of file RecurrentSharedFuture.h.

Referenced by TEST().

+ Here is the caller graph for this function:

Member Data Documentation

◆ _cv

template<typename T>
std::condition_variable carla::RecurrentSharedFuture< T >::_cv
private

Definition at line 62 of file RecurrentSharedFuture.h.

◆ _map

template<typename T>
std::map<const char *, mapped_type> carla::RecurrentSharedFuture< T >::_map
private

Definition at line 69 of file RecurrentSharedFuture.h.

◆ _mutex

template<typename T>
std::mutex carla::RecurrentSharedFuture< T >::_mutex
private

Definition at line 60 of file RecurrentSharedFuture.h.


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