Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vcsn::detail::dot::variant< S > Struct Template Reference

A char[S] buffer to store and retrieve objects. More...

#include <parse.hh>

Inheritance diagram for vcsn::detail::dot::variant< S >:
Collaboration diagram for vcsn::detail::dot::variant< S >:

Public Types

typedef variant< S > self_type
 Type of *this. More...
 

Public Member Functions

 variant ()
 Empty construction. More...
 
template<typename T >
 variant (const T &t)
 Construct and fill. More...
 
 ~variant ()
 Destruction, allowed only if empty. More...
 
template<typename T >
T & build ()
 Instantiate an empty T in here. More...
 
template<typename T >
T & build (const T &t)
 Instantiate a T in here from t. More...
 
template<typename T >
T & as ()
 Accessor to a built T. More...
 
template<typename T >
const T & as () const
 Const accessor to a built T (for printer). More...
 
template<typename T >
void swap (self_type &other)
 Swap the content with other, of same type. More...
 
template<typename T >
void move (self_type &other)
 Move the content of other to this. More...
 
template<typename T >
void copy (const self_type &other)
 Copy the content of other to this. More...
 
template<typename T >
void destroy ()
 Destroy the stored T. More...
 

Private Member Functions

self_typeoperator= (const self_type &)
 Prohibit blind copies. More...
 
 variant (const self_type &)
 
template<typename T >
T * yyas_ ()
 Accessor to raw memory as T. More...
 
template<typename T >
const T * yyas_ () const
 Const accessor to raw memory as T. More...
 

Private Attributes

union {
   long double   yyalign_me
 Strongest alignment constraints. More...
 
   char   yyraw [S]
 A buffer large enough to store any of the semantic values. More...
 
yybuffer_
 

Detailed Description

template<size_t S>
struct vcsn::detail::dot::variant< S >

A char[S] buffer to store and retrieve objects.

Sort of a variant, but does not keep track of the nature of the stored data, since that knowledge is available via the current state.

Definition at line 176 of file parse.hh.

Member Typedef Documentation

template<size_t S>
typedef variant<S> vcsn::detail::dot::variant< S >::self_type

Type of *this.

Definition at line 179 of file parse.hh.

Constructor & Destructor Documentation

template<size_t S>
vcsn::detail::dot::variant< S >::variant ( )
inline

Empty construction.

Definition at line 182 of file parse.hh.

template<size_t S>
template<typename T >
vcsn::detail::dot::variant< S >::variant ( const T &  t)
inline

Construct and fill.

Definition at line 187 of file parse.hh.

template<size_t S>
vcsn::detail::dot::variant< S >::~variant ( )
inline

Destruction, allowed only if empty.

Definition at line 194 of file parse.hh.

template<size_t S>
vcsn::detail::dot::variant< S >::variant ( const self_type )
private

Member Function Documentation

template<size_t S>
template<typename T >
const T& vcsn::detail::dot::variant< S >::as ( ) const
inline

Const accessor to a built T (for printer).

Definition at line 224 of file parse.hh.

template<size_t S>
template<typename T >
T& vcsn::detail::dot::variant< S >::build ( )
inline

Instantiate an empty T in here.

Definition at line 200 of file parse.hh.

Referenced by vcsn::detail::dot::parser::parse().

template<size_t S>
template<typename T >
T& vcsn::detail::dot::variant< S >::build ( const T &  t)
inline

Instantiate a T in here from t.

Definition at line 208 of file parse.hh.

template<size_t S>
template<typename T >
void vcsn::detail::dot::variant< S >::copy ( const self_type other)
inline

Copy the content of other to this.

Definition at line 259 of file parse.hh.

Referenced by vcsn::detail::dot::parser::basic_symbol< Base >::basic_symbol().

template<size_t S>
template<typename T >
void vcsn::detail::dot::variant< S >::destroy ( )
inline
template<size_t S>
template<typename T >
void vcsn::detail::dot::variant< S >::move ( self_type other)
inline

Move the content of other to this.

Destroys other.

Definition at line 249 of file parse.hh.

Referenced by vcsn::detail::dot::parser::stack_symbol_type::stack_symbol_type(), and vcsn::rat::parser::stack_symbol_type::stack_symbol_type().

template<size_t S>
self_type& vcsn::detail::dot::variant< S >::operator= ( const self_type )
private

Prohibit blind copies.

template<size_t S>
template<typename T >
void vcsn::detail::dot::variant< S >::swap ( self_type other)
inline

Swap the content with other, of same type.

Both variants must be built beforehand, because swapping the actual data requires reading it (with as()), and this is not possible on unconstructed variants: it would require some dynamic testing, which should not be the variant's responsability. Swapping between built and (possibly) non-built is done with variant::move ().

Definition at line 239 of file parse.hh.

template<size_t S>
template<typename T >
T* vcsn::detail::dot::variant< S >::yyas_ ( )
inlineprivate

Accessor to raw memory as T.

Definition at line 280 of file parse.hh.

template<size_t S>
template<typename T >
const T* vcsn::detail::dot::variant< S >::yyas_ ( ) const
inlineprivate

Const accessor to raw memory as T.

Definition at line 289 of file parse.hh.

Member Data Documentation

template<size_t S>
long double vcsn::detail::dot::variant< S >::yyalign_me

Strongest alignment constraints.

Definition at line 298 of file parse.hh.

template<size_t S>
char vcsn::detail::dot::variant< S >::yyraw[S]

A buffer large enough to store any of the semantic values.

Definition at line 300 of file parse.hh.


The documentation for this struct was generated from the following file: