17 #ifndef AWALI_CTX_CONTEXT_HH 
   18 # define AWALI_CTX_CONTEXT_HH 
   24 #include <awali/common/json/node.cc> 
   31 namespace awali { 
namespace sttc {
 
   38   template <
typename LabelSet, 
typename WeightSet>
 
   47     using kind_t = 
typename labelset_t::kind_t;
 
   58     using label_t = 
typename labelset_t::value_t;
 
   60     using weight_t = 
typename weightset_t::value_t;
 
   63     using ratexp_t = std::shared_ptr<const node_t>;
 
   82       : 
context(std::make_shared<const labelset_t>(ls),
 
   83                 std::make_shared<const weightset_t>(ws))
 
  101     template <
typename LabelSet2 = labelset_t>
 
  102     context(
const std::initializer_list<typename LabelSet2::letter_t>& gs,
 
  108     template <
typename LabelSet2 = labelset_t>
 
  133       return (labelset_t::sname()
 
  134               + 
"_" + weightset_t::sname());
 
  146       auto ls = labelset_t::make(is);
 
  148       auto ws = weightset_t::make(is);
 
  175     template<
unsigned version = version::fsm_json>
 
  178       version::check_fsmjson<version>();
 
  180       obj->
push_back(
"labels",  ls_->template to_json<version>());
 
  181       obj->
push_back(
"weights", ws_->template to_json<version>());
 
  185     static constexpr 
bool 
  188       return labelset_t::has_one();
 
  209   template <
typename... ValueSets>
 
  219   template <
typename... ValueSets>
 
  229   template <
typename ValueSet>
 
  237   template <
typename ValueSet1, 
typename ValueSet2,
 
  238             typename ValueSet3, 
typename... VSs>
 
  240   join(
const ValueSet1& vs1, 
const ValueSet2& vs2, 
const ValueSet3& vs3,
 
  242     -> decltype(
join(
join(vs1, vs2), vs3, vs...))
 
  244     return join(
join(vs1, vs2), vs3, vs...);
 
  249   template <
typename ValueSet>
 
  257   template <
typename ValueSet1, 
typename ValueSet2, 
typename ValueSet3,
 
  260   meet(
const ValueSet1& vs1, 
const ValueSet2& vs2, 
const ValueSet3& vs3,
 
  262     -> decltype(
meet(
meet(vs1, vs2), vs3, vs...))
 
  264     return meet(
meet(vs1, vs2), vs3, vs...);
 
  273   template <
typename LhsLabelSet, 
typename LhsWeightSet,
 
  274             typename RhsLabelSet, 
typename RhsWeightSet>
 
  281     auto ls = 
join(*a.labelset(), *
b.labelset());
 
  282     auto ws = 
join(*a.weightset(), *
b.weightset());
 
  292   template <
typename LhsLabelSet, 
typename LhsWeightSet,
 
  293             typename RhsLabelSet, 
typename RhsWeightSet>
 
  300     auto ls = 
meet(*a.labelset(), *
b.labelset());
 
  301     auto ws = 
join(*a.weightset(), *
b.weightset());
 
object_t * push_back(std::string key, node_t *node)
 
The Boolean semring.
Definition: b.hh:38
 
carries the algebraic settings of automata
Definition: context.hh:40
 
std::string vname(bool full=true) const
Definition: context.hh:137
 
LabelSet labelset_t
Definition: context.hh:42
 
const weightset_ptr & weightset() const
Definition: context.hh:157
 
typename labelset_t::kind_t kind_t
Definition: context.hh:47
 
static std::string sname()
The name of this context, built from its parameters.
Definition: context.hh:131
 
@ is_law
Definition: context.hh:55
 
@ is_lao
Definition: context.hh:52
 
@ is_lat
Definition: context.hh:54
 
@ is_lal
Definition: context.hh:50
 
@ is_lar
Definition: context.hh:53
 
@ is_lan
Definition: context.hh:51
 
context(const labelset_ptr &ls, const weightset_ptr &ws)
Definition: context.hh:73
 
json::node_t * to_json() const
Definition: context.hh:177
 
static constexpr bool has_one()
Definition: context.hh:186
 
context & operator=(const context &other)=default
 
typename labelset_t::value_t label_t
Type of transition labels, and type of RatExp atoms.
Definition: context.hh:58
 
std::shared_ptr< const weightset_t > weightset_ptr
Definition: context.hh:45
 
context()
Build a context whose labelset constructor takes no argument.
Definition: context.hh:109
 
static context make(std::istream &is)
Build from the description in is.
Definition: context.hh:144
 
std::shared_ptr< const labelset_t > labelset_ptr
Definition: context.hh:44
 
context(const std::initializer_list< typename LabelSet2::letter_t > &gs, const weightset_t &ws={})
Build a context.
Definition: context.hh:102
 
WeightSet weightset_t
Definition: context.hh:43
 
typename weightset_t::value_t weight_t
Type of weights.
Definition: context.hh:60
 
std::shared_ptr< const node_t > ratexp_t
Definition: context.hh:63
 
const labelset_ptr & labelset() const
Definition: context.hh:152
 
context(const context &that)
Definition: context.hh:67
 
context(const labelset_t &ls, const weightset_t &ws={})
Build a context.
Definition: context.hh:81
 
std::ostream & print_set(std::ostream &o, const std::string &format="text") const
Definition: context.hh:163
 
Definition: visitor.hh:30
 
The abstract parameterized, root for all rational expression types.
Definition: ratexp.hh:74
 
static constexpr TOP< void > value
Definition: priority.hh:93
 
void eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.hh:62
 
decltype(join(std::declval< ValueSets >()...)) join_t
Computation of the join of some value sets.
Definition: context.hh:210
 
auto join(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< join_t< Ctx1, Ctx2 >>
The union of two ratexpsets.
Definition: ratexpset.hh:449
 
auto meet(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< meet_t< Ctx1, Ctx2 >>
The meet of two ratexpsets.
Definition: ratexpset.hh:438
 
auto format(const ValueSet &vs, const typename ValueSet::value_t &v, Args &&... args) -> std::string
Format v via vs.print.
Definition: stream.hh:109
 
decltype(meet(std::declval< ValueSets >()...)) meet_t
Computation of the meet of some value sets.
Definition: context.hh:220
 
static const std::string full
Completely version of Awali as a std::string.
Definition: version.hh:42
 
Main namespace of Awali.
Definition: ato.hh:22