Vcsn  2.8
Be Rational
vcsn::detail::filter_automaton_impl< Aut, Trans > Class Template Reference

Hide some states of an automaton. More...

#include <filter.hh>

Inheritance diagram for vcsn::detail::filter_automaton_impl< Aut, Trans >:
Collaboration diagram for vcsn::detail::filter_automaton_impl< Aut, Trans >:

Public Types

using automaton_t = Aut
 
using self_t = filter_automaton_impl
 
using super_t = automaton_decorator< automaton_t >
 
using state_t = state_t_of< automaton_t >
 
using transition_t = transition_t_of< automaton_t >
 
using label_t = label_t_of< automaton_t >
 
using states_t = dynamic_bitset
 
using transitions_t = dynamic_bitset
 
using optional_container_t = optional_container< transitions_t, Trans >
 
using tr_cont_t = std::vector< transition_t >
 
- Public Types inherited from vcsn::detail::automaton_decorator< Aut >
using automaton_t = Aut
 The type of automaton to wrap. More...
 
using context_t = context_t_of< Aut >
 
using element_type = typename automaton_t::element_type
 The automaton type, without shared_ptr. More...
 
using fresh_automaton_t = typename element_type::template fresh_automaton_t< Ctx >
 The (shared pointer) type to use it we have to create an automaton of the same (underlying) type. More...
 
using kind_t = typename context_t::kind_t
 
using labelset_t = typename context_t::labelset_t
 
using labelset_ptr = typename context_t::labelset_ptr
 
using label_t = typename labelset_t::value_t
 
using weightset_t = typename context_t::weightset_t
 
using weightset_ptr = typename context_t::weightset_ptr
 
using weight_t = typename weightset_t::value_t
 
using state_t = state_t_of< automaton_t >
 
using transition_t = transition_t_of< automaton_t >
 

Public Member Functions

 filter_automaton_impl (const automaton_t &input, const boost::optional< states_t > &ss={}, const boost::optional< transitions_t > &ts={})
 Build a filtered view of an automaton. More...
 
std::ostream & print_set (std::ostream &o, format fmt={}) const
 
bool state_has_name (state_t s) const
 
bool has_state (state_t s) const
 
template<bool U = Trans>
std::enable_if_t< U, bool > has_transition (transition_t t) const
 
template<bool U = Trans>
std::enable_if_t<!U, bool > has_transition (transition_t t) const
 
std::ostream & print_state_name (state_t s, std::ostream &o, format fmt={}, bool delimit=false) const
 
size_t num_states () const
 
size_t num_all_states () const
 
template<typename Pred >
auto all_states (Pred pred) const
 
auto all_states () const
 
auto states () const
 
auto all_transitions () const
 All the transition indexes between all states (including pre and post). More...
 
auto all_out (state_t s) const
 All the outgoing transitions. More...
 
auto all_in (state_t s) const
 All the incoming transitions. More...
 
void hide_state (state_t s)
 
template<bool U = Trans>
std::enable_if_t< U, voidhide_transition (transition_t t)
 Hide a transition from the automaton. More...
 
void unhide_state (state_t s)
 Reveal a state from the original automaton. More...
 
template<bool U = Trans>
std::enable_if_t< U, voidunhide_transition (transition_t t)
 Reveal a transition from the original automaton. More...
 
void hide_all_states ()
 Hide all the states of the original automaton. More...
 
void unhide_all_states ()
 Reveal all the states of the original automaton. More...
 
template<bool U = Trans>
std::enable_if_t< U, voidunhide_all_transitions ()
 
template<bool U = Trans>
std::enable_if_t< U, voidhide_all_transitions ()
 
fresh_automaton_t_of< automaton_tstrip () const
 
- Public Member Functions inherited from vcsn::detail::automaton_decorator< Aut >
 automaton_decorator (automaton_t aut)
 
 automaton_decorator (const automaton_decorator &aut)
 
 automaton_decorator (const context_t &ctx)
 
 automaton_decorator (automaton_decorator &&aut)
 
automaton_decoratoroperator= (automaton_decorator &&that)
 
automaton_t strip ()
 The automaton we decorate. More...
 
auto all_in (Args &&... args) const -> decltype(aut_-> all_in(std::forward< Args >(args)...))
 
auto all_out (Args &&... args) const -> decltype(aut_-> all_out(std::forward< Args >(args)...))
 
auto all_states (Args &&... args) const -> decltype(aut_-> all_states(std::forward< Args >(args)...))
 
auto all_transitions (Args &&... args) const -> decltype(aut_-> all_transitions(std::forward< Args >(args)...))
 
auto context (Args &&... args) const -> decltype(aut_-> context(std::forward< Args >(args)...))
 
auto dst_of (Args &&... args) const -> decltype(aut_-> dst_of(std::forward< Args >(args)...))
 
auto get_final_weight (Args &&... args) const -> decltype(aut_-> get_ final _weight(std
 
auto get_initial_weight (Args &&... args) const -> decltype(aut_-> get_initial_weight(std::forward< Args >(args)...))
 
auto get_transition (Args &&... args) const -> decltype(aut_-> get_transition(std::forward< Args >(args)...))
 
auto has_state (Args &&... args) const -> decltype(aut_-> has_state(std::forward< Args >(args)...))
 
auto has_transition (Args &&... args) const -> decltype(aut_-> has_transition(std::forward< Args >(args)...))
 
auto is_final (Args &&... args) const -> decltype(aut_-> is_ final(std
 
auto is_initial (Args &&... args) const -> decltype(aut_-> is_initial(std::forward< Args >(args)...))
 
auto label_of (Args &&... args) const -> decltype(aut_-> label_of(std::forward< Args >(args)...))
 
auto labelset (Args &&... args) const -> decltype(aut_-> labelset(std::forward< Args >(args)...))
 
auto num_all_states (Args &&... args) const -> decltype(aut_-> num_all_states(std::forward< Args >(args)...))
 
auto num_finals (Args &&... args) const -> decltype(aut_-> num_ final s(std
 
auto num_initials (Args &&... args) const -> decltype(aut_-> num_initials(std::forward< Args >(args)...))
 
auto num_states (Args &&... args) const -> decltype(aut_-> num_states(std::forward< Args >(args)...))
 
auto num_transitions (Args &&... args) const -> decltype(aut_-> num_transitions(std::forward< Args >(args)...))
 
auto prepost_label (Args &&... args) const -> decltype(aut_-> prepost_label(std::forward< Args >(args)...))
 
auto print (Args &&... args) const -> decltype(aut_-> print(std::forward< Args >(args)...))
 
auto print_set (Args &&... args) const -> decltype(aut_-> print_set(std::forward< Args >(args)...))
 
auto print_state (Args &&... args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...))
 
auto print_state_name (Args &&... args) const -> decltype(aut_-> print_state_name(std::forward< Args >(args)...))
 
auto src_of (Args &&... args) const -> decltype(aut_-> src_of(std::forward< Args >(args)...))
 
auto state_has_name (Args &&... args) const -> decltype(aut_-> state_has_name(std::forward< Args >(args)...))
 
auto is_lazy (Args &&... args) const -> decltype(aut_-> is_lazy(std::forward< Args >(args)...))
 
auto is_lazy_in (Args &&... args) const -> decltype(aut_-> is_lazy_in(std::forward< Args >(args)...))
 
auto states (Args &&... args) const -> decltype(aut_-> states(std::forward< Args >(args)...))
 
auto weight_of (Args &&... args) const -> decltype(aut_-> weight_of(std::forward< Args >(args)...))
 
auto weightset (Args &&... args) const -> decltype(aut_-> weightset(std::forward< Args >(args)...))
 
auto add_final (Args &&... args) -> decltype(aut_-> add_ final(std
 
auto add_initial (Args &&... args) -> decltype(aut_-> add_initial(std::forward< Args >(args)...))
 
auto add_transition (Args &&... args) -> decltype(aut_-> add_transition(std::forward< Args >(args)...))
 
auto add_transition_copy (Args &&... args) -> decltype(aut_-> add_transition_copy(std::forward< Args >(args)...))
 
auto add_weight (Args &&... args) -> decltype(aut_-> add_weight(std::forward< Args >(args)...))
 
auto del_state (Args &&... args) -> decltype(aut_-> del_state(std::forward< Args >(args)...))
 
auto del_transition (Args &&... args) -> decltype(aut_-> del_transition(std::forward< Args >(args)...))
 
auto lweight (Args &&... args) -> decltype(aut_-> lweight(std::forward< Args >(args)...))
 
auto new_state (Args &&... args) -> decltype(aut_-> new_state(std::forward< Args >(args)...))
 
auto new_transition (Args &&... args) -> decltype(aut_-> new_transition(std::forward< Args >(args)...))
 
auto new_transition_copy (Args &&... args) -> decltype(aut_-> new_transition_copy(std::forward< Args >(args)...))
 
auto rweight (Args &&... args) -> decltype(aut_-> rweight(std::forward< Args >(args)...))
 
auto set_final (Args &&... args) -> decltype(aut_-> set_ final(std
 
auto set_lazy (Args &&... args) -> decltype(aut_-> set_lazy(std::forward< Args >(args)...))
 
auto set_lazy_in (Args &&... args) -> decltype(aut_-> set_lazy_in(std::forward< Args >(args)...))
 
auto set_initial (Args &&... args) -> decltype(aut_-> set_initial(std::forward< Args >(args)...))
 
auto set_transition (Args &&... args) -> decltype(aut_-> set_transition(std::forward< Args >(args)...))
 
auto set_weight (Args &&... args) -> decltype(aut_-> set_weight(std::forward< Args >(args)...))
 
auto unset_final (Args &&... args) -> decltype(aut_-> unset_ final(std
 
auto unset_initial (Args &&... args) -> decltype(aut_-> unset_initial(std::forward< Args >(args)...))
 
- Public Member Functions inherited from vcsn::detail::optional_container< dynamic_bitset, Trans >
 optional_container (Args &&...)
 

Static Public Member Functions

static symbol sname ()
 Static name. More...
 
- Static Public Member Functions inherited from vcsn::detail::automaton_decorator< Aut >
static constexpr auto lazy_transition (Args &&... args) -> decltype(element_type::lazy_transition(std::forward< Args >(args)...))
 
static constexpr auto null_state (Args &&... args) -> decltype(element_type::null_state(std::forward< Args >(args)...))
 
static constexpr auto null_transition (Args &&... args) -> decltype(element_type::null_transition(std::forward< Args >(args)...))
 
static constexpr auto post (Args &&... args) -> decltype(element_type::post(std::forward< Args >(args)...))
 
static constexpr auto pre (Args &&... args) -> decltype(element_type::pre(std::forward< Args >(args)...))
 
static constexpr auto sname (Args &&... args) -> decltype(element_type::sname(std::forward< Args >(args)...))
 

Private Attributes

states_t ss_
 The states we keep. More...
 

Additional Inherited Members

- Protected Attributes inherited from vcsn::detail::automaton_decorator< Aut >
automaton_t aut_
 The wrapped automaton, possibly const. More...
 

Detailed Description

template<Automaton Aut, bool Trans = false>
class vcsn::detail::filter_automaton_impl< Aut, Trans >

Hide some states of an automaton.

Parametrized on whether or not to consider transitions while filtering.

Definition at line 48 of file filter.hh.

Member Typedef Documentation

◆ automaton_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::automaton_t = Aut

Definition at line 53 of file filter.hh.

◆ label_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::label_t = label_t_of<automaton_t>

Definition at line 58 of file filter.hh.

◆ optional_container_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::optional_container_t = optional_container<transitions_t, Trans>

Definition at line 62 of file filter.hh.

◆ self_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::self_t = filter_automaton_impl

Definition at line 54 of file filter.hh.

◆ state_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::state_t = state_t_of<automaton_t>

Definition at line 56 of file filter.hh.

◆ states_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::states_t = dynamic_bitset

Definition at line 60 of file filter.hh.

◆ super_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::super_t = automaton_decorator<automaton_t>

Definition at line 55 of file filter.hh.

◆ tr_cont_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::tr_cont_t = std::vector<transition_t>

Definition at line 64 of file filter.hh.

◆ transition_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::transition_t = transition_t_of<automaton_t>

Definition at line 57 of file filter.hh.

◆ transitions_t

template<Automaton Aut, bool Trans = false>
using vcsn::detail::filter_automaton_impl< Aut, Trans >::transitions_t = dynamic_bitset

Definition at line 61 of file filter.hh.

Constructor & Destructor Documentation

◆ filter_automaton_impl()

template<Automaton Aut, bool Trans = false>
vcsn::detail::filter_automaton_impl< Aut, Trans >::filter_automaton_impl ( const automaton_t input,
const boost::optional< states_t > &  ss = {},
const boost::optional< transitions_t > &  ts = {} 
)
inline

Build a filtered view of an automaton.

Parameters
inputautomaton whose states/transitions to filter.
ssset of states to reveal. If {}, hide none.
tsset of transitions to reveal. If {}, hide none.

Definition at line 76 of file filter.hh.

References vcsn::detail::states_size(), and vcsn::detail::transitions_size().

Here is the call graph for this function:

Member Function Documentation

◆ all_in()

template<Automaton Aut, bool Trans = false>
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::all_in ( state_t  s) const
inline

All the incoming transitions.

Definition at line 207 of file filter.hh.

◆ all_out()

template<Automaton Aut, bool Trans = false>
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::all_out ( state_t  s) const
inline

All the outgoing transitions.

Definition at line 196 of file filter.hh.

◆ all_states() [1/2]

template<Automaton Aut, bool Trans = false>
template<typename Pred >
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::all_states ( Pred  pred) const
inline

Definition at line 159 of file filter.hh.

◆ all_states() [2/2]

template<Automaton Aut, bool Trans = false>
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::all_states ( ) const
inline

Definition at line 167 of file filter.hh.

◆ all_transitions()

template<Automaton Aut, bool Trans = false>
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::all_transitions ( ) const
inline

All the transition indexes between all states (including pre and post).

Definition at line 183 of file filter.hh.

◆ has_state()

template<Automaton Aut, bool Trans = false>
bool vcsn::detail::filter_automaton_impl< Aut, Trans >::has_state ( state_t  s) const
inline

Definition at line 119 of file filter.hh.

◆ has_transition() [1/2]

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<U, bool> vcsn::detail::filter_automaton_impl< Aut, Trans >::has_transition ( transition_t  t) const
inline

Definition at line 128 of file filter.hh.

◆ has_transition() [2/2]

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<!U, bool> vcsn::detail::filter_automaton_impl< Aut, Trans >::has_transition ( transition_t  t) const
inline

Definition at line 135 of file filter.hh.

◆ hide_all_states()

template<Automaton Aut, bool Trans = false>
void vcsn::detail::filter_automaton_impl< Aut, Trans >::hide_all_states ( )
inline

Hide all the states of the original automaton.

The filter automaton is now empty. automaton.

Definition at line 256 of file filter.hh.

◆ hide_all_transitions()

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<U, void> vcsn::detail::filter_automaton_impl< Aut, Trans >::hide_all_transitions ( )
inline

Definition at line 281 of file filter.hh.

◆ hide_state()

template<Automaton Aut, bool Trans = false>
void vcsn::detail::filter_automaton_impl< Aut, Trans >::hide_state ( state_t  s)
inline

Definition at line 218 of file filter.hh.

◆ hide_transition()

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<U, void> vcsn::detail::filter_automaton_impl< Aut, Trans >::hide_transition ( transition_t  t)
inline

Hide a transition from the automaton.

Only available if the filter_automaton filters with the transitions.

Definition at line 228 of file filter.hh.

◆ num_all_states()

template<Automaton Aut, bool Trans = false>
size_t vcsn::detail::filter_automaton_impl< Aut, Trans >::num_all_states ( ) const
inline

Definition at line 153 of file filter.hh.

◆ num_states()

template<Automaton Aut, bool Trans = false>
size_t vcsn::detail::filter_automaton_impl< Aut, Trans >::num_states ( ) const
inline

Definition at line 148 of file filter.hh.

◆ print_set()

template<Automaton Aut, bool Trans = false>
std::ostream& vcsn::detail::filter_automaton_impl< Aut, Trans >::print_set ( std::ostream &  o,
format  fmt = {} 
) const
inline

Definition at line 106 of file filter.hh.

◆ print_state_name()

template<Automaton Aut, bool Trans = false>
std::ostream& vcsn::detail::filter_automaton_impl< Aut, Trans >::print_state_name ( state_t  s,
std::ostream &  o,
format  fmt = {},
bool  delimit = false 
) const
inline

Definition at line 140 of file filter.hh.

◆ sname()

template<Automaton Aut, bool Trans = false>
static symbol vcsn::detail::filter_automaton_impl< Aut, Trans >::sname ( )
inlinestatic

Static name.

Definition at line 99 of file filter.hh.

References vcsn::res, and vcsn::sname().

Here is the call graph for this function:

◆ state_has_name()

template<Automaton Aut, bool Trans = false>
bool vcsn::detail::filter_automaton_impl< Aut, Trans >::state_has_name ( state_t  s) const
inline

Definition at line 113 of file filter.hh.

◆ states()

template<Automaton Aut, bool Trans = false>
auto vcsn::detail::filter_automaton_impl< Aut, Trans >::states ( ) const
inline

Definition at line 172 of file filter.hh.

◆ strip()

template<Automaton Aut, bool Trans = false>
fresh_automaton_t_of<automaton_t> vcsn::detail::filter_automaton_impl< Aut, Trans >::strip ( ) const
inline

Definition at line 287 of file filter.hh.

◆ unhide_all_states()

template<Automaton Aut, bool Trans = false>
void vcsn::detail::filter_automaton_impl< Aut, Trans >::unhide_all_states ( )
inline

Reveal all the states of the original automaton.

The filter automaton is now composed of all the states of the original automaton.

Definition at line 267 of file filter.hh.

◆ unhide_all_transitions()

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<U, void> vcsn::detail::filter_automaton_impl< Aut, Trans >::unhide_all_transitions ( )
inline

Definition at line 274 of file filter.hh.

◆ unhide_state()

template<Automaton Aut, bool Trans = false>
void vcsn::detail::filter_automaton_impl< Aut, Trans >::unhide_state ( state_t  s)
inline

Reveal a state from the original automaton.

Definition at line 236 of file filter.hh.

◆ unhide_transition()

template<Automaton Aut, bool Trans = false>
template<bool U = Trans>
std::enable_if_t<U, void> vcsn::detail::filter_automaton_impl< Aut, Trans >::unhide_transition ( transition_t  t)
inline

Reveal a transition from the original automaton.

Only available if the filter_automaton filters with the transitions.

Definition at line 246 of file filter.hh.

Member Data Documentation

◆ ss_

template<Automaton Aut, bool Trans = false>
states_t vcsn::detail::filter_automaton_impl< Aut, Trans >::ss_
private

The states we keep.

Definition at line 306 of file filter.hh.


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