Vcsn  2.2
Be Rational
vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions > Class Template Reference

Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>. More...

#include <transition-map.hh>

Inheritance diagram for vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >:
Collaboration diagram for vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >:

Classes

struct  transition_
 Outgoing signature: weight, destination. More...
 
struct  transition_< bool, false, Dummy >
 Boolean outgoing signature: destination. More...
 
struct  transition_< bool, true, Dummy >
 Boolean outgoing signature: destination, transition identifier. More...
 
struct  transition_< Weight, true, Dummy >
 Weighted outgoing signature: weight, destination, transition identifier. More...
 

Public Types

using state_t = state_t_of< Aut >
 
using transition_t = transition_t_of< Aut >
 
using weightset_t = WeightSet
 
using weight_t = typename weightset_t::value_t
 
using transition = transition_< weight_t, KeepTransitions >
 Outgoing signature: weight, destination, and possibly transition identifier. More...
 
using transitions_t = std::conditional_t< Deterministic, transition, std::vector< transition >>
 
using map_t = std::map< label_t_of< Aut >, transitions_t, less< labelset_t_of< Aut >>>
 

Public Member Functions

 transition_map (const Aut &aut, const weightset_t &ws)
 
 transition_map (const Aut &aut)
 
map_toperator[] (state_t s)
 Outgoing transitions of state s, sorted by label. More...
 

Private Types

using maps_t = std::map< state_t, map_t >
 

Private Member Functions

template<bool Deterministic_>
void insert_ (map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t< Deterministic_ > *=nullptr)
 Insert l -> t in map. More...
 
template<bool Deterministic_>
void insert_ (map_t &map, label_t_of< Aut > l, transition t, std::enable_if_t<!Deterministic_ > *=nullptr)
 Insert l -> t in map. More...
 
map_tbuild_map_ (typename maps_t::iterator lb, state_t s)
 Build and return the transition map for state s, store at res. More...
 

Private Attributes

maps_t maps_
 The cache. More...
 
Aut aut_
 The automaton whose transitions are cached. More...
 
const weightset_tws_
 The result weightset. More...
 

Detailed Description

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
class vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >

Cache the outgoing transitions of an automaton as efficient maps label -> vector<(weight, dst)>.

Easy to zip.

Template Parameters
AutThe automaton type.
WeightSetThe set of weights into which the weights will be converted.
DeterministicWhether the automaton is guaranteed to be deterministic. If it is, transition_map[state][label] returns a single result, otherwise a vector.
AllOutWhether even the transitions to post() (via the special label) are to be included.
KeepTransitionsIf enabled, add a "transition" field to the cache that allows to recover the transition id.

Definition at line 33 of file transition-map.hh.

Member Typedef Documentation

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::map_t = std::map<label_t_of<Aut>, transitions_t, less<labelset_t_of<Aut>>>

Definition at line 104 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::maps_t = std::map<state_t, map_t>
private

Definition at line 126 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::state_t = state_t_of<Aut>

Definition at line 36 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::transition = transition_<weight_t, KeepTransitions>

Outgoing signature: weight, destination, and possibly transition identifier.

Definition at line 97 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::transition_t = transition_t_of<Aut>

Definition at line 37 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::transitions_t = std::conditional_t<Deterministic, transition, std::vector<transition>>

Definition at line 102 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::weight_t = typename weightset_t::value_t

Definition at line 39 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
using vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::weightset_t = WeightSet

Definition at line 38 of file transition-map.hh.

Constructor & Destructor Documentation

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::transition_map ( const Aut &  aut,
const weightset_t ws 
)
inline

Definition at line 106 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::transition_map ( const Aut &  aut)
inline

Definition at line 111 of file transition-map.hh.

Member Function Documentation

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
map_t& vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::build_map_ ( typename maps_t::iterator  lb,
state_t  s 
)
inlineprivate

Build and return the transition map for state s, store at res.

Insert it in the cache.

Definition at line 151 of file transition-map.hh.

Referenced by vcsn::detail::transition_map< automaton_t, weightset_t_of< automaton_t >, true, true >::operator[]().

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
template<bool Deterministic_>
void vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::insert_ ( map_t map,
label_t_of< Aut >  l,
transition  t,
std::enable_if_t< Deterministic_ > *  = nullptr 
)
inlineprivate

Insert l -> t in map.

Definition at line 131 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
template<bool Deterministic_>
void vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::insert_ ( map_t map,
label_t_of< Aut >  l,
transition  t,
std::enable_if_t<!Deterministic_ > *  = nullptr 
)
inlineprivate

Insert l -> t in map.

Definition at line 141 of file transition-map.hh.

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
map_t& vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::operator[] ( state_t  s)
inline

Outgoing transitions of state s, sorted by label.

Definition at line 116 of file transition-map.hh.

Member Data Documentation

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
Aut vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::aut_
private

The automaton whose transitions are cached.

Definition at line 168 of file transition-map.hh.

Referenced by vcsn::detail::transition_map< automaton_t, weightset_t_of< automaton_t >, true, true >::build_map_().

template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
maps_t vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::maps_
private
template<Automaton Aut, typename WeightSet = weightset_t_of<Aut>, bool Deterministic = false, bool AllOut = false, bool KeepTransitions = false>
const weightset_t& vcsn::detail::transition_map< Aut, WeightSet, Deterministic, AllOut, KeepTransitions >::ws_
private

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