LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
misc::xalloc< StoredType > Class Template Reference

Allocate slots in std::ostreams. More...

#include <xalloc.hh>

Inheritance diagram for misc::xalloc< StoredType >:

Classes

class  get_type
 Handle the data to get from the xalloced place. More...
class  set_type
 Handle the data to put in the xalloced place. More...
class  swap_type
 Swap the data stored in the stream for a given one. More...

Public Member Functions

 xalloc ()
 Allocates the slot.
long int index () const
 The xalloc index.
StoredType & operator() (std::ostream &ostr) const
 The stored data as an lvalue.
set_type set (StoredType &data) const
get_type get (StoredType &data) const
swap_type swap (StoredType &data) const

Private Attributes

const long int index_
 The index of the slot.

Detailed Description

template<class StoredType>
class misc::xalloc< StoredType >

Allocate slots in std::ostreams.

Used to store flags in streams so that calling print with additional parameters is no longer required (for example in ast/libast.hh).

Set, get or swap data. The idea is to build the right inner class with set, get or swap methods, then use this class as a parameter of operator<<.

Constructor & Destructor Documentation

template<class StoredType >
misc::xalloc< StoredType >::xalloc ( )

Allocates the slot.

Member Function Documentation

template<class StoredType>
xalloc< StoredType >::get_type misc::xalloc< StoredType >::get ( StoredType &  data) const

A getter.

Parameters
datawhere to store the value when the getter is executed.
template<class StoredType >
long int misc::xalloc< StoredType >::index ( ) const

The xalloc index.

template<class StoredType >
StoredType & misc::xalloc< StoredType >::operator() ( std::ostream &  ostr) const

The stored data as an lvalue.

template<class StoredType>
xalloc< StoredType >::set_type misc::xalloc< StoredType >::set ( StoredType &  data) const

A setter.

Parameters
datawhere to find the value when the setter is executed.
template<class StoredType>
xalloc< StoredType >::swap_type misc::xalloc< StoredType >::swap ( StoredType &  data) const

A swapper.

Parameters
datavalue to exchange when the swapper is executed.

Referenced by type::Function::dump(), target::instructions_dump(), regalloc::RegisterAllocator::operator()(), and misc::xalloc< StoredType >::swap_type::operator()().

Member Data Documentation

template<class StoredType>
const long int misc::xalloc< StoredType >::index_
private

The index of the slot.


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