Hegel 0.18.3
Property-based testing for C++
Loading...
Searching...
No Matches
hegel::stateful::ConcurrentRule< M > Class Template Reference

An action that a worker can apply to a concurrent state machine. More...

#include <stateful.h>

Public Types

using Step = std::function<void(TestCase&, M&)>
 The function the rule applies.

Public Member Functions

 ConcurrentRule (std::string name, Step step)
 Creates a rule in anonymous_group.
 ConcurrentRule (std::string name, std::vector< std::string > groups, Step step)
 Creates a rule in the specified groups.
 ConcurrentRule (std::string name, std::vector< std::string > groups, double weight, Step step)
 Creates a rule in the specified groups with a weight.
 ConcurrentRule (ConcurrentRuleParams< M > params)
 Creates a rule from named arguments.
const std::string & name () const
 Returns the name of the rule.
const std::vector< std::string > & groups () const
 Returns the concurrency groups of the rule.
double weight () const
 Returns the weight of the rule.
const Step & step () const
 Returns the function the rule applies.

Detailed Description

template<typename M>
class hegel::stateful::ConcurrentRule< M >

An action that a worker can apply to a concurrent state machine.

A rule belongs to one or more concurrency groups. Rules that share a group can run concurrently in the rounds of that group. Rules that share no group never overlap. A rule that belongs to several groups runs in the rounds of each of them. A rule that does not specify a group uses anonymous_group.

The engine rejects a rule with an empty group list or a repeated group when the machine starts, with std::invalid_argument.

Template Parameters
MThe state-machine type that the rule acts on

Constructor & Destructor Documentation

◆ ConcurrentRule() [1/4]

template<typename M>
hegel::stateful::ConcurrentRule< M >::ConcurrentRule ( std::string name,
Step step )
inline

Creates a rule in anonymous_group.

Parameters
nameThe name of the rule
stepThe function the rule applies.

◆ ConcurrentRule() [2/4]

template<typename M>
hegel::stateful::ConcurrentRule< M >::ConcurrentRule ( std::string name,
std::vector< std::string > groups,
Step step )
inline

Creates a rule in the specified groups.

Parameters
nameThe name of the rule
groupsThe concurrency groups of the rule
stepThe function the rule applies

◆ ConcurrentRule() [3/4]

template<typename M>
hegel::stateful::ConcurrentRule< M >::ConcurrentRule ( std::string name,
std::vector< std::string > groups,
double weight,
Step step )
inline

Creates a rule in the specified groups with a weight.

Parameters
nameThe name of the rule
groupsThe concurrency groups of the rule
weightThe selection weight of the rule
stepThe function the rule applies

◆ ConcurrentRule() [4/4]

template<typename M>
hegel::stateful::ConcurrentRule< M >::ConcurrentRule ( ConcurrentRuleParams< M > params)
inlineexplicit

Creates a rule from named arguments.

Parameters
paramsThe name, groups, weight and step of the rule

Member Function Documentation

◆ groups()

template<typename M>
const std::vector< std::string > & hegel::stateful::ConcurrentRule< M >::groups ( ) const
inline

Returns the concurrency groups of the rule.

Returns
The concurrency groups of the rule

◆ name()

template<typename M>
const std::string & hegel::stateful::ConcurrentRule< M >::name ( ) const
inline

Returns the name of the rule.

Returns
The name of the rule

◆ step()

template<typename M>
const Step & hegel::stateful::ConcurrentRule< M >::step ( ) const
inline

Returns the function the rule applies.

Returns
The function the rule applies

◆ weight()

template<typename M>
double hegel::stateful::ConcurrentRule< M >::weight ( ) const
inline

Returns the weight of the rule.

Returns
The weight of the rule

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