Awali
Another Weighted Automata library
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
awali::sttc::tupleset< ValueSets > Class Template Reference

A ValueSet which is a Cartesian product of ValueSets. More...

#include <fwd.hh>

Public Types

using genset_t = typename labelset_types< ValueSets... >::genset_t
 A tuple of gensets if meaningful, void otherwise. More...
 
using indices_t = awali::internal::make_index_sequence< sizeof...(ValueSets)>
 
using is_tupleset_t = bool
 
using kind_t = labels_are_tuples
 
using letter_t = typename labelset_types< ValueSets... >::letter_t
 A tuple of letters if meaningful, void otherwise. More...
 
using self_type = tupleset
 
template<std::size_t... I>
using seq = awali::internal::index_sequence< I... >
 
using value_t = std::tuple< typename ValueSets::value_t... >
 A tuple of values. More...
 
using value_type = letter_t
 To be iterable. More...
 
template<std::size_t I>
using valueset_t = typename std::tuple_element< I, valuesets_t >::type
 The Ith valueset type. More...
 
using valuesets_t = std::tuple< ValueSets... >
 
using word_t = typename labelset_types< ValueSets... >::word_t
 A tuple of words if meaningful, void otherwise. More...
 

Public Member Functions

 tupleset (ValueSets... ls)
 
 tupleset (valuesets_t vs)
 
value_t add (const value_t &l, const value_t &r) const
 
template<std::size_t... I>
void comma (const std::string &s, size_t &p, char &c) const
 
template<typename LhsValue , typename RhsValue >
word_t concat (const LhsValue &l, const RhsValue &r) const
 
value_t conv (b, b::value_t v) const
 
template<typename T >
value_t conv (const T &tset, typename T::value_t v) const
 
value_t conv (std::istream &i) const
 Read one letter from i, return the corresponding value. More...
 
std::set< value_tconvs (std::istream &) const
 
template<typename Value >
Value delimit (const Value &l) const
 Add the special character first and last. More...
 
genset_t genset () const
 The generators. Meaningful for labelsets only. More...
 
bool is_letter (const value_t &) const
 
bool is_zero (const value_t &l) const
 
value_t ldiv (const value_t &l, const value_t &r) const
 
value_t mul (const value_t &l, const value_t &r) const
 
bool open (bool o) const
 Whether unknown letters should be added, or rejected. More...
 
value_t parse (const std::string &s, size_t &p, bool fixed_domain=true) const
 
template<std::size_t... I>
value_t parse_ (const std::string &s, size_t &p, bool fixed_domain, seq< I... >) const
 
std::ostream & print (const value_t &l, std::ostream &o, const std::string &format="text") const
 
std::ostream & print_set (std::ostream &o, const std::string &format="text") const
 
value_t rdiv (const value_t &l, const value_t &r) const
 
template<size_t I>
const valueset_t< I > & set () const
 The Ith component valueset. More...
 
const valuesets_tsets () const
 The componants valuesets, as a tuple. More...
 
value_t star (const value_t &l) const
 
template<unsigned version = version::fsm_json>
json::node_tto_json () const
 
value_t transpose (const value_t &l) const
 
template<typename Value >
Value undelimit (const Value &l) const
 Remove first and last characters, that must be "special". More...
 
template<typename... Args>
value_t value (const std::tuple< Args... > &args) const
 Construct a value. More...
 
template<unsigned version = version::fsm_json>
value_t value_from_json (json::node_t const *p) const
 
template<unsigned version, std::size_t... I>
value_t value_from_json (std::vector< json::node_t * > const &v, seq< I... >) const
 
template<unsigned version = version::fsm_json>
json::node_tvalue_to_json (value_t v) const
 
std::string vname (bool full=true) const
 
template<typename... Args>
auto word (const std::tuple< Args... > &v) const -> word_t
 Convert to a word. More...
 
value_t zero () const
 

Static Public Member Functions

static value_t conv (self_type, value_t v)
 
static bool equals (const value_t &l, const value_t &r)
 
static constexpr bool has_one ()
 
static size_t hash (const value_t &v)
 
template<std::size_t... I>
static constexpr bool is_commutative_semiring ()
 
static constexpr bool is_free ()
 
static constexpr bool is_letterized ()
 
static bool is_one (const value_t &l)
 
static constexpr bool is_ratexpset ()
 
static bool is_special (const value_t &l)
 
static bool less_than (const value_t &l, const value_t &r)
 Whether l < r. More...
 
template<typename Value >
static auto letters_of (const Value &v) -> decltype(letters_of_(v, indices))
 Iterate over the letters of v. More...
 
static tupleset make (std::istream &is)
 Build from the description in is. More...
 
static value_t one ()
 
static bool show_one ()
 
static constexpr std::size_t size ()
 
static std::string sname ()
 
static value_t special ()
 
static constexpr star_status_t star_status ()
 

Static Public Attributes

static constexpr indices_t indices {}
 

Detailed Description

template<typename... ValueSets>
class awali::sttc::tupleset< ValueSets >

A ValueSet which is a Cartesian product of ValueSets.

Exposes a LabelSet interface for products of LabelSets, and similarly for WeightSets.

Member Typedef Documentation

◆ genset_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::genset_t = typename labelset_types<ValueSets...>::genset_t

A tuple of gensets if meaningful, void otherwise.

◆ indices_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::indices_t = awali::internal::make_index_sequence<sizeof...(ValueSets)>

◆ is_tupleset_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::is_tupleset_t = bool

◆ kind_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::kind_t = labels_are_tuples

◆ letter_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::letter_t = typename labelset_types<ValueSets...>::letter_t

A tuple of letters if meaningful, void otherwise.

◆ self_type

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::self_type = tupleset

◆ seq

template<typename... ValueSets>
template<std::size_t... I>
using awali::sttc::tupleset< ValueSets >::seq = awali::internal::index_sequence<I...>

◆ value_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::value_t = std::tuple<typename ValueSets::value_t...>

A tuple of values.

◆ value_type

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::value_type = letter_t

To be iterable.

◆ valueset_t

template<typename... ValueSets>
template<std::size_t I>
using awali::sttc::tupleset< ValueSets >::valueset_t = typename std::tuple_element<I, valuesets_t>::type

The Ith valueset type.

◆ valuesets_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::valuesets_t = std::tuple<ValueSets...>

◆ word_t

template<typename... ValueSets>
using awali::sttc::tupleset< ValueSets >::word_t = typename labelset_types<ValueSets...>::word_t

A tuple of words if meaningful, void otherwise.

Constructor & Destructor Documentation

◆ tupleset() [1/2]

template<typename... ValueSets>
awali::sttc::tupleset< ValueSets >::tupleset ( valuesets_t  vs)

◆ tupleset() [2/2]

template<typename... ValueSets>
awali::sttc::tupleset< ValueSets >::tupleset ( ValueSets...  ls)

Member Function Documentation

◆ add()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::add ( const value_t l,
const value_t r 
) const

◆ comma()

template<typename... ValueSets>
template<std::size_t... I>
void awali::sttc::tupleset< ValueSets >::comma ( const std::string &  s,
size_t &  p,
char &  c 
) const

◆ concat()

template<typename... ValueSets>
template<typename LhsValue , typename RhsValue >
word_t awali::sttc::tupleset< ValueSets >::concat ( const LhsValue &  l,
const RhsValue &  r 
) const

◆ conv() [1/4]

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::conv ( b  ,
b::value_t  v 
) const

◆ conv() [2/4]

template<typename... ValueSets>
template<typename T >
value_t awali::sttc::tupleset< ValueSets >::conv ( const T &  tset,
typename T::value_t  v 
) const

◆ conv() [3/4]

template<typename... ValueSets>
static value_t awali::sttc::tupleset< ValueSets >::conv ( self_type  ,
value_t  v 
)
static

◆ conv() [4/4]

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::conv ( std::istream &  i) const

Read one letter from i, return the corresponding value.

◆ convs()

template<typename... ValueSets>
std::set<value_t> awali::sttc::tupleset< ValueSets >::convs ( std::istream &  ) const

◆ delimit()

template<typename... ValueSets>
template<typename Value >
Value awali::sttc::tupleset< ValueSets >::delimit ( const Value &  l) const

Add the special character first and last.

Templated by Value so that we work for both word_t and label_t. Besides, avoids the problem of instantiation with weighset that do not provide a word_t type.

◆ equals()

template<typename... ValueSets>
static bool awali::sttc::tupleset< ValueSets >::equals ( const value_t l,
const value_t r 
)
static

◆ genset()

template<typename... ValueSets>
genset_t awali::sttc::tupleset< ValueSets >::genset ( ) const

The generators. Meaningful for labelsets only.

◆ has_one()

template<typename... ValueSets>
static constexpr bool awali::sttc::tupleset< ValueSets >::has_one ( )
staticconstexpr

◆ hash()

template<typename... ValueSets>
static size_t awali::sttc::tupleset< ValueSets >::hash ( const value_t v)
static

◆ is_commutative_semiring()

template<typename... ValueSets>
template<std::size_t... I>
static constexpr bool awali::sttc::tupleset< ValueSets >::is_commutative_semiring ( )
staticconstexpr

◆ is_free()

template<typename... ValueSets>
static constexpr bool awali::sttc::tupleset< ValueSets >::is_free ( )
staticconstexpr

◆ is_letter()

template<typename... ValueSets>
bool awali::sttc::tupleset< ValueSets >::is_letter ( const value_t ) const

◆ is_letterized()

template<typename... ValueSets>
static constexpr bool awali::sttc::tupleset< ValueSets >::is_letterized ( )
staticconstexpr

◆ is_one()

template<typename... ValueSets>
static bool awali::sttc::tupleset< ValueSets >::is_one ( const value_t l)
static

◆ is_ratexpset()

template<typename... ValueSets>
static constexpr bool awali::sttc::tupleset< ValueSets >::is_ratexpset ( )
staticconstexpr

◆ is_special()

template<typename... ValueSets>
static bool awali::sttc::tupleset< ValueSets >::is_special ( const value_t l)
static

◆ is_zero()

template<typename... ValueSets>
bool awali::sttc::tupleset< ValueSets >::is_zero ( const value_t l) const

◆ ldiv()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::ldiv ( const value_t l,
const value_t r 
) const

◆ less_than()

template<typename... ValueSets>
static bool awali::sttc::tupleset< ValueSets >::less_than ( const value_t l,
const value_t r 
)
static

Whether l < r.

◆ letters_of()

template<typename... ValueSets>
template<typename Value >
static auto awali::sttc::tupleset< ValueSets >::letters_of ( const Value &  v) -> decltype(letters_of_(v, indices))
static

Iterate over the letters of v.

Templated by Value so that we work for both word_t and label_t. Besides, avoids the problem of instantiation with weighset that do not provide a word_t type.

◆ make()

template<typename... ValueSets>
static tupleset awali::sttc::tupleset< ValueSets >::make ( std::istream &  is)
static

Build from the description in is.

◆ mul()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::mul ( const value_t l,
const value_t r 
) const

◆ one()

template<typename... ValueSets>
static value_t awali::sttc::tupleset< ValueSets >::one ( )
static

◆ open()

template<typename... ValueSets>
bool awali::sttc::tupleset< ValueSets >::open ( bool  o) const

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept
Returns
the previous status.

◆ parse()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::parse ( const std::string &  s,
size_t &  p,
bool  fixed_domain = true 
) const

◆ parse_()

template<typename... ValueSets>
template<std::size_t... I>
value_t awali::sttc::tupleset< ValueSets >::parse_ ( const std::string &  s,
size_t &  p,
bool  fixed_domain,
seq< I... >   
) const

◆ print()

template<typename... ValueSets>
std::ostream& awali::sttc::tupleset< ValueSets >::print ( const value_t l,
std::ostream &  o,
const std::string &  format = "text" 
) const

◆ print_set()

template<typename... ValueSets>
std::ostream& awali::sttc::tupleset< ValueSets >::print_set ( std::ostream &  o,
const std::string &  format = "text" 
) const

◆ rdiv()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::rdiv ( const value_t l,
const value_t r 
) const

◆ set()

template<typename... ValueSets>
template<size_t I>
const valueset_t<I>& awali::sttc::tupleset< ValueSets >::set ( ) const

The Ith component valueset.

◆ sets()

template<typename... ValueSets>
const valuesets_t& awali::sttc::tupleset< ValueSets >::sets ( ) const

The componants valuesets, as a tuple.

◆ show_one()

template<typename... ValueSets>
static bool awali::sttc::tupleset< ValueSets >::show_one ( )
static

◆ size()

template<typename... ValueSets>
static constexpr std::size_t awali::sttc::tupleset< ValueSets >::size ( )
staticconstexpr

◆ sname()

template<typename... ValueSets>
static std::string awali::sttc::tupleset< ValueSets >::sname ( )
static

◆ special()

template<typename... ValueSets>
static value_t awali::sttc::tupleset< ValueSets >::special ( )
static

◆ star()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::star ( const value_t l) const

◆ star_status()

template<typename... ValueSets>
static constexpr star_status_t awali::sttc::tupleset< ValueSets >::star_status ( )
staticconstexpr

◆ to_json()

template<typename... ValueSets>
template<unsigned version = version::fsm_json>
json::node_t* awali::sttc::tupleset< ValueSets >::to_json ( ) const

◆ transpose()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::transpose ( const value_t l) const

◆ undelimit()

template<typename... ValueSets>
template<typename Value >
Value awali::sttc::tupleset< ValueSets >::undelimit ( const Value &  l) const

Remove first and last characters, that must be "special".

◆ value()

template<typename... ValueSets>
template<typename... Args>
value_t awali::sttc::tupleset< ValueSets >::value ( const std::tuple< Args... > &  args) const

Construct a value.

◆ value_from_json() [1/2]

template<typename... ValueSets>
template<unsigned version = version::fsm_json>
value_t awali::sttc::tupleset< ValueSets >::value_from_json ( json::node_t const *  p) const

◆ value_from_json() [2/2]

template<typename... ValueSets>
template<unsigned version, std::size_t... I>
value_t awali::sttc::tupleset< ValueSets >::value_from_json ( std::vector< json::node_t * > const &  v,
seq< I... >   
) const

◆ value_to_json()

template<typename... ValueSets>
template<unsigned version = version::fsm_json>
json::node_t* awali::sttc::tupleset< ValueSets >::value_to_json ( value_t  v) const

◆ vname()

template<typename... ValueSets>
std::string awali::sttc::tupleset< ValueSets >::vname ( bool  full = true) const

◆ word()

template<typename... ValueSets>
template<typename... Args>
auto awali::sttc::tupleset< ValueSets >::word ( const std::tuple< Args... > &  v) const -> word_t

Convert to a word.

◆ zero()

template<typename... ValueSets>
value_t awali::sttc::tupleset< ValueSets >::zero ( ) const

Field Documentation

◆ indices

template<typename... ValueSets>
constexpr indices_t awali::sttc::tupleset< ValueSets >::indices {}
staticconstexpr

The documentation for this class was generated from the following files: