Awali
Another Weighted Automata library
Data Structures | Typedefs | Functions | Variables
awali::internal Namespace Reference

Namespace containing implementation details of elements common to sttc and dyn layers (not stable). More...

Data Structures

struct  and_
 
struct  and_< F1 >
 
struct  and_< F1, F... >
 
struct  and_<>
 
struct  concat
 
struct  concat< index_sequence< I1... >, index_sequence< I2... > >
 
struct  concat_index_sequence
 
struct  concat_index_sequence< index_sequence< I1... >, index_sequence< I2... > >
 
struct  eval_if
 
struct  eval_if_c
 
struct  if_
 
struct  if_c
 
struct  if_c< false, T1, T2 >
 
struct  index_sequence
 
struct  int_range
 
struct  int_range< off, index_sequence< I... > >
 
struct  make_index_range
 
struct  make_index_range< S, -1U >
 
struct  make_index_range< S, 0 >
 
struct  make_index_sequence
 
struct  make_index_sequence< 0 >
 
struct  make_index_sequence< 1 >
 
struct  or_
 
struct  or_< F1 >
 
struct  or_< F1, F... >
 
struct  or_<>
 
struct  reverseseq
 
struct  reverseseq< index_sequence< I1 > >
 
struct  reverseseq< index_sequence< I1, I2... > >
 
struct  seqconcat
 
struct  seqconcat< index_sequence< I1... >, index_sequence< I2... > >
 
struct  std_all
 
struct  std_all< false, Tail... >
 
struct  std_all< true, Tail... >
 
struct  std_all<>
 
struct  tuple_printer
 
struct  tuple_printer< Tuple, 1 >
 

Typedefs

template<class S1 , class S2 >
using Concat = typename concat< S1, S2 >::type
 
template<typename S1 , typename S2 >
using concat_sequence = typename concat_index_sequence< S1, S2 >::type
 
template<std::size_t N>
using GenSeq = typename make_index_sequence< N >::type
 

Functions

static void check (std::istream &i, char e, std::string oth="")
 checks the next character More...
 
std::string demangle (const char *name)
 
int enum_of_string (const std::string &enum_name, const std::string &value)
 
template<typename Fun , typename... Ts>
void for_ (const std::tuple< Ts... > &ts, Fun f)
 
template<typename Fun , typename... Ts, size_t... I>
void for_ (Fun f, const std::tuple< Ts... > &ts, index_sequence< I... >)
 
static std::string get_first_attr (std::istream &i)
 
static std::vector< std::string > init_converter ()
 
template<typename T , typename P >
std::false_type is_iterable_aux1 (priority::BOTTOM< P >)
 
template<typename T , typename P >
auto is_iterable_aux1 (priority::TOP< P >) -> decltype(std::begin(std::declval< T & >()) !=std::end(std::declval< T & >()), void(),++std::declval< decltype(std::begin(std::declval< T & >()))& >(), void(*std::begin(std::declval< T & >())), std::true_type{})
 
template<typename T , typename X , typename P >
std::false_type is_iterable_aux2 (priority::BOTTOM< P >)
 
template<typename T , typename X , typename P >
auto is_iterable_aux2 (priority::TOP< P >) -> typename std::enable_if< std_all< is_iterable< T >::value, std::is_convertible< decltype(*std::begin(std::declval< T & >())), X >::value >::value, std::true_type >::type
 
static std::ostream & js_formate (std::ostream &o, std::istream &i)
 formates a json file More...
 
template<typename T = direction_t>
auto make_enum (std::string const &str) -> typename std::enable_if< std::is_same< T, direction_t >::value, T >::type
 
auto make_inv_tuple () -> std::tuple<>
 
template<typename T , typename... Ts>
auto make_inv_tuple (T t, Ts &&... ts) -> decltype(std::tuple_cat(make_inv_tuple(std::forward< Ts >(ts)...), std::make_tuple(t)))
 
template<typename... Ts>
auto make_inv_tuple (Ts &&... ts) -> decltype(reverse_tuple(std::make_tuple(std::forward< Ts >(ts)...)))
 
template<typename Fun , typename... Ts>
auto map (const std::tuple< Ts... > &ts, Fun f) -> decltype(map_tuple_(f, ts, make_index_sequence< sizeof...(Ts)>()))
 Map a function on a tuple, return tuple of the results. More...
 
template<typename Fun , typename... Ts, size_t... I>
auto map_tuple_ (Fun f, const std::tuple< Ts... > &ts, index_sequence< I... >) -> decltype(map_variadic_(f, std::get< I >(ts)...))
 
template<typename Fun , typename T , typename... Ts>
auto map_variadic_ (Fun f, T t, Ts &&... ts) -> decltype(std::tuple_cat(std::make_tuple(f(t)), map_variadic_(f, ts...)))
 
template<typename Fun >
auto map_variadic_ (Fun) -> decltype(std::make_tuple())
 
json_ast_t metadata_ast (std::istream &i)
 
static char parsecst (std::istream &i)
 
static void parseignore (std::istream &i)
 
static int parseint (std::istream &i)
 
static std::string parsestring (std::istream &i)
 
static char peek (std::istream &i)
 peeks the next character More...
 
template<typename... Args>
std::ostream & print (const std::tuple< Args... > &args, std::ostream &o)
 
template<typename... Ts>
auto reverse_tuple (const std::tuple< Ts... > &t) -> decltype(reverse_tuple(t, make_index_sequence< sizeof...(Ts)>()))
 
template<typename... Ts, std::size_t... I>
auto reverse_tuple (const std::tuple< Ts... > &t, index_sequence< I... >) -> decltype(std::make_tuple(std::get< sizeof...(Ts) - 1 - I >(t)...))
 
static std::ostream & tabs (std::ostream &o, int n)
 prints spaces More...
 
template<typename M >
M::genset_t::letter_t to_letter_of (M const &set, const std::string &str)
 
template<typename M >
M::value_t to_value_of (M const &set, const std::string &str)
 
template<typename M >
M::genset_t::word_t to_word_of (M const &set, const std::string &str)
 

Variables

static std::vector< std::string > const converter = init_converter()
 

Detailed Description

Namespace containing implementation details of elements common to sttc and dyn layers (not stable).


Data Structure Documentation

◆ awali::internal::and_

struct awali::internal::and_

template<class... F>
struct awali::internal::and_< F >

◆ awali::internal::concat

struct awali::internal::concat

template<class S1, class S2>
struct awali::internal::concat< S1, S2 >

◆ awali::internal::concat_index_sequence

struct awali::internal::concat_index_sequence

template<typename S1, typename S2>
struct awali::internal::concat_index_sequence< S1, S2 >

◆ awali::internal::if_c

struct awali::internal::if_c

template<bool c, class T1, class T2>
struct awali::internal::if_c< c, T1, T2 >

Data Fields
typedef T1 type

◆ awali::internal::if_c< false, T1, T2 >

struct awali::internal::if_c< false, T1, T2 >

template<class T1, class T2>
struct awali::internal::if_c< false, T1, T2 >

Data Fields
typedef T2 type

◆ awali::internal::index_sequence

struct awali::internal::index_sequence

template<std::size_t...>
struct awali::internal::index_sequence<... >

Data Fields
typedef index_sequence type

◆ awali::internal::int_range

struct awali::internal::int_range

template<std::size_t off, class S2>
struct awali::internal::int_range< off, S2 >

◆ awali::internal::or_

struct awali::internal::or_

template<class... F>
struct awali::internal::or_< F >

◆ awali::internal::reverseseq

struct awali::internal::reverseseq

template<typename S>
struct awali::internal::reverseseq< S >

◆ awali::internal::reverseseq< index_sequence< I1 > >

struct awali::internal::reverseseq< index_sequence< I1 > >

template<size_t I1>
struct awali::internal::reverseseq< index_sequence< I1 > >

Data Fields
typedef index_sequence< I1 > type

◆ awali::internal::reverseseq< index_sequence< I1, I2... > >

struct awali::internal::reverseseq< index_sequence< I1, I2... > >

template<size_t I1, size_t... I2>
struct awali::internal::reverseseq< index_sequence< I1, I2... > >

Data Fields
type

◆ awali::internal::seqconcat

struct awali::internal::seqconcat

template<class S1, class S2>
struct awali::internal::seqconcat< S1, S2 >

◆ awali::internal::std_all

struct awali::internal::std_all

template<bool... T>
struct awali::internal::std_all< T >

Typedef Documentation

◆ Concat

template<class S1 , class S2 >
using awali::internal::Concat = typedef typename concat<S1, S2>::type

◆ concat_sequence

template<typename S1 , typename S2 >
using awali::internal::concat_sequence = typedef typename concat_index_sequence<S1, S2>::type

◆ GenSeq

template<std::size_t N>
using awali::internal::GenSeq = typedef typename make_index_sequence<N>::type

Function Documentation

◆ check()

static void awali::internal::check ( std::istream &  i,
char  e,
std::string  oth = "" 
)
static

checks the next character

Parameters
ithe input stream
ethe expected character
othother expected characters (previously tested with peek) return true if the next non blank character in i is e

◆ demangle()

std::string awali::internal::demangle ( const char *  name)

◆ enum_of_string()

int awali::internal::enum_of_string ( const std::string &  enum_name,
const std::string &  value 
)

◆ for_() [1/2]

template<typename Fun , typename... Ts>
void awali::internal::for_ ( const std::tuple< Ts... > &  ts,
Fun  f 
)

◆ for_() [2/2]

template<typename Fun , typename... Ts, size_t... I>
void awali::internal::for_ ( Fun  f,
const std::tuple< Ts... > &  ts,
index_sequence< I... >   
)

◆ get_first_attr()

static std::string awali::internal::get_first_attr ( std::istream &  i)
static

◆ init_converter()

static std::vector<std::string> awali::internal::init_converter ( )
static

◆ is_iterable_aux1() [1/2]

template<typename T , typename P >
std::false_type awali::internal::is_iterable_aux1 ( priority::BOTTOM< P >  )

◆ is_iterable_aux1() [2/2]

template<typename T , typename P >
auto awali::internal::is_iterable_aux1 ( priority::TOP< P >  ) -> decltype(std::begin(std::declval< T & >()) !=std::end(std::declval< T & >()), void(),++std::declval< decltype(std::begin(std::declval< T & >()))& >(), void(*std::begin(std::declval< T & >())), std::true_type{})

◆ is_iterable_aux2() [1/2]

template<typename T , typename X , typename P >
std::false_type awali::internal::is_iterable_aux2 ( priority::BOTTOM< P >  )

◆ is_iterable_aux2() [2/2]

template<typename T , typename X , typename P >
auto awali::internal::is_iterable_aux2 ( priority::TOP< P >  ) -> typename std::enable_if< std_all< is_iterable< T >::value, std::is_convertible< decltype(*std::begin(std::declval< T & >())), X >::value >::value, std::true_type >::type

◆ js_formate()

static std::ostream& awali::internal::js_formate ( std::ostream &  o,
std::istream &  i 
)
static

formates a json file

This function insert indentations and line breaks in order to pretty print a json file.

The rules are the following:

  • the existing line breaks are preserved, without changing the indentation;
  • there is always a line break before a left curly brace, the indentation is then incremented;
  • if an object contains inner objects, the right curly brace is written on a new line with the same indentation as the left curly brace. In any case, the indentation is decremented;
Parameters
othe output stream
ithe input stream sending a syntacticly correct json file

◆ make_enum()

template<typename T = direction_t>
auto awali::internal::make_enum ( std::string const &  str) -> typename std::enable_if<std::is_same<T, direction_t >::value,T>::type

◆ make_inv_tuple() [1/3]

auto awali::internal::make_inv_tuple ( ) -> std::tuple<>

◆ make_inv_tuple() [2/3]

template<typename T , typename... Ts>
auto awali::internal::make_inv_tuple ( t,
Ts &&...  ts 
) -> decltype(std::tuple_cat(make_inv_tuple(std::forward<Ts>(ts)...), std::make_tuple(t)))

◆ make_inv_tuple() [3/3]

template<typename... Ts>
auto awali::internal::make_inv_tuple ( Ts &&...  ts) -> decltype(reverse_tuple(std::make_tuple(std::forward<Ts>(ts)...)))

◆ map()

template<typename Fun , typename... Ts>
auto awali::internal::map ( const std::tuple< Ts... > &  ts,
Fun  f 
) -> decltype(map_tuple_(f, ts, make_index_sequence<sizeof...(Ts)>()))

Map a function on a tuple, return tuple of the results.

◆ map_tuple_()

template<typename Fun , typename... Ts, size_t... I>
auto awali::internal::map_tuple_ ( Fun  f,
const std::tuple< Ts... > &  ts,
index_sequence< I... >   
) -> decltype(map_variadic_(f, std::get<I>(ts)...))

◆ map_variadic_() [1/2]

template<typename Fun , typename T , typename... Ts>
auto awali::internal::map_variadic_ ( Fun  f,
t,
Ts &&...  ts 
) -> decltype(std::tuple_cat(std::make_tuple(f(t)), map_variadic_(f, ts...)))

◆ map_variadic_() [2/2]

template<typename Fun >
auto awali::internal::map_variadic_ ( Fun  ) -> decltype(std::make_tuple())

◆ metadata_ast()

json_ast_t awali::internal::metadata_ast ( std::istream &  i)

◆ parsecst()

static char awali::internal::parsecst ( std::istream &  i)
static

◆ parseignore()

static void awali::internal::parseignore ( std::istream &  i)
static

◆ parseint()

static int awali::internal::parseint ( std::istream &  i)
static

◆ parsestring()

static std::string awali::internal::parsestring ( std::istream &  i)
static

◆ peek()

static char awali::internal::peek ( std::istream &  i)
static

peeks the next character

Parameters
ithe input stream return the value of the next non blank character in i

◆ print()

template<typename... Args>
std::ostream& awali::internal::print ( const std::tuple< Args... > &  args,
std::ostream &  o 
)

◆ reverse_tuple() [1/2]

template<typename... Ts>
auto awali::internal::reverse_tuple ( const std::tuple< Ts... > &  t) -> decltype(reverse_tuple(t, make_index_sequence<sizeof...(Ts)>()))

◆ reverse_tuple() [2/2]

template<typename... Ts, std::size_t... I>
auto awali::internal::reverse_tuple ( const std::tuple< Ts... > &  t,
index_sequence< I... >   
) -> decltype(std::make_tuple(std::get<sizeof...(Ts) - 1 - I>(t)...))

◆ tabs()

static std::ostream& awali::internal::tabs ( std::ostream &  o,
int  n 
)
static

prints spaces

prints n spaces in the stream o.

Parameters
ooutput stream
nnumber of spaces return the output stream

◆ to_letter_of()

template<typename M >
M::genset_t::letter_t awali::internal::to_letter_of ( M const &  set,
const std::string &  str 
)

◆ to_value_of()

template<typename M >
M::value_t awali::internal::to_value_of ( M const &  set,
const std::string &  str 
)

◆ to_word_of()

template<typename M >
M::genset_t::word_t awali::internal::to_word_of ( M const &  set,
const std::string &  str 
)

Variable Documentation

◆ converter

std::vector<std::string> const awali::internal::converter = init_converter()
static