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

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

#include <parse.hh>

Inheritance diagram for vcsn::rat::variant< S >:
Collaboration diagram for vcsn::rat::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::rat::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 162 of file parse.hh.

Member Typedef Documentation

template<size_t S>
typedef variant<S> vcsn::rat::variant< S >::self_type

Type of *this.

Definition at line 165 of file parse.hh.

Constructor & Destructor Documentation

template<size_t S>
vcsn::rat::variant< S >::variant ( )
inline

Empty construction.

Definition at line 168 of file parse.hh.

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

Construct and fill.

Definition at line 173 of file parse.hh.

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

Destruction, allowed only if empty.

Definition at line 180 of file parse.hh.

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

Member Function Documentation

template<size_t S>
template<typename T >
T& vcsn::rat::variant< S >::as ( )
inline

Accessor to a built T.

Definition at line 202 of file parse.hh.

Referenced by vcsn::rat::parser::parse().

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

Const accessor to a built T (for printer).

Definition at line 210 of file parse.hh.

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

Instantiate an empty T in here.

Definition at line 186 of file parse.hh.

Referenced by vcsn::rat::parser::parse().

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

Instantiate a T in here from t.

Definition at line 194 of file parse.hh.

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

Copy the content of other to this.

Definition at line 245 of file parse.hh.

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

template<size_t S>
template<typename T >
void vcsn::rat::variant< S >::destroy ( )
inline

Destroy the stored T.

Definition at line 253 of file parse.hh.

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

Move the content of other to this.

Destroys other.

Definition at line 235 of file parse.hh.

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

Prohibit blind copies.

template<size_t S>
template<typename T >
void vcsn::rat::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 225 of file parse.hh.

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

Accessor to raw memory as T.

Definition at line 266 of file parse.hh.

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

Const accessor to raw memory as T.

Definition at line 275 of file parse.hh.

Member Data Documentation

template<size_t S>
long double vcsn::rat::variant< S >::yyalign_me

Strongest alignment constraints.

Definition at line 284 of file parse.hh.

union { ... } vcsn::rat::variant< S >::yybuffer_
template<size_t S>
char vcsn::rat::variant< S >::yyraw[S]

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

Definition at line 286 of file parse.hh.


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