10#include "ioss_export.h"
24 explicit operator T &()
const {
return ref_; }
53 mutable bool dismissed_{
false};
57 void Dismiss()
const { dismissed_ =
true; }
121 template <
typename F,
typename P1,
typename P2>
127 template <
typename F,
typename P1,
typename P2,
typename P3>
146 template <
typename F,
typename P1,
typename P2,
typename P3>
170 template <
class Obj,
typename MemFun>
176 template <
typename Ret,
class Obj1,
class Obj2>
182 template <
typename Ret,
class Obj1,
class Obj2>
188 template <
class Obj,
typename MemFun,
typename P1>
206 template <
class Obj,
typename MemFun,
typename P1>
212 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
219 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
226 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
249 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
255 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
257 inline ObjScopeGuardImpl2<Obj1, Ret (Obj2::*)(P1a, P2a), P1b, P2b>
258 MakeGuard(Ret (Obj2::*memFun)(P1a, P2a), Obj1 &obj, P1b p1, P2b p2)
264 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
266 inline ObjScopeGuardImpl2<Obj1, Ret (Obj2::*)(P1a, P2a), P1b, P2b>
267 MakeGuard(Ret (Obj2::*memFun)(P1a, P2a), Obj1 *obj, P1b p1, P2b p2)
273#define CONCATENATE_DIRECT(s1, s2) s1##s2
274#define CONCATENATE(s1, s2) CONCATENATE_DIRECT(s1, s2)
275#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __LINE__)
277#define ON_BLOCK_EXIT ::Ioss::ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = ::Ioss::MakeGuard
278#define ON_BLOCK_EXIT_OBJ ::Ioss::ScopeGuard ANONYMOUS_VARIABLE(scopeGuard) = ::Ioss::MakeObjGuard
Definition Ioss_ScopeGuard.h:155
Obj & obj_
Definition Ioss_ScopeGuard.h:166
void Execute()
Definition Ioss_ScopeGuard.h:162
static ObjScopeGuardImpl0< Obj, MemFun > MakeObjGuard(Obj &obj, MemFun memFun)
Definition Ioss_ScopeGuard.h:157
MemFun memFun_
Definition Ioss_ScopeGuard.h:167
~ObjScopeGuardImpl0()
Definition Ioss_ScopeGuard.h:161
ObjScopeGuardImpl0(Obj &obj, MemFun memFun)
Definition Ioss_ScopeGuard.h:165
Definition Ioss_ScopeGuard.h:190
ObjScopeGuardImpl1(Obj &obj, MemFun memFun, P1 p1)
Definition Ioss_ScopeGuard.h:200
void Execute()
Definition Ioss_ScopeGuard.h:197
static ObjScopeGuardImpl1< Obj, MemFun, P1 > MakeObjGuard(Obj &obj, MemFun memFun, P1 p1)
Definition Ioss_ScopeGuard.h:192
~ObjScopeGuardImpl1()
Definition Ioss_ScopeGuard.h:196
Obj & obj_
Definition Ioss_ScopeGuard.h:201
MemFun memFun_
Definition Ioss_ScopeGuard.h:202
const P1 p1_
Definition Ioss_ScopeGuard.h:203
Definition Ioss_ScopeGuard.h:228
void Execute()
Definition Ioss_ScopeGuard.h:236
ObjScopeGuardImpl2(Obj &obj, MemFun memFun, P1 p1, P2 p2)
Definition Ioss_ScopeGuard.h:239
Obj & obj_
Definition Ioss_ScopeGuard.h:243
static ObjScopeGuardImpl2< Obj, MemFun, P1, P2 > MakeObjGuard(Obj &obj, MemFun memFun, P1 p1, P2 p2)
Definition Ioss_ScopeGuard.h:230
const P2 p2_
Definition Ioss_ScopeGuard.h:246
const P1 p1_
Definition Ioss_ScopeGuard.h:245
~ObjScopeGuardImpl2()
Definition Ioss_ScopeGuard.h:235
MemFun memFun_
Definition Ioss_ScopeGuard.h:244
Definition Ioss_ScopeGuard.h:19
RefHolder & operator=(const RefHolder &)=delete
T & ref_
Definition Ioss_ScopeGuard.h:20
RefHolder(T &ref)
Definition Ioss_ScopeGuard.h:23
Definition Ioss_ScopeGuard.h:67
static ScopeGuardImpl0< F > MakeGuard(F fun)
Definition Ioss_ScopeGuard.h:69
F fun_
Definition Ioss_ScopeGuard.h:75
ScopeGuardImpl0(F fun)
Definition Ioss_ScopeGuard.h:74
~ScopeGuardImpl0()
Definition Ioss_ScopeGuard.h:70
void Execute()
Definition Ioss_ScopeGuard.h:71
Definition Ioss_ScopeGuard.h:84
const P1 p1_
Definition Ioss_ScopeGuard.h:96
static ScopeGuardImpl1< F, P1 > MakeGuard(F fun, P1 p1)
Definition Ioss_ScopeGuard.h:86
ScopeGuardImpl1(F fun, P1 p1)
Definition Ioss_ScopeGuard.h:94
F fun_
Definition Ioss_ScopeGuard.h:95
void Execute()
Definition Ioss_ScopeGuard.h:91
~ScopeGuardImpl1()
Definition Ioss_ScopeGuard.h:90
Definition Ioss_ScopeGuard.h:105
ScopeGuardImpl2(F fun, P1 p1, P2 p2)
Definition Ioss_ScopeGuard.h:115
void Execute()
Definition Ioss_ScopeGuard.h:112
static ScopeGuardImpl2< F, P1, P2 > MakeGuard(F fun, P1 p1, P2 p2)
Definition Ioss_ScopeGuard.h:107
F fun_
Definition Ioss_ScopeGuard.h:116
const P2 p2_
Definition Ioss_ScopeGuard.h:118
const P1 p1_
Definition Ioss_ScopeGuard.h:117
~ScopeGuardImpl2()
Definition Ioss_ScopeGuard.h:111
Definition Ioss_ScopeGuard.h:129
const P1 p1_
Definition Ioss_ScopeGuard.h:141
~ScopeGuardImpl3()
Definition Ioss_ScopeGuard.h:135
static ScopeGuardImpl3< F, P1, P2, P3 > MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
Definition Ioss_ScopeGuard.h:131
const P3 p3_
Definition Ioss_ScopeGuard.h:143
F fun_
Definition Ioss_ScopeGuard.h:140
ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3)
Definition Ioss_ScopeGuard.h:139
const P2 p2_
Definition Ioss_ScopeGuard.h:142
void Execute()
Definition Ioss_ScopeGuard.h:136
Definition Ioss_ScopeGuard.h:31
ScopeGuardImplBase(const ScopeGuardImplBase &other)
Definition Ioss_ScopeGuard.h:37
~ScopeGuardImplBase()=default
static void SafeExecute(J &j)
Definition Ioss_ScopeGuard.h:42
ScopeGuardImplBase()=default
void Dismiss() const
Definition Ioss_ScopeGuard.h:57
ScopeGuardImplBase & operator=(const ScopeGuardImplBase &)=delete
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
ObjScopeGuardImpl0< Obj, MemFun > MakeObjGuard(Obj &obj, MemFun memFun)
Definition Ioss_ScopeGuard.h:171
RefHolder< T > ByRef(T &t)
Definition Ioss_ScopeGuard.h:28
__attribute__((unused)) typedef const ScopeGuardImplBase &ScopeGuard
ScopeGuardImpl0< F > MakeGuard(F fun)
Definition Ioss_ScopeGuard.h:78