My Project
Loading...
Searching...
No Matches
Opm::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)
 
 GenericGuard (GenericGuard &&other)
 
 GenericGuard (const GenericGuard &other)=delete
 
void setEnabled (bool value)
 Specify whether the guard object is "on duty" or not.
 
bool enabled () const
 Returns whether the guard object is "on duty" or not.
 

Detailed Description

template<class Callback>
class Opm::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 Opm::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: