7ba6afb5
Steven de Ridder
Initial commit. d...
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/**
* @brief Ensures that a cleanup function is called at the end of the current scope.
*/
class ScopeGuard
{
public:
/**
* @brief Constructs a RAII instance that will call cleanupFunc in it's destructor.
* @param cleanupFunc The cleanup function to call at the end of the current scope.
* This cleanup function must not throw exceptions. If it does, the behaviour
* is undefined.
*/
ScopeGuard( const CleanUpFunction& cleanupFunc );
// not copyable
ScopeGuard( const ScopeGuard& ) = delete;
ScopeGuard& operator=( const ScopeGuard& ) = delete;
~ScopeGuard() noexcept;
private:
CleanUpFunction m_cleanupFunc;
};
} /* End namespace components */
} /* End namespace osdev */
#endif /* OSDEV_COMPONENTS_SCOPEGUARD_H */
|