Support Class Library
A set of tools providing classes and utility
Public Types | Public Member Functions | Public Attributes | List of all members
scl::async::details::channel_actor_traits< Actor > Struct Template Reference

Traits for actors that interact with the channel. More...

#include "Channel.h"

Public Types

using actor_type = Actor
 The type of the actor. More...
 
using channel_type = typename actor_type::channel_type
 The type of the channel. More...
 
using lock_type = typename channel_type::lock_type
 The type of lock used by the channel. More...
 
template<class L >
using guard_type = typename channel_type::template guard_type< L >
 
using value_type = typename channel_type::value_type
 The type of values transmitted through channels. More...
 
using queue_type = typename channel_type::queue_type
 The type of the queue used in the channel. More...
 

Public Member Functions

 channel_actor_traits (actor_type &act)
 Construct a trait from a pointer to its actor. More...
 
void lock ()
 Lock the channel. More...
 
void unlock ()
 Unlock the channel. More...
 
void notify ()
 Notify the channel. More...
 
void wait ()
 Wait for the channel. More...
 
template<class Pred >
void waitUntil (Pred &&pred)
 Wait for the channel until a condition is met. More...
 
template<class Rep , class Period >
std::cv_status waitFor (const std::chrono::duration< Rep, Period > &time)
 Wait for a specific duration for the channel. More...
 
template<class Rep , class Period , class Pred >
bool waitFor (const std::chrono::duration< Rep, Period > &time, Pred &&pred)
 Wait for a given period of time until the predicate is satisfied. More...
 

Public Attributes

actor_typeactor
 A (safe) pointer to the actor. More...
 
std::unique_lock< lock_typelock_
 The handle to the channel's lock. More...
 

Detailed Description

template<class Actor>
struct scl::async::details::channel_actor_traits< Actor >

Traits for actors that interact with the channel.

Template Parameters
Actorbeing the type of the actor

Definition at line 73 of file Channel.h.

Member Typedef Documentation

◆ actor_type

template<class Actor>
scl::async::details::channel_actor_traits< Actor >::actor_type

The type of the actor.

Definition at line 78 of file Channel.h.

◆ channel_type

The type of the channel.

Definition at line 84 of file Channel.h.

◆ guard_type

template<class Actor>
template<class L >
scl::async::details::channel_actor_traits< Actor >::guard_type
Template Parameters
Lbeing the type of lock The type of guard used to protect the lock

Definition at line 98 of file Channel.h.

◆ lock_type

template<class Actor>
scl::async::details::channel_actor_traits< Actor >::lock_type

The type of lock used by the channel.

Definition at line 90 of file Channel.h.

◆ queue_type

template<class Actor>
scl::async::details::channel_actor_traits< Actor >::queue_type

The type of the queue used in the channel.

Definition at line 110 of file Channel.h.

◆ value_type

template<class Actor>
scl::async::details::channel_actor_traits< Actor >::value_type

The type of values transmitted through channels.

Definition at line 104 of file Channel.h.

Constructor & Destructor Documentation

◆ channel_actor_traits()

template<class Actor>
scl::async::details::channel_actor_traits< Actor >::channel_actor_traits ( actor_type act)
inlineexplicit

Construct a trait from a pointer to its actor.

Parameters
actbeing a (safe) pointer to the actor

Definition at line 126 of file Channel.h.

Member Function Documentation

◆ lock()

template<class Actor>
void scl::async::details::channel_actor_traits< Actor >::lock ( )
inline

Lock the channel.

Definition at line 133 of file Channel.h.

◆ notify()

template<class Actor>
void scl::async::details::channel_actor_traits< Actor >::notify ( )
inline

Notify the channel.

Definition at line 147 of file Channel.h.

◆ unlock()

template<class Actor>
void scl::async::details::channel_actor_traits< Actor >::unlock ( )
inline

Unlock the channel.

Definition at line 140 of file Channel.h.

◆ wait()

template<class Actor>
void scl::async::details::channel_actor_traits< Actor >::wait ( )
inline

Wait for the channel.

Warning
locks, will need to unlock afterward

Definition at line 156 of file Channel.h.

◆ waitFor() [1/2]

template<class Actor>
template<class Rep , class Period >
std::cv_status scl::async::details::channel_actor_traits< Actor >::waitFor ( const std::chrono::duration< Rep, Period > &  time)
inline

Wait for a specific duration for the channel.

Template Parameters
Repbeing the time representation type
Periodbeing the time period type
Parameters
timebeing the time to wait
Returns
TIMEOUT if it waited for time, NO_TIMEOUT otherwise
Warning
locks, will need to unlock afterward

Definition at line 187 of file Channel.h.

◆ waitFor() [2/2]

template<class Actor>
template<class Rep , class Period , class Pred >
bool scl::async::details::channel_actor_traits< Actor >::waitFor ( const std::chrono::duration< Rep, Period > &  time,
Pred &&  pred 
)
inline

Wait for a given period of time until the predicate is satisfied.

Template Parameters
Repbeing the time representation type
Periodbeing the time period type
Parameters
timebeing the time to wait
predbeing the predicate to satisfy
Returns
TRUE if the predicate was satisified, FALSE otherwise
Warning
locks, will need to unlock afterward

Definition at line 203 of file Channel.h.

◆ waitUntil()

template<class Actor>
template<class Pred >
void scl::async::details::channel_actor_traits< Actor >::waitUntil ( Pred &&  pred)
inline

Wait for the channel until a condition is met.

Template Parameters
Predbeing the type of the predicate
Parameters
predbeing the predicate to match
Warning
locks, will need to unlock afterward

Definition at line 169 of file Channel.h.

Member Data Documentation

◆ actor

template<class Actor>
actor_type* scl::async::details::channel_actor_traits< Actor >::actor

A (safe) pointer to the actor.

Definition at line 115 of file Channel.h.

◆ lock_

template<class Actor>
std::unique_lock<lock_type> scl::async::details::channel_actor_traits< Actor >::lock_

The handle to the channel's lock.

Definition at line 120 of file Channel.h.


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