19 #ifndef LOKI_SCOPEGUARD_INC_ 20 #define LOKI_SCOPEGUARD_INC_ 111 template <
typename F>
137 template <
typename F>
158 template <
typename F,
typename P1>
185 template <
typename F,
typename P1>
206 template <
typename F,
typename P1,
typename P2>
234 template <
typename F,
typename P1,
typename P2>
255 template <
typename F,
typename P1,
typename P2,
typename P3>
284 template <
typename F,
typename P1,
typename P2,
typename P3>
305 template <
typename F,
typename P1,
typename P2,
typename P3,
typename P4 >
310 F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
322 fun_( p1_, p2_, p3_, p4_ );
326 fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
337 template <
typename F,
typename P1,
typename P2,
typename P3,
typename P4 >
358 template <
typename F,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5 >
363 F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
365 return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
375 fun_( p1_, p2_, p3_, p4_, p5_ );
379 fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
391 template <
typename F,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5 >
392 inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
394 return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
413 template <
class Obj,
typename MemFun>
440 template <
class Obj,
typename MemFun>
446 template <
typename Ret,
class Obj1,
class Obj2>
452 template <
typename Ret,
class Obj1,
class Obj2>
475 template <
class Obj,
typename MemFun,
typename P1>
491 (obj_.*memFun_)(p1_);
503 template <
class Obj,
typename MemFun,
typename P1>
509 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
515 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b>
538 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
554 (obj_.*memFun_)(p1_, p2_);
557 ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2)
567 template <
class Obj,
typename MemFun,
typename P1,
typename P2>
573 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
typename P2b>
579 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
typename P2a,
typename P2b>
602 template <
class Obj,
typename MemFun,
typename P1,
typename P2,
typename P3 >
607 Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
619 ( obj_.*memFun_ )( p1_, p2_, p3_ );
623 obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
634 template <
class Obj,
typename MemFun,
typename P1,
typename P2,
typename P3 >
636 Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
639 obj, memFun, p1, p2, p3 );
642 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
643 typename P2a,
typename P2b,
typename P3a,
typename P3b >
645 MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
651 template <
typename Ret,
class Obj1,
class Obj2,
typename P1a,
typename P1b,
652 typename P2a,
typename P2b,
typename P3a,
typename P3b >
654 MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
662 #define LOKI_CONCATENATE_DIRECT(s1, s2) s1##s2 663 #define LOKI_CONCATENATE(s1, s2) LOKI_CONCATENATE_DIRECT(s1, s2) 664 #define LOKI_ANONYMOUS_VARIABLE(str) LOKI_CONCATENATE(str, __LINE__) 666 #define LOKI_ON_BLOCK_EXIT ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard 667 #define LOKI_ON_BLOCK_EXIT_OBJ ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard 669 #endif // end file guardian void Execute()
Definition: ScopeGuard.h:373
Implementation class for a class per-instance member function with three parameters.
Definition: ScopeGuard.h:603
~ScopeGuardImpl2()
Definition: ScopeGuard.h:215
Definition: NullType.h:21
ObjScopeGuardImpl0< Obj, MemFun > MakeObjGuard(Obj &obj, MemFun memFun)
Definition: ScopeGuard.h:441
Implementation class for a standalone function or class static function with three parameters...
Definition: ScopeGuard.h:256
MemFun memFun_
Definition: ScopeGuard.h:562
void Execute()
Definition: ScopeGuard.h:220
ScopeGuardImpl1(F fun, P1 p1)
Definition: ScopeGuard.h:177
F fun_
Definition: ScopeGuard.h:181
Implementation class for a class per-instance member function with two parameters.
Definition: ScopeGuard.h:539
const P2 p2_
Definition: ScopeGuard.h:231
ObjScopeGuardImpl3(Obj &obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
Definition: ScopeGuard.h:622
void Execute()
Definition: ScopeGuard.h:427
const P1 p1_
Definition: ScopeGuard.h:182
const P1 p1_
Definition: ScopeGuard.h:384
Obj & obj_
Definition: ScopeGuard.h:561
ScopeGuardImplBase()
Definition: ScopeGuard.h:79
const P4 p4_
Definition: ScopeGuard.h:334
const P1 p1_
Definition: ScopeGuard.h:500
const P3 p3_
Definition: ScopeGuard.h:386
void Dismiss() const
Definition: ScopeGuard.h:82
Implementation class for a standalone function or class static function with two parameters.
Definition: ScopeGuard.h:207
void Execute()
Definition: ScopeGuard.h:489
const P5 p5_
Definition: ScopeGuard.h:388
MemFun memFun_
Definition: ScopeGuard.h:437
F fun_
Definition: ScopeGuard.h:229
static ObjScopeGuardImpl1< Obj, MemFun, P1 > MakeObjGuard(Obj &obj, MemFun memFun, P1 p1)
Definition: ScopeGuard.h:479
Implementation class for a class per-instance member function with one parameter. ...
Definition: ScopeGuard.h:476
Definition: InputPrereqs.h:91
F fun_
Definition: ScopeGuard.h:330
ObjScopeGuardImpl2(Obj &obj, MemFun memFun, P1 p1, P2 p2)
Definition: ScopeGuard.h:557
static ScopeGuardImpl0< F > MakeGuard(F fun)
Definition: ScopeGuard.h:115
~ScopeGuardImpl5()
Definition: ScopeGuard.h:368
const P3 p3_
Definition: ScopeGuard.h:631
void Execute()
Definition: ScopeGuard.h:552
ScopeGuardImpl5(F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
Definition: ScopeGuard.h:378
Obj & obj_
Definition: ScopeGuard.h:436
void Execute()
Definition: ScopeGuard.h:617
ScopeGuardImpl2(F fun, P1 p1, P2 p2)
Definition: ScopeGuard.h:225
ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3)
Definition: ScopeGuard.h:274
void Execute()
Definition: ScopeGuard.h:269
const P2 p2_
Definition: ScopeGuard.h:280
static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
Definition: ScopeGuard.h:362
const P2 p2_
Definition: ScopeGuard.h:332
static ScopeGuardImpl3< F, P1, P2, P3 > MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
Definition: ScopeGuard.h:259
void Execute()
Definition: ScopeGuard.h:172
const P4 p4_
Definition: ScopeGuard.h:387
Implementation class for a standalone function or class static function with one parameter.
Definition: ScopeGuard.h:159
const P3 p3_
Definition: ScopeGuard.h:281
MemFun memFun_
Definition: ScopeGuard.h:628
const P2 p2_
Definition: ScopeGuard.h:385
~ScopeGuardImpl3()
Definition: ScopeGuard.h:264
const P2 p2_
Definition: ScopeGuard.h:630
const P1 p1_
Definition: ScopeGuard.h:629
F fun_
Definition: ScopeGuard.h:278
const P2 p2_
Definition: ScopeGuard.h:564
ScopeGuardImpl4(F fun, P1 p1, P2 p2, P3 p3, P4 p4)
Definition: ScopeGuard.h:325
const P1 p1_
Definition: ScopeGuard.h:230
ObjScopeGuardImpl0(Obj &obj, MemFun memFun)
Definition: ScopeGuard.h:432
~ObjScopeGuardImpl2()
Definition: ScopeGuard.h:547
static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(F fun, P1 p1, P2 p2, P3 p3, P4 p4)
Definition: ScopeGuard.h:309
~ScopeGuardImpl4()
Definition: ScopeGuard.h:315
static ObjScopeGuardImpl2< Obj, MemFun, P1, P2 > MakeObjGuard(Obj &obj, MemFun memFun, P1 p1, P2 p2)
Definition: ScopeGuard.h:542
Implementation class for a standalone function or class static function with five parameters...
Definition: ScopeGuard.h:359
static ScopeGuardImpl2< F, P1, P2 > MakeGuard(F fun, P1 p1, P2 p2)
Definition: ScopeGuard.h:210
~ScopeGuardImpl0()
Definition: ScopeGuard.h:120
Implementation class for a class per-instance member function with no parameters. ...
Definition: ScopeGuard.h:414
static ObjScopeGuardImpl0< Obj, MemFun > MakeObjGuard(Obj &obj, MemFun memFun)
Definition: ScopeGuard.h:417
~ObjScopeGuardImpl0()
Definition: ScopeGuard.h:422
Obj & obj_
Definition: ScopeGuard.h:627
void Execute()
Definition: ScopeGuard.h:320
bool dismissed_
Definition: ScopeGuard.h:76
Obj & obj_
Definition: ScopeGuard.h:498
ObjScopeGuardImpl1(Obj &obj, MemFun memFun, P1 p1)
Definition: ScopeGuard.h:494
Implementation class for a standalone function or class static function with no parameters.
Definition: ScopeGuard.h:112
static ScopeGuardImpl1< F, P1 > MakeGuard(F fun, P1 p1)
Definition: ScopeGuard.h:162
ScopeGuardImplBase & operator=(const ScopeGuardImplBase &)
Copy-assignment operator is not implemented and private.
~ScopeGuardImplBase()
Definition: ScopeGuard.h:54
Base class used by all ScopeGuard implementations.
Definition: ScopeGuard.h:47
F fun_
Definition: ScopeGuard.h:134
~ScopeGuardImpl1()
Definition: ScopeGuard.h:167
F fun_
Definition: ScopeGuard.h:383
Implementation class for a standalone function or class static function with four parameters...
Definition: ScopeGuard.h:306
const P1 p1_
Definition: ScopeGuard.h:563
Definition: InputPrereqs.h:94
ScopeGuardImpl0(F fun)
Definition: ScopeGuard.h:130
void Execute()
Definition: ScopeGuard.h:125
const P1 p1_
Definition: ScopeGuard.h:331
~ObjScopeGuardImpl3()
Definition: ScopeGuard.h:612
static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(Obj &obj, MemFun memFun, P1 p1, P2 p2, P3 p3)
Definition: ScopeGuard.h:606
ScopeGuardImplBase(const ScopeGuardImplBase &other)
Copy-constructor takes over responsibility from other ScopeGuard.
Definition: ScopeGuard.h:58
~ObjScopeGuardImpl1()
Definition: ScopeGuard.h:484
const P3 p3_
Definition: ScopeGuard.h:333
ScopeGuardImpl0< F > MakeGuard(F fun)
Definition: ScopeGuard.h:138
MemFun memFun_
Definition: ScopeGuard.h:499
const P1 p1_
Definition: ScopeGuard.h:279
static void SafeExecute(J &j)
Definition: ScopeGuard.h:65
const ScopeGuardImplBase & ScopeGuard
Definition: ScopeGuard.h:95