Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
make-context.cc
Go to the documentation of this file.
2 #include <vcsn/dyn/algos.hh>
4 #include <vcsn/dyn/translate.hh>
7 
8 
9 namespace vcsn
10 {
11  namespace dyn
12  {
13 
14  /*-------------.
15  | context_of. |
16  `-------------*/
17 
18  REGISTER_DEFINE(context_of);
19  context
21  {
22  return detail::context_of_registry().call(a);
23  }
24 
25  REGISTER_DEFINE(context_of_ratexp);
26  context
27  context_of(const ratexp& e)
28  {
29  return detail::context_of_ratexp_registry().call(e);
30  }
31 
32  /*---------------.
33  | make_context. |
34  `---------------*/
35 
36  REGISTER_DEFINE(make_context);
37  context
38  make_context(const std::string& n)
39  {
40  std::string name = ast::normalize(n);
41  // If the context is not known, try to compile and load it
42  // first.
44  // Turn the context name into a signature: {sname}.
45  if (!detail::make_context_registry().get0({sname}))
47  return detail::make_context_registry().call({sname}, name);
48  }
49 
50 
51  /*-----------------.
52  | make_ratexpset. |
53  `-----------------*/
54 
55  REGISTER_DEFINE(make_ratexpset);
56  ratexpset
58  {
59  return detail::make_ratexpset_registry().call(ctx, ids);
60  }
61 
62  /*--------------------.
63  | make_word_context. |
64  `--------------------*/
65 
66  REGISTER_DEFINE(make_word_context);
67  context
69  {
70  return detail::make_word_context_registry().call(ctx);
71  }
72  }
73 }
context make_context(const std::string &name)
Build a context from its name.
Definition: make-context.cc:38
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:71
ratexpset make_ratexpset(const context &ctx,::vcsn::rat::identities is)
Build an ratexpset from its context.
Definition: make-context.cc:57
context context_of(const automaton &a)
The context of this automaton.
Definition: make-context.cc:20
void compile(const std::string &ctx)
Compile, and load, a DSO with instantiations for ctx.
Definition: translate.cc:337
std::string sname()
Definition: name.hh:31
std::shared_ptr< detail::ratexp_base > ratexp
Definition: fwd.hh:64
context context_of_ratexp(const ratexp &exp)
Bridge.
Definition: make-context.hh:80
context make_word_context(const context &ctx)
The context for words.
Definition: make-context.cc:68
static std::string sname(const std::string &vname)
Convert a dynamic name into a static one.
Definition: ctx.cc:9
std::string normalize(const std::string &sig)
The signature, normalized.
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:36
std::shared_ptr< const detail::context_base > context
Definition: context.hh:71
identities
A ratexpset can implement several different sets of identities on expressions.
Definition: identities.hh:17