MeVisLab Toolbox Reference
mlScopeGuard.h File Reference
#include "mlTypeDefs.h"
#include <utility>

Go to the source code of this file.

Classes

class  ml::ScopeGuardDetail::ScopeGuard< Functor >

Namespaces

namespace  ml
 Defines the class GetTileJob.
namespace  ml::ScopeGuardDetail

Macros

#define ML_UTILITIES_CONCATENATE_IMPL(s1, s2)
 Helper class for performing actions when the current scope is left.
#define ML_UTILITIES_CONCATENATE(s1, s2)
#define ML_UTILITIES_ANONYMOUS_VARIABLE(str)
#define SCOPE_EXIT
 Use this macro in case of an anonymous scope guard like SCOPE_EXIT { foo.needsToBeDoneOnLeavingTheScope(); };.
#define EXPLICIT_SCOPE_EXIT    ::ML_NAMESPACE::ScopeGuardDetail::ScopeGuardOnExit() + [&]()
 Use this macro in case you like an explicit ScopeGuard.

Enumerations

enum class  ml::ScopeGuardDetail::ScopeGuardOnExit

Functions

template<class Functor>
ScopeGuard< Functor > ml::ScopeGuardDetail::operator+ (ScopeGuardOnExit, Functor &&fn)

Macro Definition Documentation

◆ EXPLICIT_SCOPE_EXIT

#define EXPLICIT_SCOPE_EXIT    ::ML_NAMESPACE::ScopeGuardDetail::ScopeGuardOnExit() + [&]()

Use this macro in case you like an explicit ScopeGuard.

This is handy if there is a case where you want to dismiss the action to be taken on leaving the scope.

auto localGuard = EXPLICIT_SCOPE_EXIT { foo.needsToBeDoneOnLeavingTheScope(); }; ... if (specialCase) { localGuard.dismiss(); }

Note: Do not forget the semicolon after the closing brace!

Definition at line 116 of file mlScopeGuard.h.

◆ ML_UTILITIES_ANONYMOUS_VARIABLE

#define ML_UTILITIES_ANONYMOUS_VARIABLE ( str)
Value:
#define ML_UTILITIES_CONCATENATE(s1, s2)

Definition at line 33 of file mlScopeGuard.h.

◆ ML_UTILITIES_CONCATENATE

#define ML_UTILITIES_CONCATENATE ( s1,
s2 )
Value:
#define ML_UTILITIES_CONCATENATE_IMPL(s1, s2)
Helper class for performing actions when the current scope is left.

Definition at line 25 of file mlScopeGuard.h.

◆ ML_UTILITIES_CONCATENATE_IMPL

#define ML_UTILITIES_CONCATENATE_IMPL ( s1,
s2 )
Value:
s1##s2

Helper class for performing actions when the current scope is left.

Originally implemention by Andrei Alexandrescu.

Definition at line 24 of file mlScopeGuard.h.

◆ SCOPE_EXIT

#define SCOPE_EXIT
Value:
auto ML_UTILITIES_ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE) \
= ::ML_NAMESPACE::ScopeGuardDetail::ScopeGuardOnExit() + [&]()
#define ML_UTILITIES_ANONYMOUS_VARIABLE(str)

Use this macro in case of an anonymous scope guard like SCOPE_EXIT { foo.needsToBeDoneOnLeavingTheScope(); };.

Note: Do not forget the semicolon after the closing brace!

Definition at line 96 of file mlScopeGuard.h.