Derecho  0.9
Distributed systems toolkit for RDMA
Classes | Public Member Functions | Private Types | Private Attributes | Friends | List of all members
sst::Predicates< DerivedSST > Class Template Reference

#include <predicates.hpp>

Collaboration diagram for sst::Predicates< DerivedSST >:
Collaboration graph
[legend]

Classes

class  pred_handle
 

Public Member Functions

pred_handle insert (pred predicate, trig trigger, PredicateType type=PredicateType::ONE_TIME)
 Inserts a single (predicate, trigger) pair to the appropriate predicate list. More...
 
pred_handle insert (pred predicate, const std::list< trig > &triggers, PredicateType type=PredicateType::ONE_TIME)
 Inserts a predicate with a list of triggers (which will be run in sequence) to the appropriate predicate list. More...
 
void remove (pred_handle &pred)
 Removes a (predicate, trigger) pair previously registered with insert(). More...
 
void clear ()
 Deletes all predicates, including evolvers and their triggers. More...
 

Private Types

using pred = std::function< bool(const DerivedSST &)>
 
using trig = std::function< void(DerivedSST &)>
 
using pred_list = std::list< std::unique_ptr< std::pair< pred, std::shared_ptr< trig > >> >
 

Private Attributes

pred_list one_time_predicates
 Predicate list for one-time predicates. More...
 
pred_list recurrent_predicates
 Predicate list for recurrent predicates. More...
 
pred_list transition_predicates
 Predicate list for transition predicates. More...
 
std::list< bool > transition_predicate_states
 Contains one entry for every predicate in transition_predicates, in parallel. More...
 
std::mutex predicate_mutex
 

Friends

class SST< DerivedSST >
 

Detailed Description

template<class DerivedSST>
class sst::Predicates< DerivedSST >

Definition at line 28 of file predicates.hpp.

Member Typedef Documentation

◆ pred

template<class DerivedSST>
using sst::Predicates< DerivedSST >::pred = std::function<bool(const DerivedSST&)>
private

Definition at line 29 of file predicates.hpp.

◆ pred_list

template<class DerivedSST>
using sst::Predicates< DerivedSST >::pred_list = std::list<std::unique_ptr<std::pair<pred, std::shared_ptr<trig> >> >
private

Definition at line 31 of file predicates.hpp.

◆ trig

template<class DerivedSST>
using sst::Predicates< DerivedSST >::trig = std::function<void(DerivedSST&)>
private

Definition at line 30 of file predicates.hpp.

Member Function Documentation

◆ clear()

template<class DerivedSST >
void sst::Predicates< DerivedSST >::clear ( )

Deletes all predicates, including evolvers and their triggers.

Definition at line 136 of file predicates.hpp.

◆ insert() [1/2]

template<class DerivedSST >
auto sst::Predicates< DerivedSST >::insert ( pred  predicate,
trig  trigger,
PredicateType  type = PredicateType::ONE_TIME 
)

Inserts a single (predicate, trigger) pair to the appropriate predicate list.

This is a convenience method for when the predicate has only one trigger; it automatically chooses the right list based on the predicate type.

To insert a predicate with multiple triggers, use std::list::insert() directly on the appropriate predicate list member.

Parameters
predicateThe predicate to insert.
triggerThe trigger to execute when the predicate is true.
typeThe type of predicate being inserted; default is PredicateType::ONE_TIME

Definition at line 107 of file predicates.hpp.

◆ insert() [2/2]

template<class DerivedSST>
pred_handle sst::Predicates< DerivedSST >::insert ( pred  predicate,
const std::list< trig > &  triggers,
PredicateType  type = PredicateType::ONE_TIME 
)
inline

Inserts a predicate with a list of triggers (which will be run in sequence) to the appropriate predicate list.

Definition at line 80 of file predicates.hpp.

◆ remove()

template<class DerivedSST >
void sst::Predicates< DerivedSST >::remove ( pred_handle pred)

Removes a (predicate, trigger) pair previously registered with insert().

Definition at line 126 of file predicates.hpp.

Friends And Related Function Documentation

◆ SST< DerivedSST >

template<class DerivedSST>
friend class SST< DerivedSST >
friend

Definition at line 41 of file predicates.hpp.

Member Data Documentation

◆ one_time_predicates

template<class DerivedSST>
pred_list sst::Predicates< DerivedSST >::one_time_predicates
private

Predicate list for one-time predicates.

Definition at line 33 of file predicates.hpp.

◆ predicate_mutex

template<class DerivedSST>
std::mutex sst::Predicates< DerivedSST >::predicate_mutex
private

Definition at line 43 of file predicates.hpp.

◆ recurrent_predicates

template<class DerivedSST>
pred_list sst::Predicates< DerivedSST >::recurrent_predicates
private

Predicate list for recurrent predicates.

Definition at line 35 of file predicates.hpp.

◆ transition_predicate_states

template<class DerivedSST>
std::list<bool> sst::Predicates< DerivedSST >::transition_predicate_states
private

Contains one entry for every predicate in transition_predicates, in parallel.

Definition at line 39 of file predicates.hpp.

◆ transition_predicates

template<class DerivedSST>
pred_list sst::Predicates< DerivedSST >::transition_predicates
private

Predicate list for transition predicates.

Definition at line 37 of file predicates.hpp.


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