sam::PolicyChain¶
Module: Policy-related Modules
Implementation of the PolicyChain class. More...
#include <Policy.h>
Public Functions¶
Name | |
---|---|
Policy & | operator[](std::size_t idx) |
const Policy & | operator[](std::size_t idx) const |
auto | begin() |
auto | cbegin() const |
auto | end() |
auto | cend() const |
bool | empty() const |
PolicyChain() =default | |
PolicyChain(const PolicyChainDefinition & pchain_defs, PolicyChainType type, sol::state & lua) PolicyChain constructor. |
|
bool | operator()(const Submission & sub) Checks whether the given Submission satisfies all all policies. |
bool | operator()(const DependentVariable & dv) Checks whether the given DependentVariable satisfies all the policies. |
bool | operator()(DependentVariable & dv) |
bool | operator()(Experiment * experiment) Determines whether the experiment satisfies any of the given policies. |
std::optional< std::vector< Submission > > | operator()(Experiment & experiment) Returns a list of submission satisfying the policy chain. |
std::optional< std::vector< Submission > > | operator()(std::vector< Submission > & spool) Returns a list of submissions satisfying the policy chain. |
Public Attributes¶
Name | |
---|---|
PolicyChainType | type_ |
PolicyChainDefinition | defs |
std::vector< Policy > | pchain |
Detailed Description¶
struct sam::PolicyChain;
Implementation of the PolicyChain class.
PolicyChains are a list of Policies that will be executed chronologically. They are often being used to check whether an Experiment or a Submission can satisfy all the given policies.
PolicyChains can be defined in two different ways. They are either a selection or decision chains. The ::Selection
chains are used to filter an experiment or a list of submissions based on the given policies. The ::Decision
chains are used to check whether any of the submissions or dependent variables are satisfying all the available policies in the given chain.
Public Functions Documentation¶
function operator[]¶
inline Policy & operator[](
std::size_t idx
)
function operator[]¶
inline const Policy & operator[](
std::size_t idx
) const
function begin¶
inline auto begin()
function cbegin¶
inline auto cbegin() const
function end¶
inline auto end()
function cend¶
inline auto cend() const
function empty¶
inline bool empty() const
function PolicyChain¶
PolicyChain() =default
function PolicyChain¶
PolicyChain(
const PolicyChainDefinition & pchain_defs,
PolicyChainType type,
sol::state & lua
)
PolicyChain constructor.
It constructs a PolicyChain object, and it also takes care of a few other things like making sure that no comparison operator comes after any of the function calls. It also sets the type of the PolicyChain, as described in PolicyChainType.
function operator()¶
bool operator()(
const Submission & sub
)
Checks whether the given Submission satisfies all all policies.
Parameters:
- sub The submission
Return: The result of applying all policies on the given submission
function operator()¶
bool operator()(
const DependentVariable & dv
)
Checks whether the given DependentVariable satisfies all the policies.
Parameters:
- dv The dependent variable
Return: The result of applying all policies on the given dv
function operator()¶
bool operator()(
DependentVariable & dv
)
function operator()¶
bool operator()(
Experiment * experiment
)
Determines whether the experiment satisfies any of the given policies.
Return: Returns true
if at least one DV satisfies all the policies, otherwise false
.
Todo: Refactor this such that it accepts a reference
This checks whether any of the DependentVariable(s) are satisfying all the policies of the chain.
function operator()¶
std::optional< std::vector< Submission > > operator()(
Experiment & experiment
)
Returns a list of submission satisfying the policy chain.
Parameters:
- expr The experiment
Return: An optional list of submissions
Note: Only dependent variables of the treatment group will be considered.
This applies the policy chain on the Experiment and returns a list of submissions (constructed from dependent variables of the experiment) that are satisfying all the available policies.
function operator()¶
std::optional< std::vector< Submission > > operator()(
std::vector< Submission > & spool
)
Returns a list of submissions satisfying the policy chain.
Parameters:
- spool The list of submissions
Return: A subset of spool
, if any
This applies all the available policies of the chain on the given pool of submissions and if there were any hit, it returns those. If not, it will report an empty list.
Public Attributes Documentation¶
variable type_¶
PolicyChainType type_;
variable defs¶
PolicyChainDefinition defs;
variable pchain¶
std::vector< Policy > pchain;
Updated on 29 June 2021 at 16:13:48 CEST