Add ScopeGuard utility
authorZbigniew Kostrzewa <z.kostrzewa@samsung.com>
Thu, 18 Jul 2013 11:36:45 +0000 (13:36 +0200)
committerZbigniew Kostrzewa <z.kostrzewa@samsung.com>
Fri, 19 Jul 2013 05:42:39 +0000 (07:42 +0200)
commit60cca031c9e3e0099d64de173445dc7654e3820e
treeca1b02aa141f10fd86353e015623ae099cecac75
parent58ab81974f1f9aa97af6d6da56492f0b8666c26d
Add ScopeGuard utility

[Issue#] N/A
[Bug] N/A
[Cause] N/A
[Solution] ScopeGuard is utility class that allows to register a piece
of code to be executed when control exits a scope in which ScopeGuard
object has been created.
Implementation based on:
* Scope guard pointer from Loki library
  http://loki-lib.cvs.sourceforge.net/loki-lib/loki/include/loki/ScopeGuard.h?view=markup
* Scope guard implementation in folly library
  https://github.com/facebook/folly/blob/master/folly/ScopeGuard.h
* Lecture "Systematic Error Handling in C++" conducted by Andrei Alexandrescu
  http://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C
[Verification]
1. Build repository
2. Run command
  `wrt-commons-tests-core --output=text --regexp='ScopeGuard*'`

[Notes]
It will be utilized e.g. in wrt-installer for guarding detaching from
WRT DB.

Change-Id: I13cdd15b9c9c83a927faeee658d88340052ef66d
modules/core/config.cmake
modules/core/include/dpl/preprocessor.h
modules/core/include/dpl/scope_guard.h [new file with mode: 0644]
tests/core/CMakeLists.txt
tests/core/test_scope_guard.cpp [new file with mode: 0644]