8 #ifndef MBase_ScopeGuard_h 9 #define MBase_ScopeGuard_h 85 iScopeGuardImplBase.Dismiss();
103 template <
class Function>
125 template <
class Function>
135 template <
class Function,
class Parameter1>
140 mFunction(iFunction),
141 mParameter1(iParameter1)
148 (*mFunction)(mParameter1);
154 const Parameter1& mParameter1;
160 template <
class Function,
class Parameter1>
161 ScopeGuardImpl1<Function, Parameter1>
171 template <
class Function,
class Parameter1,
class Parameter2>
176 const Parameter1& iParameter1,
177 const Parameter2& iParameter2)
throw():
178 mFunction(iFunction),
179 mParameter1(iParameter1),
180 mParameter2(iParameter2)
187 (*mFunction)(mParameter1,mParameter2);
192 const Parameter1& mParameter1;
193 const Parameter2& mParameter2;
199 template <
class Function,
class Parameter1,
class Parameter2>
200 ScopeGuardImpl2<Function, Parameter1, Parameter2>
202 const Parameter2& iParameter2)
throw()
205 iFunction, iParameter1, iParameter2);
212 template <
class Function,
class Parameter1,
class Parameter2,
class Parameter3>
217 const Parameter1& iParameter1,
218 const Parameter2& iParameter2,
219 const Parameter3& iParameter3)
throw():
220 mFunction(iFunction),
221 mParameter1(iParameter1),
222 mParameter2(iParameter2),
223 mParameter3(iParameter3)
230 (*mFunction)(mParameter1,mParameter2,mParameter3);
235 const Parameter1& mParameter1;
236 const Parameter2& mParameter2;
237 const Parameter3& mParameter3;
243 template <
class Function,
class Parameter1,
class Parameter2,
class Parameter3>
244 ScopeGuardImpl3<Function, Parameter1, Parameter2, Parameter3>
246 const Parameter2& iParameter2,
const Parameter3& iParameter3)
throw()
249 iFunction, iParameter1, iParameter2, iParameter3);
256 template <
class Function,
class Parameter1,
class Parameter2,
class Parameter3,
class Parameter4>
261 const Parameter1& iParameter1,
262 const Parameter2& iParameter2,
263 const Parameter3& iParameter3,
264 const Parameter4& iParameter4)
throw():
265 mFunction(iFunction),
266 mParameter1(iParameter1),
267 mParameter2(iParameter2),
268 mParameter3(iParameter3),
269 mParameter4(iParameter4)
276 (*mFunction)(mParameter1,mParameter2,mParameter3,mParameter4);
281 const Parameter1& mParameter1;
282 const Parameter2& mParameter2;
283 const Parameter3& mParameter3;
284 const Parameter4& mParameter4;
290 template <
class Function,
class Parameter1,
class Parameter2,
class Parameter3,
class Parameter4>
291 ScopeGuardImpl4<Function, Parameter1, Parameter2, Parameter3, Parameter4>
293 const Parameter2& iParameter2,
const Parameter3& iParameter3,
const Parameter4& iParameter4)
throw()
296 iFunction, iParameter1, iParameter2, iParameter3, iParameter4);
305 template <
class Object,
class MemberFunction>
311 mMemberFunction(iMemberFunction)
318 (mObject.*mMemberFunction)();
323 MemberFunction mMemberFunction;
329 template <
class Object,
class MemberFunction>
330 ObjectScopeGuardImpl0<Object, MemberFunction>
340 template <
class Object,
class MemberFunction,
class Parameter1>
345 MemberFunction iMemberFunction,
346 Parameter1 iParameter1)
throw():
348 mMemberFunction(iMemberFunction),
349 mParameter1(iParameter1)
356 (mObject.*mMemberFunction)(mParameter1);
361 MemberFunction mMemberFunction;
362 Parameter1 mParameter1;
368 template <
class Object,
class MemberFunction,
class Parameter1>
369 ObjectScopeGuardImpl1<Object, MemberFunction, Parameter1>
371 MemberFunction iMemberFunction,
372 Parameter1 iParameter1)
throw()
375 (iObject, iMemberFunction, iParameter1);
382 template <
class Object,
class MemberFunction,
class Parameter1,
class Parameter2>
387 MemberFunction iMemberFunction,
388 Parameter1 iParameter1,
389 Parameter2 iParameter2)
throw():
391 mMemberFunction(iMemberFunction),
392 mParameter1(iParameter1),
393 mParameter2(iParameter2)
400 (mObject.*mMemberFunction)(mParameter1, mParameter2);
405 MemberFunction mMemberFunction;
406 Parameter1 mParameter1;
407 Parameter2 mParameter2;
413 template <
class Object,
class MemberFunction,
class Parameter1,
class Parameter2>
414 ObjectScopeGuardImpl2<Object, MemberFunction, Parameter1, Parameter2>
416 Parameter1 iParameter1, Parameter2 iParameter2)
throw()
419 (iObject, iMemberFunction, iParameter1, iParameter2);
426 #endif // MBase_ScopeGuard_h ~ScopeGuardImplBase()
Definition: ScopeGuard.h:88
bool mDismissed
Definition: ScopeGuard.h:92
Definition: ScopeGuard.h:306
ScopeGuardImplBase(const ScopeGuardImplBase &iScopeGuardImplBase)
Definition: ScopeGuard.h:82
~ScopeGuardImpl0()
Definition: ScopeGuard.h:111
ObjectScopeGuardImpl1(Object &iObject, MemberFunction iMemberFunction, Parameter1 iParameter1)
Definition: ScopeGuard.h:344
~ScopeGuardImpl2()
Definition: ScopeGuard.h:183
ScopeGuardImpl1(Function iFunction, const Parameter1 &iParameter1)
Definition: ScopeGuard.h:139
~ScopeGuardImpl4()
Definition: ScopeGuard.h:272
Definition: ScopeGuard.h:213
ScopeGuardImpl0(Function iFunction)
Definition: ScopeGuard.h:107
Definition: ScopeGuard.h:341
ObjectScopeGuardImpl0< Object, MemberFunction > MakeObjectGuard(Object &iObject, MemberFunction iMemberFunction)
Definition: ScopeGuard.h:331
~ObjectScopeGuardImpl0()
Definition: ScopeGuard.h:314
ScopeGuardImpl0< Function > MakeMethodGuard(Function iFunction)
Definition: ScopeGuard.h:126
void UnDismiss() const
Definition: ScopeGuard.h:66
ObjectScopeGuardImpl0(Object &iObject, MemberFunction iMemberFunction)
Definition: ScopeGuard.h:309
Definition: ScopeGuard.h:104
~ScopeGuardImpl3()
Definition: ScopeGuard.h:226
~ScopeGuardImpl1()
Definition: ScopeGuard.h:144
Definition: ScopeGuard.h:383
ScopeGuardImpl4(Function iFunction, const Parameter1 &iParameter1, const Parameter2 &iParameter2, const Parameter3 &iParameter3, const Parameter4 &iParameter4)
Definition: ScopeGuard.h:260
ObjectScopeGuardImpl2(Object &iObject, MemberFunction iMemberFunction, Parameter1 iParameter1, Parameter2 iParameter2)
Definition: ScopeGuard.h:386
Definition: Allocator.h:47
~ObjectScopeGuardImpl1()
Definition: ScopeGuard.h:352
~ObjectScopeGuardImpl2()
Definition: ScopeGuard.h:396
Definition: ScopeGuard.h:172
const ScopeGuardImplBase & ScopeGuard
Definition: ScopeGuard.h:423
Definition: ScopeGuard.h:50
ScopeGuardImplBase()
Definition: ScopeGuard.h:72
ScopeGuardImpl3(Function iFunction, const Parameter1 &iParameter1, const Parameter2 &iParameter2, const Parameter3 &iParameter3)
Definition: ScopeGuard.h:216
ScopeGuardImpl2(Function iFunction, const Parameter1 &iParameter1, const Parameter2 &iParameter2)
Definition: ScopeGuard.h:175
void Dismiss() const
Definition: ScopeGuard.h:57
Definition: ScopeGuard.h:257
Definition: ScopeGuard.h:136