18 #ifndef AWALI_STTC_CORE_RAT_JSON_VISITOR_HXX
19 #define AWALI_STTC_CORE_RAT_JSON_VISITOR_HXX
26 #include <awali/common/json/node.cc>
28 namespace awali {
namespace sttc {
37 template <
typename RatExpSet,
unsigned version=version::fsm_json>
39 :
public RatExpSet::const_visitor
45 using ratexp_t =
typename ratexpset_t::value_t;
48 using node_t =
typename super_type::node_t;
51 constexpr
static const char*
me() {
return "json_visitor"; }
91 for (
unsigned i = 0,
n = e.size(); i <
n; ++i) {
116 e.sub()->accept(*
this);
122 e.sub()->accept(*
this);
124 o->
push_front(
"lweight",ws_.value_to_json(e.weight()));
129 e.sub()->accept(*
this);
131 o->
push_front(
"rweight",ws_.value_to_json(e.weight()));
array_t * push_back(node_t *p)
object_t * push_front(std::string key, node_t *node)
The semiring of Natural numbers.
Definition: n.hh:34
Definition: ratexp.hh:280
Definition: ratexp.hh:262
Definition: json_visitor.hxx:40
AWALI_RAT_VISIT(prod, e)
Definition: json_visitor.hxx:104
weightset_t_of< ratexpset_t > weightset_t
Definition: json_visitor.hxx:46
AWALI_RAT_VISIT(sum, e)
Definition: json_visitor.hxx:99
AWALI_RAT_VISIT(rweight, e)
Definition: json_visitor.hxx:127
json::object_t * operator()(const ratexp_t &v)
Definition: json_visitor.hxx:61
void set_ptr(json::object_t *x)
Definition: json_visitor.hxx:59
AWALI_RAT_VISIT(one,)
Definition: json_visitor.hxx:77
AWALI_RAT_VISIT(lweight, e)
Definition: json_visitor.hxx:120
labelset_t_of< context_t > labelset_t
Definition: json_visitor.hxx:44
json_visitor(const ratexpset_t &rs)
Definition: json_visitor.hxx:53
AWALI_RAT_VISIT(star, e)
Definition: json_visitor.hxx:114
typename super_type::node_t node_t
Definition: json_visitor.hxx:48
AWALI_RAT_VISIT(zero,)
Definition: json_visitor.hxx:72
RatExpSet ratexpset_t
Definition: json_visitor.hxx:42
typename ratexpset_t::value_t ratexp_t
Definition: json_visitor.hxx:45
json::object_t * array_from_children(T e, std::string const &str)
Definition: json_visitor.hxx:88
typename ratexpset_t::const_visitor super_type
Definition: json_visitor.hxx:47
context_t_of< ratexpset_t > context_t
Definition: json_visitor.hxx:43
AWALI_RAT_VISIT(atom, e)
Definition: json_visitor.hxx:82
AWALI_RAT_VISIT(shuffle, e)
Definition: json_visitor.hxx:109
constexpr static const char * me()
Definition: json_visitor.hxx:51
json::object_t * ptr()
Definition: json_visitor.hxx:58
Definition: ratexp.hh:176
An inner node with multiple children.
Definition: ratexp.hh:115
An inner node implementing a weight.
Definition: ratexp.hh:208
typename internal::context_t_of_impl< internal::base_t< ValueSet > >::type context_t_of
Helper to retrieve the type of the context of a value set.
Definition: traits.hh:66
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
typename internal::weightset_t_of_impl< internal::base_t< ValueSet > >::type weightset_t_of
Helper to retrieve the type of the weightset of a value set.
Definition: traits.hh:86
Main namespace of Awali.
Definition: ato.hh:22
#define AWALI_RAT_UNSUPPORTED(Type)
Definition: visitor.hh:73