Vcsn  2.5.dev
Be Rational
vcsn::nullableset< LabelSet > Class Template Reference

Implementation of labels are nullables (letter or empty). More...

#include <fwd.hh>

Collaboration diagram for vcsn::nullableset< LabelSet >:

Public Types

using labelset_t = LabelSet
 
using labelset_ptr = std::shared_ptr< const labelset_t >
 
using self_t = nullableset
 
using helper_t = detail::nullable_helper< labelset_t >
 
using kind_t = labels_are_nullable
 
using value_t = typename helper_t::value_t
 
using letter_t = typename labelset_t::letter_t
 
using word_t = typename labelset_t::word_t
 
using genset_ptr = decltype(ls_->genset())
 
using genset_t = decltype(ls_->generators())
 

Public Member Functions

 nullableset (const labelset_ptr &ls)
 
 nullableset (const labelset_t &ls={})
 
 ~nullableset ()
 
bool open (bool o) const
 Whether unknown letters should be added, or rejected. More...
 
bool is_valid (value_t v) const
 
genset_ptr genset () const
 
decltype(auto) generators () const
 The generators. More...
 
decltype(auto) pregenerators () const
 The pregenerators. More...
 
value_t conv (self_t, value_t v) const
 
value_t conv (oneset, typename oneset::value_t) const
 
template<typename LabelSet_ >
value_t conv (const LabelSet_ &ls, typename LabelSet_::value_t v) const
 Conversion from another type: first by the wrapped labelset, and then by our wrappers (in case the wrapped labelset does not support "one"). More...
 
const labelset_ptr labelset () const
 
template<typename... Args>
value_t value (Args &&... args) const
 
word_t word (const value_t &l) const
 
auto letters_of_padded (const word_t &v, letter_t l) const -> decltype(ls_->letters_of_padded(v, l))
 Prepare to iterate over the letters of v. More...
 
auto letters_of_padded (value_t v, letter_t l) const -> decltype(this->letters_of_padded(this->word(v), l))
 
value_t mul (const value_t &l, const value_t &r) const
 The concatenation. 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 l \ r = l^{-1}r. 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 l / r. More...
 
boost::optional< value_tmaybe_rdivide (const value_t &l, const value_t &r) const
 
letter_t get_letter (std::istream &i, bool quoted=true) const
 
value_t conv (std::istream &i, bool quoted=true) const
 Read a label from a stream. More...
 
template<typename Fun >
void convs (std::istream &i, Fun &&fun) const
 Process a label class. More...
 
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
 Print label to stream. More...
 
bool is_letter (const value_t &v) const
 
template<typename Value >
Value transpose (const Value &l) const
 Mirror label. More...
 
std::ostream & print_set (std::ostream &o, format fmt={}) const
 Print labelset description. More...
 

Static Public Member Functions

static symbol sname ()
 
static nullableset make (std::istream &is)
 Build from the description in is. More...
 
static constexpr bool has_one ()
 
static constexpr bool is_expressionset ()
 
static constexpr bool is_letterized ()
 
static constexpr bool is_free ()
 
static ATTRIBUTE_PURE constexpr value_t one ()
 
static ATTRIBUTE_PURE bool is_one (value_t l)
 
static auto letters_of (const word_t &v) -> decltype(labelset_t::letters_of(v))
 Prepare to iterate over the letters of v. More...
 
static int compare (const value_t &l, const value_t &r)
 Three way comparison between l and r. More...
 
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 value_t special ()
 
static bool is_special (const value_t &v)
 
static size_t size (const value_t &v)
 
static size_t hash (const value_t &v)
 
static labelset_t::value_t get_value (const value_t &v)
 The (inner) value when it (the outer value) is not one. More...
 

Private Attributes

labelset_ptr ls_
 The wrapped LabelSet. More...
 

Detailed Description

template<typename LabelSet>
class vcsn::nullableset< LabelSet >

Implementation of labels are nullables (letter or empty).

Definition at line 14 of file fwd.hh.

Member Typedef Documentation

◆ genset_ptr

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::genset_ptr = decltype(ls_->genset())

Definition at line 197 of file nullableset.hh.

◆ genset_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::genset_t = decltype(ls_->generators())

Definition at line 198 of file nullableset.hh.

◆ helper_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::helper_t = detail::nullable_helper<labelset_t>

Definition at line 184 of file nullableset.hh.

◆ kind_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::kind_t = labels_are_nullable

Definition at line 185 of file nullableset.hh.

◆ labelset_ptr

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::labelset_ptr = std::shared_ptr<const labelset_t>

Definition at line 182 of file nullableset.hh.

◆ labelset_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::labelset_t = LabelSet

Definition at line 181 of file nullableset.hh.

◆ letter_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::letter_t = typename labelset_t::letter_t

Definition at line 188 of file nullableset.hh.

◆ self_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::self_t = nullableset

Definition at line 183 of file nullableset.hh.

◆ value_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::value_t = typename helper_t::value_t

Definition at line 187 of file nullableset.hh.

◆ word_t

template<typename LabelSet>
using vcsn::nullableset< LabelSet >::word_t = typename labelset_t::word_t

Definition at line 189 of file nullableset.hh.

Constructor & Destructor Documentation

◆ nullableset() [1/2]

template<typename LabelSet>
vcsn::nullableset< LabelSet >::nullableset ( const labelset_ptr ls)
inline

Definition at line 201 of file nullableset.hh.

◆ nullableset() [2/2]

template<typename LabelSet>
vcsn::nullableset< LabelSet >::nullableset ( const labelset_t ls = {})
inline

Definition at line 205 of file nullableset.hh.

◆ ~nullableset()

template<typename LabelSet>
vcsn::nullableset< LabelSet >::~nullableset ( )
inline

Definition at line 209 of file nullableset.hh.

Member Function Documentation

◆ compare()

template<typename LabelSet>
static int vcsn::nullableset< LabelSet >::compare ( const value_t l,
const value_t r 
)
inlinestatic

Three way comparison between l and r.

Definition at line 369 of file nullableset.hh.

References vcsn::compare(), vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::res.

Here is the call graph for this function:

◆ conjunction()

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::conjunction ( const value_t l,
const value_t r 
) const
inline

Definition at line 539 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::to_string().

Here is the call graph for this function:

◆ conv() [1/4]

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::conv ( self_t  ,
value_t  v 
) const
inline

Definition at line 302 of file nullableset.hh.

References vcsn::detail::v.

◆ conv() [2/4]

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::conv ( oneset  ,
typename oneset::value_t   
) const
inline

Definition at line 308 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::one().

Here is the call graph for this function:

◆ conv() [3/4]

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

Conversion from another type: first by the wrapped labelset, and then by our wrappers (in case the wrapped labelset does not support "one").

Definition at line 318 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ conv() [4/4]

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

Read a label from a stream.

Definition at line 502 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ convs()

template<typename LabelSet>
template<typename Fun >
void vcsn::nullableset< LabelSet >::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 530 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ equal()

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

Whether l == r.

Definition at line 378 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), and vcsn::detail::nullable_helper< LabelSet >::is_one().

Here is the call graph for this function:

◆ generators()

template<typename LabelSet>
decltype(auto) vcsn::nullableset< LabelSet >::generators ( ) const
inline

The generators.

Definition at line 289 of file nullableset.hh.

◆ genset()

template<typename LabelSet>
genset_ptr vcsn::nullableset< LabelSet >::genset ( ) const
inline

Definition at line 282 of file nullableset.hh.

◆ get_letter()

template<typename LabelSet>
letter_t vcsn::nullableset< LabelSet >::get_letter ( std::istream &  i,
bool  quoted = true 
) const
inline

Definition at line 495 of file nullableset.hh.

◆ get_value()

template<typename LabelSet>
static labelset_t::value_t vcsn::nullableset< LabelSet >::get_value ( const value_t v)
inlinestatic

The (inner) value when it (the outer value) is not one.

Definition at line 613 of file nullableset.hh.

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

◆ has_one()

template<typename LabelSet>
static constexpr bool vcsn::nullableset< LabelSet >::has_one ( )
inlinestatic

Definition at line 239 of file nullableset.hh.

◆ hash()

template<typename LabelSet>
static size_t vcsn::nullableset< LabelSet >::hash ( const value_t v)
inlinestatic

Definition at line 488 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), and vcsn::detail::nullable_helper< LabelSet >::is_one().

Here is the call graph for this function:

◆ is_expressionset()

template<typename LabelSet>
static constexpr bool vcsn::nullableset< LabelSet >::is_expressionset ( )
inlinestatic

Definition at line 245 of file nullableset.hh.

◆ is_free()

template<typename LabelSet>
static constexpr bool vcsn::nullableset< LabelSet >::is_free ( )
inlinestatic

Definition at line 256 of file nullableset.hh.

◆ is_letter()

template<typename LabelSet>
bool vcsn::nullableset< LabelSet >::is_letter ( const value_t v) const
inline

Definition at line 566 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), and vcsn::detail::nullable_helper< LabelSet >::is_one().

Here is the call graph for this function:

◆ is_letterized()

template<typename LabelSet>
static constexpr bool vcsn::nullableset< LabelSet >::is_letterized ( )
inlinestatic

Definition at line 251 of file nullableset.hh.

References vcsn::detail::is_letterized().

Here is the call graph for this function:

◆ is_one()

template<typename LabelSet>
static ATTRIBUTE_PURE bool vcsn::nullableset< LabelSet >::is_one ( value_t  l)
inlinestatic

◆ is_special()

template<typename LabelSet>
static bool vcsn::nullableset< LabelSet >::is_special ( const value_t v)
inlinestatic

Definition at line 477 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::detail::is_special().

Here is the call graph for this function:

◆ is_valid()

template<typename LabelSet>
bool vcsn::nullableset< LabelSet >::is_valid ( value_t  v) const
inline

Definition at line 276 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), and vcsn::detail::nullable_helper< LabelSet >::is_one().

Here is the call graph for this function:

◆ labelset()

template<typename LabelSet>
const labelset_ptr vcsn::nullableset< LabelSet >::labelset ( ) const
inline

◆ ldivide()

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::ldivide ( const value_t l,
const value_t r 
) const
inline

Compute l \ r = l^{-1}r.

Definition at line 421 of file nullableset.hh.

References vcsn::res, and vcsn::to_string().

Here is the call graph for this function:

◆ less()

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

Whether l < r.

Definition at line 387 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), and vcsn::detail::nullable_helper< LabelSet >::is_one().

Here is the call graph for this function:

◆ letters_of()

template<typename LabelSet>
static auto vcsn::nullableset< LabelSet >::letters_of ( const word_t v) -> decltype(labelset_t::letters_of(v))
inlinestatic

Prepare to iterate over the letters of v.

Definition at line 346 of file nullableset.hh.

References vcsn::detail::v.

◆ letters_of_padded() [1/2]

template<typename LabelSet>
auto vcsn::nullableset< LabelSet >::letters_of_padded ( const word_t v,
letter_t  l 
) const -> decltype(ls_->letters_of_padded(v, l))
inline

Prepare to iterate over the letters of v.

This is for the padded case

Definition at line 355 of file nullableset.hh.

References vcsn::detail::v.

◆ letters_of_padded() [2/2]

template<typename LabelSet>
auto vcsn::nullableset< LabelSet >::letters_of_padded ( value_t  v,
letter_t  l 
) const -> decltype(this->letters_of_padded(this->word(v), l))
inline

Definition at line 362 of file nullableset.hh.

References vcsn::detail::v.

◆ lgcd()

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::lgcd ( const value_t l,
const value_t r 
) const
inline

The longest common prefix.

Definition at line 410 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), vcsn::detail::nullable_helper< LabelSet >::one(), and vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ make()

template<typename LabelSet>
static nullableset vcsn::nullableset< LabelSet >::make ( std::istream &  is)
inlinestatic

Build from the description in is.

Definition at line 219 of file nullableset.hh.

References vcsn::eat().

Here is the call graph for this function:

◆ maybe_ldivide()

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

Definition at line 431 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), vcsn::detail::nullable_helper< LabelSet >::one(), vcsn::res, and vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ maybe_rdivide()

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

Definition at line 456 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), vcsn::detail::nullable_helper< LabelSet >::one(), vcsn::res, and vcsn::detail::nullable_helper< LabelSet >::value().

Here is the call graph for this function:

◆ mul()

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::mul ( const value_t l,
const value_t r 
) const
inline

The concatenation.

Definition at line 398 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::to_string().

Here is the call graph for this function:

◆ one()

template<typename LabelSet>
static ATTRIBUTE_PURE constexpr value_t vcsn::nullableset< LabelSet >::one ( )
inlinestatic

Definition at line 263 of file nullableset.hh.

◆ open()

template<typename LabelSet>
bool vcsn::nullableset< LabelSet >::open ( bool  o) const
inline

Whether unknown letters should be added, or rejected.

Parameters
owhether to accept unknown letters
Returns
the previous status.

Definition at line 233 of file nullableset.hh.

◆ pregenerators()

template<typename LabelSet>
decltype(auto) vcsn::nullableset< LabelSet >::pregenerators ( ) const
inline

The pregenerators.

Definition at line 296 of file nullableset.hh.

◆ print()

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

Print label to stream.

Definition at line 553 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), vcsn::format::latex, and vcsn::format::utf8.

Here is the call graph for this function:

◆ print_set()

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

Print labelset description.

Definition at line 581 of file nullableset.hh.

References vcsn::format::latex, and vcsn::format::sname.

◆ rdivide()

template<typename LabelSet>
value_t vcsn::nullableset< LabelSet >::rdivide ( const value_t l,
const value_t r 
) const
inline

Compute l / r.

Definition at line 446 of file nullableset.hh.

References vcsn::res, and vcsn::to_string().

Here is the call graph for this function:

◆ size()

template<typename LabelSet>
static size_t vcsn::nullableset< LabelSet >::size ( const value_t v)
inlinestatic

Definition at line 482 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::rat::size().

Here is the call graph for this function:

◆ sname()

template<typename LabelSet>
static symbol vcsn::nullableset< LabelSet >::sname ( )
inlinestatic

Definition at line 212 of file nullableset.hh.

References vcsn::res, and vcsn::sname().

Here is the call graph for this function:

◆ special()

template<typename LabelSet>
static value_t vcsn::nullableset< LabelSet >::special ( )
inlinestatic

Definition at line 471 of file nullableset.hh.

◆ transpose()

template<typename LabelSet>
template<typename Value >
Value vcsn::nullableset< LabelSet >::transpose ( const Value &  l) const
inline

Mirror label.

Definition at line 574 of file nullableset.hh.

References vcsn::transpose().

Here is the call graph for this function:

◆ value()

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

Definition at line 330 of file nullableset.hh.

◆ word()

template<typename LabelSet>
word_t vcsn::nullableset< LabelSet >::word ( const value_t l) const
inline

Definition at line 336 of file nullableset.hh.

References vcsn::detail::nullable_helper< LabelSet >::get_value(), vcsn::detail::nullable_helper< LabelSet >::is_one(), and vcsn::detail::make_wordset().

Here is the call graph for this function:

Member Data Documentation

◆ ls_

template<typename LabelSet>
labelset_ptr vcsn::nullableset< LabelSet >::ls_
private

The wrapped LabelSet.

Declared early to please decltype.

Definition at line 194 of file nullableset.hh.


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