blob: 268fd2cacdc73de415d2a1125843567608303004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include "scopeObject.h"
#include "logger.h"
ScopeObject::ScopeObject(const Event & onexitpre, const Event & onsuccess, const Event & onfailure, const Event & onexitpost) :
onExitPre(onexitpre),
onSuccess(onsuccess),
onFailure(onfailure),
onExitPost(onexitpost)
{
}
ScopeObject::~ScopeObject()
{
if (onExitPre) onExitPre();
if (std::uncaught_exception()) {
if (onFailure) onFailure();
}
else {
if (onSuccess) onSuccess();
}
if (onExitPost) onExitPost();
}
|