17 #ifndef AWALI_CORE_RAT_RATEXP_HH
18 # define AWALI_CORE_RAT_RATEXP_HH
28 namespace awali {
namespace sttc
70 template <
typename Label,
typename Weight>
72 :
public std::enable_shared_from_this<node<Label, Weight>>
79 using value_t = std::shared_ptr<const node_t>;
93 template <
typename Label,
typename Weight>
95 :
public node<Label, Weight>
112 template <exp::type_t Type,
typename Label,
typename Weight>
114 :
public inner<Label, Weight>
173 template <exp::type_t Type,
typename Label,
typename Weight>
175 :
public inner<Label, Weight>
178 static_assert(
is_unary(Type),
"invalid type");
205 template <exp::type_t Type,
typename Label,
typename Weight>
207 :
public inner<Label, Weight>
229 , weight_(that.weight_)
245 template <
typename Label,
typename Weight>
247 :
public node<Label, Weight>
259 template <exp::type_t Type,
typename Label,
typename Weight>
261 :
public leaf<Label, Weight>
277 template <
typename Label,
typename Weight>
279 :
public leaf<Label, Weight>
The semiring of Natural numbers.
Definition: n.hh:34
Definition: ratexp.hh:280
Label label_t
Definition: ratexp.hh:282
atom(const label_t &value)
Definition: ratexp.hxx:43
virtual void accept(typename node_t::const_visitor &v) const override
Definition: ratexp.hxx:47
const label_t & value() const
Definition: ratexp.hxx:53
virtual type_t type() const override
The type of this node.
Definition: ratexp.hh:291
Definition: visitor.hh:30
Definition: ratexp.hh:262
virtual type_t type() const override
The type of this node.
Definition: ratexp.hh:271
virtual void accept(typename node_t::const_visitor &v) const override
Definition: ratexp.hxx:208
The abstract, non-parameterized, root for all rational expression node types.
Definition: ratexp.hh:36
bool is_leaf() const
Whether a leaf of the ratexp tree.
Definition: ratexp.hh:55
rat::type_t type_t
The possible types of ratexps.
Definition: ratexp.hh:43
bool is_unary() const
Whether star, complement.
Definition: ratexp.hh:49
virtual type_t type() const =0
The type of this node.
An inner node.
Definition: ratexp.hh:96
typename super_type::value_t value_t
Definition: ratexp.hh:101
The root from which to derive the final node types.
Definition: ratexp.hh:248
node< label_t, weight_t > node_t
Definition: ratexp.hh:252
The abstract parameterized, root for all rational expression types.
Definition: ratexp.hh:74
std::shared_ptr< node_t > wvalue_t
Same as value_t, but writable. Use with care.
Definition: ratexp.hh:81
Weight weight_t
Definition: ratexp.hh:77
sttc::rat::const_visitor< label_t, weight_t > const_visitor
Definition: ratexp.hh:83
std::shared_ptr< const node_t > value_t
Definition: ratexp.hh:79
std::vector< value_t > ratexps_t
Definition: ratexp.hh:82
Label label_t
Definition: ratexp.hh:76
virtual void accept(const_visitor &v) const =0
Definition: ratexp.hh:176
virtual void accept(typename node_t::const_visitor &v) const override
Definition: ratexp.hxx:198
const value_t sub() const
Definition: ratexp.hxx:192
typename node_t::value_t value_t
Definition: ratexp.hh:184
virtual type_t type() const override
The type of this node.
Definition: ratexp.hh:187
unary(value_t exp)
Definition: ratexp.hxx:188
An inner node with multiple children.
Definition: ratexp.hh:115
typename super_type::ratexps_t ratexps_t
Definition: ratexp.hh:124
const_iterator end() const
Definition: ratexp.hxx:90
const value_t back() const
The last item of this variadic.
Definition: ratexp.hxx:126
const_iterator begin() const
Definition: ratexp.hxx:84
typename ratexps_t::const_iterator const_iterator
Definition: ratexp.hh:126
typename super_type::value_t value_t
Definition: ratexp.hh:123
typename ratexps_t::const_reverse_iterator const_reverse_iterator
Definition: ratexp.hh:131
virtual type_t type() const override
The type of this node.
Definition: ratexp.hh:134
const_iterator iterator
Definition: ratexp.hh:130
const_reverse_iterator reverse_iterator
Definition: ratexp.hh:132
const value_t operator[](size_t n) const
Access the n-th element.
Definition: ratexp.hxx:114
const value_t head() const
The first item of this variadic.
Definition: ratexp.hxx:120
ratexps_t subs() const
Return a copy of children.
Definition: ratexp.hxx:139
const_reverse_iterator rbegin() const
Definition: ratexp.hxx:96
virtual void accept(typename node_t::const_visitor &v) const override
Definition: ratexp.hxx:145
const_reverse_iterator rend() const
Definition: ratexp.hxx:102
size_t size() const
Definition: ratexp.hxx:108
auto tail() const -> internal::it_cont< const_iterator >
The non-first items.
Definition: ratexp.hxx:132
An inner node implementing a weight.
Definition: ratexp.hh:208
weight_node(const weight_node &that)
Definition: ratexp.hh:227
virtual type_t type() const override
The type of this node.
Definition: ratexp.hh:220
void set_weight(const weight_t &w)
Definition: ratexp.hxx:172
Weight weight_t
Definition: ratexp.hh:215
const value_t sub() const
Definition: ratexp.hxx:160
weight_node(const weight_t &w, value_t exp)
Definition: ratexp.hxx:155
virtual void accept(typename node_t::const_visitor &v) const override
Definition: ratexp.hxx:178
typename super_type::value_t value_t
Definition: ratexp.hh:218
const weight_t & weight() const
Definition: ratexp.hxx:166
constexpr bool is_unary(type_t t)
Whether star, complement.
Definition: fwd.hh:72
constexpr bool is_constant(type_t t)
Whether is a constant (\z or \e).
Definition: fwd.hh:65
type_t
The possible types of ratexps.
Definition: fwd.hh:48
constexpr bool is_variadic(type_t t)
Whether one of the variadic types.
Definition: fwd.hh:80
Main namespace of Awali.
Definition: ato.hh:22