Vcsn  2.2
Be Rational
vcsn::detail::copier< AutIn, AutOut > Class Template Reference

Copy an automaton. More...

#include <copy.hh>

Collaboration diagram for vcsn::detail::copier< AutIn, AutOut >:

Public Types

using in_automaton_t = AutIn
 
using out_automaton_t = AutOut
 
using in_state_t = state_t_of< in_automaton_t >
 
using out_state_t = state_t_of< out_automaton_t >
 
using state_map_t = std::unordered_map< in_state_t, out_state_t >
 input state -> output state. More...
 

Public Member Functions

 copier (const in_automaton_t &in, out_automaton_t &out, bool safe=true)
 Prepare for an automaton full/partial duplication. More...
 
template<typename KeepState , typename KeepTrans >
void operator() (KeepState keep_state, KeepTrans keep_trans)
 Copy some states, and some transitions. More...
 
template<typename Transitions >
auto operator() (const Transitions &ts) -> decltype(ts[0]==in_->null_transition(), void())
 Copy some transitions, and their corresponding states. More...
 
void operator() (const transition_t_of< in_automaton_t > &t)
 Copy one transition, and its corresponding states. More...
 
void operator() ()
 Copy all the states, and all the transitions. More...
 
const state_map_tstate_map () const
 A map from original state to result state. More...
 
state_map_tstate_map ()
 A map from original state to result state. More...
 

Private Member Functions

out_state_t state (const in_state_t &s)
 The out state corresponding to the in-state s. More...
 

Private Attributes

in_automaton_t in_
 Input automaton. More...
 
out_automaton_t out_
 Output automaton. More...
 
bool safe_ = true
 whether the input automaton is in normal form and never has two transitions with same (src, label, dst). More...
 
state_map_t out_state_
 input state -> output state. More...
 

Detailed Description

template<Automaton AutIn, Automaton AutOut = AutIn>
class vcsn::detail::copier< AutIn, AutOut >

Copy an automaton.

Template Parameters
AutInThe type of the automaton to copy.
AutOutThe type of the resulting automaton.
Precondition
AutIn <: AutOut.

Definition at line 113 of file copy.hh.

Member Typedef Documentation

template<Automaton AutIn, Automaton AutOut = AutIn>
using vcsn::detail::copier< AutIn, AutOut >::in_automaton_t = AutIn

Definition at line 116 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
using vcsn::detail::copier< AutIn, AutOut >::in_state_t = state_t_of<in_automaton_t>

Definition at line 119 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
using vcsn::detail::copier< AutIn, AutOut >::out_automaton_t = AutOut

Definition at line 117 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
using vcsn::detail::copier< AutIn, AutOut >::out_state_t = state_t_of<out_automaton_t>

Definition at line 120 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
using vcsn::detail::copier< AutIn, AutOut >::state_map_t = std::unordered_map<in_state_t, out_state_t>

input state -> output state.

Definition at line 122 of file copy.hh.

Constructor & Destructor Documentation

template<Automaton AutIn, Automaton AutOut = AutIn>
vcsn::detail::copier< AutIn, AutOut >::copier ( const in_automaton_t in,
out_automaton_t out,
bool  safe = true 
)
inline

Prepare for an automaton full/partial duplication.

Parameters
ininput automaton, to copy
outoutput automaton, the destination
safewhether the input automaton is in normal form and never has two transitions with same (src, label, dst).

Definition at line 143 of file copy.hh.

Member Function Documentation

template<Automaton AutIn, Automaton AutOut = AutIn>
template<typename KeepState , typename KeepTrans >
void vcsn::detail::copier< AutIn, AutOut >::operator() ( KeepState  keep_state,
KeepTrans  keep_trans 
)
inline

Copy some states, and some transitions.

Parameters
keep_statea predicate to recognize states to keep
keep_transa predicate to recognize transitions to keep

Transitions are kept only if both criteria are satisfied: the transition is kept, and its source and destination too.

Definition at line 160 of file copy.hh.

References vcsn::detail::all_transitions().

Here is the call graph for this function:

template<Automaton AutIn, Automaton AutOut = AutIn>
template<typename Transitions >
auto vcsn::detail::copier< AutIn, AutOut >::operator() ( const Transitions &  ts) -> decltype(ts[0] == in_->null_transition(), void())
inline

Copy some transitions, and their corresponding states.

Parameters
tsthe transitions to keep.

Definition at line 190 of file copy.hh.

References vcsn::detail::copier< AutIn, AutOut >::operator()().

Here is the call graph for this function:

template<Automaton AutIn, Automaton AutOut = AutIn>
void vcsn::detail::copier< AutIn, AutOut >::operator() ( const transition_t_of< in_automaton_t > &  t)
inline

Copy one transition, and its corresponding states.

Parameters
tthe transition to copy.

Definition at line 200 of file copy.hh.

References vcsn::detail::copier< AutIn, AutOut >::state().

Here is the call graph for this function:

template<Automaton AutIn, Automaton AutOut = AutIn>
void vcsn::detail::copier< AutIn, AutOut >::operator() ( )
inline

Copy all the states, and all the transitions.

Definition at line 211 of file copy.hh.

Referenced by vcsn::detail::copier< AutIn, AutOut >::operator()().

template<Automaton AutIn, Automaton AutOut = AutIn>
out_state_t vcsn::detail::copier< AutIn, AutOut >::state ( const in_state_t s)
inlineprivate

The out state corresponding to the in-state s.

If unknown, allocate it.

Definition at line 232 of file copy.hh.

Referenced by vcsn::detail::copier< AutIn, AutOut >::operator()().

template<Automaton AutIn, Automaton AutOut = AutIn>
const state_map_t& vcsn::detail::copier< AutIn, AutOut >::state_map ( ) const
inline

A map from original state to result state.

Definition at line 218 of file copy.hh.

References vcsn::detail::copier< AutIn, AutOut >::out_state_.

template<Automaton AutIn, Automaton AutOut = AutIn>
state_map_t& vcsn::detail::copier< AutIn, AutOut >::state_map ( )
inline

A map from original state to result state.

Definition at line 224 of file copy.hh.

References vcsn::detail::copier< AutIn, AutOut >::out_state_.

Member Data Documentation

template<Automaton AutIn, Automaton AutOut = AutIn>
in_automaton_t vcsn::detail::copier< AutIn, AutOut >::in_
private

Input automaton.

Definition at line 126 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
out_automaton_t vcsn::detail::copier< AutIn, AutOut >::out_
private

Output automaton.

Definition at line 128 of file copy.hh.

template<Automaton AutIn, Automaton AutOut = AutIn>
state_map_t vcsn::detail::copier< AutIn, AutOut >::out_state_
private

input state -> output state.

Definition at line 133 of file copy.hh.

Referenced by vcsn::detail::copier< AutIn, AutOut >::state_map().

template<Automaton AutIn, Automaton AutOut = AutIn>
bool vcsn::detail::copier< AutIn, AutOut >::safe_ = true
private

whether the input automaton is in normal form and never has two transitions with same (src, label, dst).

Definition at line 131 of file copy.hh.


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