Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
AltModel< CASES > Struct Template Reference

#include "lib/parse.hpp"

Description

template<typename... CASES>
struct util::parse::AltModel< CASES >

Sum Model : results from a disjunction of parsing clauses, which are are tested and accepted as alternatives, one at least.

Definition at line 425 of file parse.hpp.

Public Types

using Alt = lib::BranchCase< CASES... >
 
template<typename EXTRA >
using Additionally = AltModel< CASES..., EXTRA >
 
using SubSeq = _Vari< AltModel, CASES... >::Prefix
 a nested sub-model to extend
 
using Penult = _Vari< AltModel, CASES... >::Penult
 plain value expected for left-branch
 
using Ultima = _Vari< AltModel, CASES... >::Ultima
 plain value expected for right-branch
 
- Public Types inherited from BranchCase< CASES... >
using SlotType = std::tuple_element_t< idx, tuple< TYPES... > >
 

Static Public Attributes

static constexpr size_t N = sizeof...(CASES)
 
- Static Public Attributes inherited from BranchCase< CASES... >
static constexpr auto TOP
 
static constexpr auto SIZ
 

Static Public Member Functions

static AltModel mark_left (SubSeq &&leftCases)
 
static AltModel mark_left (Penult &&leftCase)
 
static AltModel mark_right (Ultima &&rightCase)
 

Public Member Functions

template<typename EXTRA >
Additionally< EXTRA > addBranch ()
 
- Public Member Functions inherited from BranchCase< CASES... >
 BranchCase (size_t idx, INITS &&...inits)
 Standard constructor: select branch and provide initialiser.
 
 BranchCase (BranchCase const &o)
 
 BranchCase (BranchCase &&ro)
 
auto accept (FUN &&visitor)
 Accept a visitor-functor (double dispatch).
 
 ~BranchCase ()
 
BranchCaseoperator= (BranchCase ref)
 
size_t selected () const
 
SlotType< idx > & get ()
 re-access the value, using compile-time slot-index param.
 
auto getAny ()
 access the selected value of a homogeneous model.
 

Private Member Functions

template<typename INIT >
 AltModel (size_t branchID, INIT &&init)
 

Additional Inherited Members

- Protected Member Functions inherited from BranchCase< CASES... >
 BranchCase ()=default
 
TX & emplace (INITS &&...inits)
 
TX & access ()
 
auto selectBranch (FUN &&fun)
 apply generic functor to the currently selected branch
 
- Protected Attributes inherited from BranchCase< CASES... >
size_t branch_
 selector field to designate the chosen branch
 
std::byte buffer_ [SIZ]
 opaque inline storage buffer with suitable size and alignment
 

Constructor & Destructor Documentation

◆ AltModel()

template<typename... CASES>
template<typename INIT >
AltModel ( size_t  branchID,
INIT &&  init 
)
inlineprivate

Definition at line 469 of file parse.hpp.

Member Typedef Documentation

◆ Alt

template<typename... CASES>
using Alt = lib::BranchCase<CASES...>

Definition at line 428 of file parse.hpp.

◆ Additionally

template<typename... CASES>
template<typename EXTRA >
using Additionally = AltModel<CASES...,EXTRA>

Definition at line 432 of file parse.hpp.

◆ SubSeq

template<typename... CASES>
using SubSeq = _Vari<AltModel, CASES...>::Prefix

a nested sub-model to extend

Definition at line 445 of file parse.hpp.

◆ Penult

template<typename... CASES>
using Penult = _Vari<AltModel, CASES...>::Penult

plain value expected for left-branch

Definition at line 446 of file parse.hpp.

◆ Ultima

template<typename... CASES>
using Ultima = _Vari<AltModel, CASES...>::Ultima

plain value expected for right-branch

Definition at line 447 of file parse.hpp.

Member Function Documentation

◆ addBranch()

template<typename... CASES>
template<typename EXTRA >
Additionally< EXTRA > addBranch ( )
inline

Definition at line 436 of file parse.hpp.

◆ mark_left() [1/2]

template<typename... CASES>
static AltModel mark_left ( SubSeq &&  leftCases)
inlinestatic

Definition at line 450 of file parse.hpp.

◆ mark_left() [2/2]

template<typename... CASES>
static AltModel mark_left ( Penult &&  leftCase)
inlinestatic

Definition at line 456 of file parse.hpp.

References BranchCase< CASES... >::TOP.

◆ mark_right()

template<typename... CASES>
static AltModel mark_right ( Ultima &&  rightCase)
inlinestatic

Definition at line 462 of file parse.hpp.

References BranchCase< CASES... >::TOP.

Member Data Documentation

◆ N

template<typename... CASES>
constexpr size_t N = sizeof...(CASES)
staticconstexpr

Definition at line 429 of file parse.hpp.

+ Inheritance diagram for AltModel< CASES >:
+ Collaboration diagram for AltModel< CASES >:

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