# Miscellaneous constructs used by Vaucanson

Collaboration diagram for Miscellaneous constructs used by Vaucanson:

## Classes

class | SparseIterator< vcsn::handler< T, unsigned >, ExcludedContainer >
| SparseIterator is an iterator over range except some points. More...
class | SparseInterval< vcsn::handler< T, unsigned >, ExcludedContainer >
| Container over a sparse integer range. More...
struct | generic_int_type< CharT >
| Generic and under-efficient int_type implementation for char_traits. More...
struct | char_traits< CharT >
| Generic char_traits. More...
struct | DeferrerDebugPart< T, B >
| Helper class for Deferrer. More...
struct | Deferrer< T, rt_checks >
| This class defers the creation of its template parameter. More...
class | SelfIterator< C, T >
| SelfIterator is an iterator which is also a container. More...
class | SparseIterator< Integer, ExcludedContainer >
| SparseIterator is an iterator over range except some points. More...
class | SparseInterval< Integer, ExcludedContainer >
| Container over a sparse integer range. More...
struct | remove_reference< T >
| Turn a reference type into its corresponding plain type. More...
struct | remove_const< T >
| Turn a const type into its corresponding mutable type. More...
struct | static_if< b, T, U >
| Choose between two types or values depending on a constant Boolean. More...
struct | true_t
| Static Booleans, for type matching use of Booleans. More...
struct | static_if_simple< b, T, U >
| Choose between two types or values depending on a constant Boolean. More...
struct | static_eq< T, U >
| Test for equality between two types. More...
struct | static_pow_compute< N, P, pair_p >
| These are auxilliary functions for static_pow. More...
struct | static_pow< N, P >
| Static exponentiation. More...
struct | static_pow_minus_one< N, P >
| Static exponentiation, result minus one. More...
class | SupportIterator< C >
| Iterator over the Support generic class. More...
class | Support< std::map< U, T > >
| Support<map<U, T> > is a const adapter of std::map to container. More...
class | Support< std::set< U > >
| Support<set<U, T> > is a const adapter of std::map to container. More...
struct | Window< InputIterator, Letter >
| Handle windows in streams for performing regular expression search. More...

## Namespaces

namespace | vcsn

| The main namespace of the Vaucanson library.

## Modules

| Contract checking for Vaucanson

| In Vaucanson, several types of contracts can be placed in the library code.

## Files

file | char_traits.hh

| Generic char_traits declarations.
file | deferrer.hh

| Declarations for the Deferrer class.
file | deferrer.hxx

| Definitions for the Deferrer class.
file | window.hh

| Window class for regular expression search on streams.

## Defines

#define | DECLARE_PAIR_SPECIALIZATION(TYPE1, TYPE2)
| Generate a random std::pair<S, T>.
#define | SELECT(T) (* (const T*)0)
| Type argument for types with no commas (simple or 1-par templates).
#define | SELECT2(T1, T2) (* (const T1 , T2 *)0)
| Type argument for types with one comma (2-parameters templates).
#define | SELECT3(T1, T2, T3) (* (const T1 , T2, T3 *)0)
| Type argument for types with two commas (3-parameters templates).
#define | SELECT4(T1, T2, T3, T4) (* (const T1 , T2, T3, T4 *)0)
| Type argument for types with three commas (4-parameters templates).
#define | SELECTOR(T) const T &
| Type formal argument for types with no commas (simple or 1-par templates).
#define | SELECTOR2(T1, T2) const T1 , T2 &
| Type formal argument for types with one comma (2-parameters templates).
#define | SELECTOR3(T1, T2, T3) const T1 , T2, T3 &
| Type formal argument for types with two commas (3-parameters templates).
#define | SELECTOR4(T1, T2, T3, T4) const T1 , T2, T3, T4 &
| Type formal argument for types with three commas (4-parameters templates).

## Enumerations

enum |

## Functions

template<typename T >
T | generate ()
| Generate a random value.
template<typename T >
T | generate (T min, T max)
| Generate a random value between bounds.
template<>
char | generate< char > ()
| Generate a random character.
template<>
char | generate< char > (char min, char max)
| Generate a random character between bounds.
char | generate_letter ()
| Generate a random lowercase letter.
char | generate_digit ()
| Generate a random digit.
template<>
bool | generate< bool > ()
| Generate a random Boolean.
template<>
int | generate< int > ()
| Generate a random integer.
template<>
int | generate< int > (int min, int max)
| Generate a random integer between two bounds.
template<>
unsigned | generate< unsigned > ()
| Generate a random unsigned integer.
template<>
unsigned | generate< unsigned > (unsigned min, unsigned max)
| Generate a random unsigned between two bounds.
template<>
float | generate< float > ()
| Generate a random float between -2 and 2.
template<>
float | generate< float > (float min, float max)
| Generate a random float between min and max.
template<>
double | generate< double > ()
| Generate a random double between -2 and 2.
template<>
double | generate< double > (double min, double max)
| Generate a random double between min and max.
template<class IteratorValueType , class InputIterator , class OutputIterator >
void | sample_n (const IteratorValueType &, InputIterator first, InputIterator end, OutputIterator out, unsigned n)
| Generate of n sample from a range to an output iterator.
template<>
vcsn::algebra::RationalNumber | generate< vcsn::algebra::RationalNumber > ()
| Generate a random rational number.
template<>
vcsn::algebra::RationalNumber | generate< vcsn::algebra::RationalNumber > (const vcsn::algebra::RationalNumber min, const vcsn::algebra::RationalNumber max)
| Generates a bounded random rational number.
template<typename T >
const T & | get (const T &)
| The canonicalization operator.
template<typename T >
const T * | get (const T *)
| Version of the canonicalization operator for pointers.
| DeferrerDebugPart (void *ptr, bool is_valid=false)
| Deferrer ()
| Constructor.
Deferrer & | operator= (const deferred_type &)
| Effectively builds the holded type.
| operator T () const
| Get back the holded type.
| Window (const iterator_t &stream, const iterator_t &eof, letter_t eol, length_t length)
| Standard constructor for the Window class.
bool | eof () const
| Indicates wether the end of the stream has been reached or not.
bool | eol () const
| Indicates wether a new line has been reached or not.
void | shift (unsigned int n)
| Shift the window.
void | shift ()
| Shift the window completely (equivalent to shift (size ())).
length_t | size () const
| Returns the actual window size.
letter_t | operator[] (length_t i) const
| Returns the i-th character of the window.
std::ostream & | print (std::ostream &ostr) const
| Print the window.

## Small alphabetic letters random generation tools.

typedef vcsn::algebra::static_char_interval <'a', 'z'> | small_alpha_interval_t
typedef vcsn::algebra::static_ranged < char, small_alpha_interval_t > | small_alpha_letter_t
template<>
small_alpha_letter_t | generate< small_alpha_letter_t > ()
| Generates a random small alphabetic letter.
void | moveto (length_t offset)
| Move to a specific offset.
void | moveto (iterator_t position)
| Move to a specific offset.

## Accessors

letter_t | eol_value () const
| Get the letter value used for ending lines.
iterator_t | begin () const
| Get an iterator to the beginning of the stream.
iterator_t | stream () const
| Get an iterator to the current position in the stream.
iterator_t | end () const
| Get an iterator to the end of the stream.
size_t | offset () const
| Get the actual offset in the stream.
length_t | length () const
| Get the maximum length of the window.
string_t | window () const
| Get the window as a `basic_string<letter_t>`.

## Typedef Documentation

typedef vcsn::algebra::static_char_interval<'a', 'z'> small_alpha_interval_t

Definition at line 137 of file random.hh.

typedef vcsn::algebra::static_ranged<char, small_alpha_interval_t> small_alpha_letter_t

Definition at line 141 of file random.hh.

## Enumeration Type Documentation

anonymous enum

Definition at line 39 of file deferrer.hh.

## Function Documentation

T vcsn::misc::random::generate | ( | T | min,
|  | T | max |
| ) |  |  |

Generate a random value between bounds.

This function returns a value between `min` and `max` (inclusive).

vcsn::algebra::RationalNumber generate< vcsn::algebra::RationalNumber > | ( | const vcsn::algebra::RationalNumber | min,
|  | const vcsn::algebra::RationalNumber | max |
| ) |  |  | `[inline]`

Generates a bounded random rational number.

Both fractions are first brought to the same denominator. Then, the maximum of the denominator and both numerators is taken. With this number, we work out a ratio, which is used to have a larger range of choice for our new fraction.

const T & get | ( | const T & | v | ) |

The canonicalization operator.

This operator uses the `unique_map` structure to retrieve the unique instance equal to the given value.

See also:
  `unique_map`

Definition at line 75 of file unique.hxx.

References UniqueMap< T >::instance().

Referenced by SetSlotAttribute< S, true >::_structure_attach().

DeferrerDebugPart | ( | void * | ptr,
|  | bool | is_valid = `false` |
| ) |  |  | `[protected, inherited]`

Definition at line 50 of file deferrer.hxx.

Deferrer | ( |  | ) | `[inherited]`

Constructor.

Please notice that this constructor *do not initialize* the holded type.

See also:
  operator=

Definition at line 115 of file deferrer.hxx.

Deferrer< T, rt_checks > & operator= | ( | const deferred_type & | rhs | ) | `[inherited]`

Effectively builds the holded type.

Warning:
  Calling this operator twice does not call any destructor nor overloaded operators = on the first instance which was created.

Definition at line 121 of file deferrer.hxx.

References Deferrer< T, rt_checks >::data.

Window | ( | const iterator_t & | stream,
|  | const iterator_t & | eof,
|  | letter_t | eol,
|  | length_t | length |
| ) |  |  | `[inherited]`

Standard constructor for the Window class.

Build a window from a couple of begin/end iterator, a newline character and a window length.

Parameters:

  | stream | Iterator to the begining of the stream.
  | eof | Iterator to the end of the stream.
  | eol | The newline character.
  | length | The window length.

See also:
  Window

Definition at line 37 of file window.hxx.

void shift | ( | unsigned int | n | ) | `[inherited]`

Shift the window.

Parameters:

  | n | The number of character the window must be shifted.

Definition at line 68 of file window.hxx.