Janitor< T > Struct Template Reference

Simple utility class for running a cleanup function during stack unwinding. More...

#include <Util/Janitor.H>

Collaboration diagram for Janitor< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef void( void_func )(void *)
typedef void( free_func )(T, void_func *)

Public Member Functions

template<class F >
 Janitor (T t, F f)
release ()

Static Public Member Functions

template<class F >
static void typed_freeit (T t, void_func *vf)

Public Attributes

it

Detailed Description

template<class T>
struct Janitor< T >

Simple utility class for running a cleanup function during stack unwinding.

This is useful in wrapping C APIs where resources are managed with acquisition and release functions. In that case, you can create a Janitor<SomeType> with a pointer to the C release function, so that the release function will be automatically called when the enclosing scope is exited (whether by function return or by exception propagation).

Definition at line 49 of file Janitor.H.


The documentation for this struct was generated from the following file:
Generated on Sun May 8 08:43:23 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3