Vcsn  2.2
Be Rational
context-printer.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 #include <sstream>
5 
7 
8 namespace vcsn
9 {
10  namespace ast
11  {
13  {
14  public:
15  context_printer(std::ostringstream& os)
16  : os_(os)
17  {}
18 
20  void header(const std::string& h);
21 
23  void header_algo(const std::string& algo);
24 
26  void linkflags(const std::string& h);
27 
29  const std::string& linkflags() const;
30 
32  std::ostream& print(std::ostream& o);
33 
34 # define DEFINE(Type) \
35  virtual void visit(const Type& t)
36 
38  DEFINE(context);
41  DEFINE(genset);
42  DEFINE(letterset);
43  DEFINE(nullableset);
44  DEFINE(oneset);
45  DEFINE(other);
47  DEFINE(tuple);
49  DEFINE(weightset);
50  DEFINE(wordset);
51 # undef DEFINE
52 
53  private:
54 
55  std::ostringstream& os_;
87  std::set<std::string> headers_;
88  std::set<std::string> headers_late_;
89 
91  std::string linkflags_;
92  };
93  }
94 }
void header(const std::string &h)
Record that we need an include for this header.
weightset_mixin< rat::expressionset_impl< Context >> expressionset
Definition: fwd.hh:200
context_printer(std::ostringstream &os)
#define DEFINE(Type)
Definition: a-star.hh:8
std::ostringstream os
The output stream: the corresponding C++ snippet to compile.
Definition: translate.cc:382
weightset_mixin< detail::tupleset_impl< LabelSets... >> tupleset
Definition: fwd.hh:32
std::set< std::string > headers_
Headers to include.
weightset_mixin< detail::polynomialset_impl< Context, Kind >> polynomialset
Definition: fwd.hh:63
const std::string & linkflags() const
Get the link flags.
rat::expansionset< ExpSet > expansionset
Definition: fwd.hh:203
std::shared_ptr< const detail::context_base > context
A dyn::context.
Definition: fwd.hh:43
void header_algo(const std::string &algo)
Record that we need an include for this algorithm.
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69
std::set< std::string > headers_late_
std::ostringstream & os_
std::ostream & print(std::ostream &o)
Generate the code to compile on o.
std::string linkflags_
Flags to pass to the linker.