1 #ifndef VCSN_CTX_CONTEXT_HH
2 # define VCSN_CTX_CONTEXT_HH
18 template <
typename LabelSet,
typename WeightSet>
27 using kind_t =
typename labelset_t::kind_t;
38 using label_t =
typename labelset_t::value_t;
40 using weight_t =
typename weightset_t::value_t;
57 :
context(std::make_shared<const labelset_t>(ls),
58 std::make_shared<const weightset_t>(ws))
76 template <
typename LabelSet2 = labelset_t>
77 context(
const std::initializer_list<typename LabelSet2::letter_t>& gs,
83 template <
typename LabelSet2 = labelset_t>
85 :
context{
typename std::enable_if<is_lao, labelset_t>::type{},
93 std::swap(
ls_, that.ls_);
94 std::swap(
ws_, that.ws_);
107 std::string
vname(
bool full =
true)
const
116 auto ls = labelset_t::make(is);
118 while (isspace(is.peek()))
120 auto ws = weightset_t::make(is);
138 if (format ==
"latex")
142 return weightset()->print_set(o, format);
145 static constexpr
bool
148 return labelset_t::has_one();
158 template <
typename LabelSet,
typename WeightSet>
171 template <
typename... ValueSets>
181 template <
typename ValueSet>
189 template <
typename ValueSet1,
typename ValueSet2,
typename ValueSet3,
192 meet(
const ValueSet1& vs1,
const ValueSet2& vs2,
const ValueSet3& vs3,
194 -> decltype(
meet(
meet(vs1, vs2), vs3, vs...))
196 return meet(
meet(vs1, vs2), vs3, vs...);
207 template <
typename LS1,
typename WS1,
208 typename LS2,
typename WS2>
229 template <
typename LhsLabelSet,
typename LhsWeightSet,
230 typename RhsLabelSet,
typename RhsWeightSet>
237 auto ls =
meet(*a.labelset(), *
b.labelset());
238 auto ws =
join(*a.weightset(), *
b.weightset());
244 #endif // !VCSN_CTX_CONTEXT_HH
static context make(std::istream &is)
Build from the description in is.
decltype(join(std::declval< ValueSets >()...)) join_t
The type of the join of the ValueSets.
join_t< LS1, LS2 > labelset_t
const weightset_ptr & weightset() const
static std::string sname()
The name of this context, built from its parameters.
std::ostream & print_set(std::ostream &o, symbol format=symbol{"text"}) const
context(const labelset_t &ls, const weightset_t &ws={})
Build a context.
context & operator=(context &&that)
std::string vname(bool full=true) const
std::shared_ptr< const labelset_t > labelset_ptr
context(const labelset_ptr &ls, const weightset_ptr &ws)
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
typename weightset_t::value_t weight_t
Type of weights.
context(const context &that)
auto meet(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< meet_t< Ctx1, Ctx2 >>
The meet of two ratexpsets.
std::istringstream is
The input stream: the specification to translate.
static type join(const context< LS1, WS1 > &ctx1, const context< LS2, WS2 > &ctx2)
const labelset_ptr & labelset() const
A structure that implements the computation of join(V1, V2).
Provide a variadic mul on top of a binary mul(), and one().
join_t< WS1, WS2 > weightset_t
context(const std::initializer_list< typename LabelSet2::letter_t > &gs, const weightset_t &ws={})
Build a context.
decltype(meet(std::declval< ValueSets >()...)) meet_t
char eat(std::istream &is, char c)
Check lookahead character and advance.
typename labelset_t::value_t label_t
Type of transition labels, and type of RatExp atoms.
auto join(const ValueSet &vs) -> ValueSet
The join of a single valueset.
std::shared_ptr< const weightset_t > weightset_ptr
typename labelset_t::kind_t kind_t
context()
Build a context whose labelset constructor takes no argument.
Ctx make_context(const std::string &name)
static constexpr bool has_one()