Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::detail::efsmer< Aut > Class Template Reference

Format automaton to EFSM format, based on FSM format. More...

#include <efsm.hh>

Inheritance diagram for vcsn::detail::efsmer< Aut >:
Collaboration diagram for vcsn::detail::efsmer< Aut >:

Public Member Functions

void operator() ()
 Actually output aut_ on os_. More...
 
- Public Member Functions inherited from vcsn::detail::outputter< Aut >
 outputter (const automaton_t &aut, std::ostream &out)
 

Protected Types

using automaton_t = Aut
 
using super_t = outputter< Aut >
 
using label_t = typename super_t::label_t
 
using state_t = typename super_t::state_t
 
using transition_t = typename super_t::transition_t
 
- Protected Types inherited from vcsn::detail::outputter< Aut >
using automaton_t = Aut
 
using context_t = context_t_of< automaton_t >
 
using label_t = label_t_of< automaton_t >
 
using transition_t = transition_t_of< automaton_t >
 
using weightset_t = weightset_t_of< automaton_t >
 
using weight_t = weight_t_of< automaton_t >
 
using states_t = std::vector< state_t >
 A list of states. More...
 

Private Types

using is_transducer_t = std::integral_constant< bool, 2<=rank< labelset_t_of< automaton_t >>::value >
 Whether is a transducer (two-tape automaton) as opposed to an acceptor. More...
 

Private Member Functions

template<typename LS >
void output_label_ (const LS &ls, const typename LS::value_t &l)
 
template<typename Label >
void output_label_ (const Label &l, std::false_type)
 Acceptor. More...
 
template<typename Label >
void output_label_ (const Label &l, std::true_type)
 Two-tape automaton. More...
 
void output_transition_ (const transition_t t)
 
void output_transitions_ ()
 Output all the transitions, and final states. More...
 
template<typename LabelSet , typename Labels , typename GetLabel >
auto add_alphabet (const LabelSet &ls, Labels &labels, GetLabel get_label, int) -> decltype(ls.genset(), void())
 
template<typename LabelSet , typename Labels , typename GetLabel >
void add_alphabet (const LabelSet &, Labels &, GetLabel, long)
 
template<typename LabelSet , typename GetLabel >
void output_symbols_ (const std::string &name, const LabelSet &ls, GetLabel get_label)
 Output the mapping from label name, to label number. More...
 
template<typename >
void output_symbols_impl_ (std::false_type)
 Labels of an acceptor. More...
 
template<typename >
void output_symbols_impl_ (std::true_type)
 Labels of a two-tape automaton. More...
 
void output_symbols_ ()
 

Private Attributes

const is_transducer_t is_transducer = {}
 
const charisymbols_
 File name for input tape symbols. More...
 
const charosymbols_
 File name for output tape symbols. More...
 

Additional Inherited Members

- Public Types inherited from vcsn::detail::outputter< Aut >
using state_t = state_t_of< automaton_t >
 
- Protected Member Functions inherited from vcsn::detail::outputter< Aut >
virtual std::string label_ (const label_t &l)
 Convert a label to its representation. More...
 
virtual void output_transition_ (transition_t t)
 Output the transition t. More...
 
std::ostream & print_entry_ (state_t src, state_t dst, std::ostream &os, const std::string &fmt="text")
 The labels and weights of transitions from src to dst. More...
 
void output_state_ (const state_t s)
 Output transitions, sorted lexicographically on (Label, Dest). More...
 
void output_transitions_ ()
 Output transitions, sorted lexicographically. More...
 
void list_states_ (const states_t &ss)
 List names of states in ss, preceded by ' '. More...
 
states_t initials_ ()
 The list of initial states, sorted. More...
 
states_t finals_ ()
 The list of final states, sorted. More...
 
- Protected Attributes inherited from vcsn::detail::outputter< Aut >
const automaton_taut_
 The automaton we have to output. More...
 
std::ostream & os_
 Output stream. More...
 
const labelset_t_of
< automaton_t > & 
ls_ = *aut_->labelset()
 Short-hand to the labelset. More...
 
const weightset_tws_ = *aut_->weightset()
 Short-hand to the weightset. More...
 
const polynomialset
< context_t_of< automaton_t > > 
ps_ {aut_->context()}
 Short-hand to the polynomialset used to print the entries. More...
 

Detailed Description

template<typename Aut>
class vcsn::detail::efsmer< Aut >

Format automaton to EFSM format, based on FSM format.

Template Parameters
Autan automaton type, not a pointer type.

http://www2.research.att.com/~fsmtools/fsm/man4/fsm.5.html

Definition at line 40 of file efsm.hh.

Member Typedef Documentation

template<typename Aut >
using vcsn::detail::efsmer< Aut >::automaton_t = Aut
protected

Definition at line 43 of file efsm.hh.

template<typename Aut >
using vcsn::detail::efsmer< Aut >::is_transducer_t = std::integral_constant<bool, 2 <= rank<labelset_t_of<automaton_t>>::value>
private

Whether is a transducer (two-tape automaton) as opposed to an acceptor.

Definition at line 283 of file efsm.hh.

template<typename Aut >
using vcsn::detail::efsmer< Aut >::label_t = typename super_t::label_t
protected

Definition at line 46 of file efsm.hh.

template<typename Aut >
using vcsn::detail::efsmer< Aut >::state_t = typename super_t::state_t
protected

Definition at line 47 of file efsm.hh.

template<typename Aut >
using vcsn::detail::efsmer< Aut >::super_t = outputter<Aut>
protected

Definition at line 44 of file efsm.hh.

template<typename Aut >
using vcsn::detail::efsmer< Aut >::transition_t = typename super_t::transition_t
protected

Definition at line 48 of file efsm.hh.

Member Function Documentation

template<typename Aut >
template<typename LabelSet , typename Labels , typename GetLabel >
auto vcsn::detail::efsmer< Aut >::add_alphabet ( const LabelSet ls,
Labels &  labels,
GetLabel  get_label,
int   
) -> decltype(ls.genset(), void())
inlineprivate

Definition at line 184 of file efsm.hh.

Referenced by vcsn::detail::efsmer< Aut >::output_symbols_().

template<typename Aut >
template<typename LabelSet , typename Labels , typename GetLabel >
void vcsn::detail::efsmer< Aut >::add_alphabet ( const LabelSet ,
Labels &  ,
GetLabel  ,
long   
)
inlineprivate

Definition at line 193 of file efsm.hh.

template<typename Aut >
void vcsn::detail::efsmer< Aut >::operator() ( )
inline

Actually output aut_ on os_.

Definition at line 59 of file efsm.hh.

References vcsn::detail::efsmer< Aut >::is_transducer, vcsn::detail::efsmer< Aut >::isymbols_, vcsn::detail::outputter< Aut >::os_, vcsn::detail::efsmer< Aut >::osymbols_, vcsn::detail::efsmer< Aut >::output_symbols_(), and vcsn::detail::efsmer< Aut >::output_transitions_().

Here is the call graph for this function:

template<typename Aut >
template<typename LS >
void vcsn::detail::efsmer< Aut >::output_label_ ( const LS &  ls,
const typename LS::value_t &  l 
)
inlineprivate
template<typename Aut >
template<typename Label >
void vcsn::detail::efsmer< Aut >::output_label_ ( const Label &  l,
std::false_type   
)
inlineprivate

Acceptor.

Definition at line 111 of file efsm.hh.

References vcsn::detail::outputter< Aut >::ls_, and vcsn::detail::efsmer< Aut >::output_label_().

Here is the call graph for this function:

template<typename Aut >
template<typename Label >
void vcsn::detail::efsmer< Aut >::output_label_ ( const Label &  l,
std::true_type   
)
inlineprivate

Two-tape automaton.

Definition at line 118 of file efsm.hh.

References vcsn::detail::outputter< Aut >::ls_, vcsn::detail::outputter< Aut >::os_, and vcsn::detail::efsmer< Aut >::output_label_().

Here is the call graph for this function:

template<typename Aut >
template<typename LabelSet , typename GetLabel >
void vcsn::detail::efsmer< Aut >::output_symbols_ ( const std::string &  name,
const LabelSet ls,
GetLabel  get_label 
)
inlineprivate

Output the mapping from label name, to label number.

The FSM format uses integers for labels. Reserve 0 for epsilon (and the special symbol, that flags initial and final transitions).

Instead of directly printing the labels, use a projection function. So when printing transducers, this function is used twice, once for each tape, with a projection function from two-tape labels to either one.

Template Parameters
LabelSetthe type of the labelset of the labels to declare.
GetLabelthe type of the lambda to apply to project the labels.
Parameters
namename of the files to create (e.g., "isymbols.txt").
lsThe LabelSet to use to print the labels.
get_labelA projection from exact labels to the one we output.

Definition at line 220 of file efsm.hh.

References vcsn::detail::efsmer< Aut >::add_alphabet(), vcsn::detail::outputter< Aut >::aut_, and vcsn::detail::outputter< Aut >::os_.

Here is the call graph for this function:

template<typename Aut >
void vcsn::detail::efsmer< Aut >::output_symbols_ ( )
inlineprivate
template<typename Aut >
template<typename >
void vcsn::detail::efsmer< Aut >::output_symbols_impl_ ( std::false_type  )
inlineprivate

Labels of an acceptor.

Definition at line 253 of file efsm.hh.

References vcsn::detail::efsmer< Aut >::isymbols_, vcsn::detail::outputter< Aut >::ls_, and vcsn::detail::efsmer< Aut >::output_symbols_().

Here is the call graph for this function:

template<typename Aut >
template<typename >
void vcsn::detail::efsmer< Aut >::output_symbols_impl_ ( std::true_type  )
inlineprivate

Labels of a two-tape automaton.

Definition at line 263 of file efsm.hh.

References vcsn::detail::efsmer< Aut >::isymbols_, vcsn::detail::outputter< Aut >::ls_, vcsn::detail::efsmer< Aut >::osymbols_, and vcsn::detail::efsmer< Aut >::output_symbols_().

Here is the call graph for this function:

template<typename Aut >
void vcsn::detail::efsmer< Aut >::output_transition_ ( const transition_t  t)
inlineprivate

Definition at line 125 of file efsm.hh.

References vcsn::detail::outputter< Aut >::aut_, vcsn::detail::efsmer< Aut >::is_transducer, vcsn::detail::outputter< Aut >::os_, vcsn::detail::efsmer< Aut >::output_label_(), and vcsn::detail::outputter< Aut >::ws_.

Referenced by vcsn::detail::efsmer< Aut >::output_transitions_().

Here is the call graph for this function:

template<typename Aut >
void vcsn::detail::efsmer< Aut >::output_transitions_ ( )
inlineprivate

Output all the transitions, and final states.

Definition at line 144 of file efsm.hh.

References vcsn::detail::outputter< Aut >::aut_, vcsn::detail::outputter< Aut >::os_, vcsn::detail::outputter< Aut >::output_state_(), vcsn::detail::efsmer< Aut >::output_transition_(), vcsn::sort(), and vcsn::detail::outputter< Aut >::ws_.

Referenced by vcsn::detail::efsmer< Aut >::operator()().

Here is the call graph for this function:

Member Data Documentation

template<typename Aut >
const is_transducer_t vcsn::detail::efsmer< Aut >::is_transducer = {}
private
template<typename Aut >
const char* vcsn::detail::efsmer< Aut >::isymbols_
private
Initial value:
=
is_transducer ? "$medir/isymbols.txt" : "$medir/symbols.txt"

File name for input tape symbols.

Definition at line 287 of file efsm.hh.

Referenced by vcsn::detail::efsmer< Aut >::operator()(), and vcsn::detail::efsmer< Aut >::output_symbols_impl_().

template<typename Aut >
const char* vcsn::detail::efsmer< Aut >::osymbols_
private
Initial value:
=
is_transducer ? "$medir/osymbols.txt" : "$medir/symbols.txt"

File name for output tape symbols.

Definition at line 290 of file efsm.hh.

Referenced by vcsn::detail::efsmer< Aut >::operator()(), and vcsn::detail::efsmer< Aut >::output_symbols_impl_().


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