Vcsn  2.4
Be Rational
vcsn::letterset< GenSet > Class Template Reference

Implementation of labels are letters. More...

#include <fwd.hh>

Inheritance diagram for vcsn::letterset< GenSet >:
Collaboration diagram for vcsn::letterset< GenSet >:

Public Types

using genset_t = GenSet
 
using super_t = detail::genset_labelset< genset_t >
 
using self_t = letterset
 
using genset_ptr = std::shared_ptr< const genset_t >
 
using letter_t = typename genset_t::letter_t
 
using word_t = typename genset_t::word_t
 
using value_t = letter_t
 
using values_t = std::set< value_t, vcsn::less< self_t >>
 
using kind_t = labels_are_letters
 
- Public Types inherited from vcsn::detail::genset_labelset< GenSet >
using genset_t = GenSet
 
using genset_ptr = std::shared_ptr< const genset_t >
 
using letter_t = typename genset_t::letter_t
 
using word_t = typename genset_t::word_t
 
using letters_t = typename genset_t::letters_t
 

Public Member Functions

 letterset (const genset_ptr &gs)
 
 letterset (const genset_t &gs={})
 
 letterset (std::initializer_list< letter_t > letters)
 
bool open (bool o) const
 Whether unknown letters should be added, or rejected. More...
 
template<typename... Args>
value_t value (Args &&...args) const
 Value constructor. More...
 
bool is_valid (value_t v) const
 
value_t conv (self_t, value_t v) const
 
template<typename LabelSet_ >
value_t conv (const nullableset< LabelSet_ > &ls, typename nullableset< LabelSet_ >::value_t v) const
 Convert from nullableset to letterset. More...
 
value_t conv (std::istream &i, bool quoted=true) const
 Read one letter from i, return the corresponding label. More...
 
template<typename Fun >
void convs (std::istream &i, Fun fun) const
 Process a label class. More...
 
value_t lgcd (const value_t l, const value_t r) const
 The longest common prefix. More...
 
value_t ldivide (const value_t l, const value_t r) const
 Compute w1 \ w2 = w1^{-1}w2. More...
 
boost::optional< value_tmaybe_ldivide (const value_t l, const value_t r) const
 
value_t rdivide (const value_t l, const value_t r) const
 Compute w1 / w2. More...
 
boost::optional< value_tmaybe_rdivide (const value_t l, const value_t r) const
 
value_t conjunction (const value_t l, const value_t r) const
 
std::ostream & print (const value_t &l, std::ostream &o=std::cout, format fmt={}) const
 
std::ostream & print_set (std::ostream &o, format fmt={}) const
 
- Public Member Functions inherited from vcsn::detail::genset_labelset< GenSet >
 genset_labelset (const genset_ptr &gs)
 
 genset_labelset (const genset_t &gs={})
 
genset_ptr genset () const
 
const genset_tgenerators () const
 
template<typename Fun >
void convs_ (std::istream &i, Fun fun) const
 Read and process a class of letters. More...
 
letter_t get_letter (std::istream &i, bool quoted=true) const
 Read one letter from i. More...
 
template<typename... Args>
auto begin (Args &&...args) const -> decltype(this->genset() -> begin(std::forward< Args >(args)...))
 
template<typename... Args>
auto delimit (Args &&...args) const -> decltype(this->genset() -> delimit(std::forward< Args >(args)...))
 
template<typename... Args>
auto end (Args &&...args) const -> decltype(this->genset() -> end(std::forward< Args >(args)...))
 
template<typename... Args>
ATTRIBUTE_PURE auto equal (Args &&...args) const -> decltype(this->genset() -> equal(std::forward< Args >(args)...))
 
template<typename... Args>
auto get_word (Args &&...args) const -> decltype(this->genset() -> get_word(std::forward< Args >(args)...))
 
template<typename... Args>
ATTRIBUTE_PURE auto has (Args &&...args) const -> decltype(this->genset() -> has(std::forward< Args >(args)...))
 
template<typename... Args>
ATTRIBUTE_PURE auto is_letter (Args &&...args) const -> decltype(this->genset() -> is_letter(std::forward< Args >(args)...))
 
template<typename... Args>
ATTRIBUTE_PURE auto less (Args &&...args) const -> decltype(this->genset() -> less(std::forward< Args >(args)...))
 
template<typename... Args>
auto mul (Args &&...args) const -> decltype(this->genset() -> mul(std::forward< Args >(args)...))
 
template<typename... Args>
ATTRIBUTE_PURE auto transpose (Args &&...args) const -> decltype(this->genset() -> transpose(std::forward< Args >(args)...))
 
template<typename... Args>
auto undelimit (Args &&...args) const -> decltype(this->genset() -> undelimit(std::forward< Args >(args)...))
 

Static Public Member Functions

static symbol sname ()
 
static letterset make (std::istream &is)
 Build from the description in is. More...
 
static constexpr bool is_free ()
 
static word_t word (value_t v)
 Convert to a word. More...
 
static word_t letters_of (word_t v)
 Prepare to iterate over the letters of v. More...
 
static word_t letters_of_padded (word_t v, letter_t)
 Prepare to iterate over the letters of v. More...
 
static word_t letters_of (letter_t v)
 Prepare to iterate over v. More...
 
static word_t letters_of_padded (letter_t v, letter_t)
 Prepare to iterate over v. More...
 
static value_t special () ATTRIBUTE_PURE
 
static bool equal (const value_t l, const value_t r)
 Whether l == r. More...
 
static bool less (const value_t l, const value_t r)
 Whether l < r. More...
 
static constexpr bool has_one ()
 
static constexpr bool is_expressionset ()
 
static constexpr bool is_letterized ()
 
static bool is_special (value_t v) ATTRIBUTE_PURE
 
static constexpr bool is_one (value_t)
 
static size_t size (value_t)
 
static size_t hash (value_t v)
 
- Static Public Member Functions inherited from vcsn::detail::genset_labelset< GenSet >
static symbol sname ()
 

Detailed Description

template<typename GenSet>
class vcsn::letterset< GenSet >

Implementation of labels are letters.

Definition at line 10 of file fwd.hh.

Member Typedef Documentation

template<typename GenSet>
using vcsn::letterset< GenSet >::genset_ptr = std::shared_ptr<const genset_t>

Definition at line 28 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::genset_t = GenSet

Definition at line 25 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::kind_t = labels_are_letters

Definition at line 36 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::letter_t = typename genset_t::letter_t

Definition at line 30 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::self_t = letterset

Definition at line 27 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::super_t = detail::genset_labelset<genset_t>

Definition at line 26 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::value_t = letter_t

Definition at line 33 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::values_t = std::set<value_t, vcsn::less<self_t>>

Definition at line 34 of file letterset.hh.

template<typename GenSet>
using vcsn::letterset< GenSet >::word_t = typename genset_t::word_t

Definition at line 31 of file letterset.hh.

Constructor & Destructor Documentation

template<typename GenSet>
vcsn::letterset< GenSet >::letterset ( const genset_ptr gs)
inline

Definition at line 38 of file letterset.hh.

template<typename GenSet>
vcsn::letterset< GenSet >::letterset ( const genset_t gs = {})
inline

Definition at line 42 of file letterset.hh.

template<typename GenSet>
vcsn::letterset< GenSet >::letterset ( std::initializer_list< letter_t letters)
inline

Definition at line 46 of file letterset.hh.

Member Function Documentation

template<typename GenSet>
value_t vcsn::letterset< GenSet >::conjunction ( const value_t  l,
const value_t  r 
) const
inline

Definition at line 291 of file letterset.hh.

References vcsn::letterset< GenSet >::equal(), and vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
value_t vcsn::letterset< GenSet >::conv ( self_t  ,
value_t  v 
) const
inline

Definition at line 191 of file letterset.hh.

References vcsn::letterset< GenSet >::is_special(), vcsn::letterset< GenSet >::is_valid(), vcsn::str_escape(), vcsn::v, and VCSN_REQUIRE.

Referenced by vcsn::letterset< GenSet >::conv().

Here is the call graph for this function:

template<typename GenSet>
template<typename LabelSet_ >
value_t vcsn::letterset< GenSet >::conv ( const nullableset< LabelSet_ > &  ls,
typename nullableset< LabelSet_ >::value_t  v 
) const
inline

Convert from nullableset to letterset.

Definition at line 201 of file letterset.hh.

References vcsn::letterset< GenSet >::conv(), vcsn::nullableset< LabelSet >::get_value(), vcsn::nullableset< LabelSet >::is_one(), vcsn::nullableset< LabelSet >::labelset(), and vcsn::require().

Here is the call graph for this function:

template<typename GenSet>
value_t vcsn::letterset< GenSet >::conv ( std::istream &  i,
bool  quoted = true 
) const
inline

Read one letter from i, return the corresponding label.

Definition at line 211 of file letterset.hh.

References vcsn::detail::genset_labelset< GenSet >::get_letter(), and vcsn::require().

Here is the call graph for this function:

template<typename GenSet>
template<typename Fun >
void vcsn::letterset< GenSet >::convs ( std::istream &  i,
Fun  fun 
) const
inline

Process a label class.

Stream i is right on a [. Read up to the closing ], and process the labels.

For instance "[a-d0-9_]".

Parameters
ithe input stream.
funa (label_t) -> void function.

Definition at line 235 of file letterset.hh.

References vcsn::detail::genset_labelset< GenSet >::convs_().

Here is the call graph for this function:

template<typename GenSet>
static bool vcsn::letterset< GenSet >::equal ( const value_t  l,
const value_t  r 
)
inlinestatic

Whether l == r.

Definition at line 133 of file letterset.hh.

Referenced by vcsn::letterset< GenSet >::conjunction().

template<typename GenSet>
static constexpr bool vcsn::letterset< GenSet >::has_one ( )
inlinestatic

Definition at line 145 of file letterset.hh.

template<typename GenSet>
static size_t vcsn::letterset< GenSet >::hash ( value_t  v)
inlinestatic

Definition at line 185 of file letterset.hh.

References vcsn::detail::hash_value().

Here is the call graph for this function:

template<typename GenSet>
static constexpr bool vcsn::letterset< GenSet >::is_expressionset ( )
inlinestatic

Definition at line 151 of file letterset.hh.

template<typename GenSet>
static constexpr bool vcsn::letterset< GenSet >::is_free ( )
inlinestatic

Definition at line 76 of file letterset.hh.

template<typename GenSet>
static constexpr bool vcsn::letterset< GenSet >::is_letterized ( )
inlinestatic

Definition at line 157 of file letterset.hh.

template<typename GenSet>
static constexpr bool vcsn::letterset< GenSet >::is_one ( value_t  )
inlinestatic

Definition at line 169 of file letterset.hh.

template<typename GenSet>
static bool vcsn::letterset< GenSet >::is_special ( value_t  v)
inlinestatic

Definition at line 163 of file letterset.hh.

References vcsn::letterset< GenSet >::special(), and vcsn::v.

Referenced by vcsn::letterset< GenSet >::conv(), and vcsn::wordset< GenSet >::conv().

Here is the call graph for this function:

template<typename GenSet>
bool vcsn::letterset< GenSet >::is_valid ( value_t  v) const
inline

Definition at line 175 of file letterset.hh.

References vcsn::detail::genset_labelset< GenSet >::has().

Referenced by vcsn::letterset< GenSet >::conv().

Here is the call graph for this function:

template<typename GenSet>
value_t vcsn::letterset< GenSet >::ldivide ( const value_t  l,
const value_t  r 
) const
inline

Compute w1 \ w2 = w1^{-1}w2.

Definition at line 263 of file letterset.hh.

References vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
static bool vcsn::letterset< GenSet >::less ( const value_t  l,
const value_t  r 
)
inlinestatic

Whether l < r.

Definition at line 139 of file letterset.hh.

template<typename GenSet>
static word_t vcsn::letterset< GenSet >::letters_of ( word_t  v)
inlinestatic

Prepare to iterate over the letters of v.

Definition at line 96 of file letterset.hh.

References vcsn::v.

template<typename GenSet>
static word_t vcsn::letterset< GenSet >::letters_of ( letter_t  v)
inlinestatic

Prepare to iterate over v.

Definition at line 111 of file letterset.hh.

References vcsn::letterset< GenSet >::word().

Here is the call graph for this function:

template<typename GenSet>
static word_t vcsn::letterset< GenSet >::letters_of_padded ( word_t  v,
letter_t   
)
inlinestatic

Prepare to iterate over the letters of v.

This is for the padded case

Definition at line 104 of file letterset.hh.

References vcsn::v.

template<typename GenSet>
static word_t vcsn::letterset< GenSet >::letters_of_padded ( letter_t  v,
letter_t   
)
inlinestatic

Prepare to iterate over v.

This is for the padded case

Definition at line 119 of file letterset.hh.

References vcsn::letterset< GenSet >::word().

Here is the call graph for this function:

template<typename GenSet>
value_t vcsn::letterset< GenSet >::lgcd ( const value_t  l,
const value_t  r 
) const
inline

The longest common prefix.

It would be better not to define it and to adjust tupleset::ldivide to be SNIFAE compliant, so that we get a compile time error instead of a runtime one when we try to using lgcd/ldivide on labelsets that don't support it. However, I feel it is not nice not to get tupleset::ldivide fail to compile without a clear explanation of why, and it is quite some work to write code that supports this possible missing ldivide/lgcd (see the case of conjunction in expansionset, case of non free labelsets).

Since I'm not convinced that letterset is the right abstraction (I, Akim, now tend to think that we should only support nullableset<letterset>), let's not fight this fight now.

Definition at line 256 of file letterset.hh.

References vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
static letterset vcsn::letterset< GenSet >::make ( std::istream &  is)
inlinestatic

Build from the description in is.

Definition at line 57 of file letterset.hh.

References vcsn::eat().

Here is the call graph for this function:

template<typename GenSet>
boost::optional<value_t> vcsn::letterset< GenSet >::maybe_ldivide ( const value_t  l,
const value_t  r 
) const
inline

Definition at line 270 of file letterset.hh.

References vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
boost::optional<value_t> vcsn::letterset< GenSet >::maybe_rdivide ( const value_t  l,
const value_t  r 
) const
inline

Definition at line 284 of file letterset.hh.

References vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
bool vcsn::letterset< GenSet >::open ( bool  o) const
inline

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept
Returns
the previous status.

Definition at line 71 of file letterset.hh.

References vcsn::detail::genset_labelset< GenSet >::genset().

Here is the call graph for this function:

template<typename GenSet>
std::ostream& vcsn::letterset< GenSet >::print ( const value_t l,
std::ostream &  o = std::cout,
format  fmt = {} 
) const
inline

Definition at line 302 of file letterset.hh.

template<typename GenSet>
std::ostream& vcsn::letterset< GenSet >::print_set ( std::ostream &  o,
format  fmt = {} 
) const
inline

Definition at line 309 of file letterset.hh.

template<typename GenSet>
value_t vcsn::letterset< GenSet >::rdivide ( const value_t  l,
const value_t  r 
) const
inline

Compute w1 / w2.

Definition at line 277 of file letterset.hh.

References vcsn::to_string().

Here is the call graph for this function:

template<typename GenSet>
static size_t vcsn::letterset< GenSet >::size ( value_t  )
inlinestatic

Definition at line 180 of file letterset.hh.

template<typename GenSet>
static symbol vcsn::letterset< GenSet >::sname ( )
inlinestatic

Definition at line 50 of file letterset.hh.

References vcsn::res, and vcsn::detail::genset_labelset< GenSet >::sname().

Here is the call graph for this function:

template<typename GenSet>
static value_t vcsn::letterset< GenSet >::special ( )
inlinestatic

Definition at line 126 of file letterset.hh.

Referenced by vcsn::letterset< GenSet >::is_special().

template<typename GenSet>
template<typename... Args>
value_t vcsn::letterset< GenSet >::value ( Args &&...  args) const
inline

Value constructor.

Definition at line 83 of file letterset.hh.

Referenced by vcsn::detail::nullable_helper< letterset< GenSet > >::value().

template<typename GenSet>
static word_t vcsn::letterset< GenSet >::word ( value_t  v)
inlinestatic

Convert to a word.

Definition at line 89 of file letterset.hh.

Referenced by vcsn::letterset< GenSet >::letters_of(), and vcsn::letterset< GenSet >::letters_of_padded().


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