Ewoms::GenericGuard< Callback > Class Template Reference

A simple class which makes sure that a cleanup function is called once the object is destroyed. More...

#include <genericguard.hh>

Public Member Functions

 GenericGuard (Callback &callback)
 
void setEnabled (bool value)
 Specify whether the guard object is "on duty" or not. More...
 
bool enabled () const
 Returns whether the guard object is "on duty" or not.
 

Detailed Description

template<class Callback>
class Ewoms::GenericGuard< Callback >

A simple class which makes sure that a cleanup function is called once the object is destroyed.

This class is particularly useful in conjunction with lambdas for code that might throw exceptions.

Member Function Documentation

◆ setEnabled()

template<class Callback>
void Ewoms::GenericGuard< Callback >::setEnabled ( bool  value)
inline

Specify whether the guard object is "on duty" or not.

If the guard object is destroyed while it is "off-duty", the cleanup callback is not called. At construction, guards are on duty.


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