ScopeExit.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_ScopeExit_
18 #define HH_SENF_Utils_ScopeExit_ 1
19 
20 // Custom includes
21 #include <boost/function.hpp>
22 #include <boost/noncopyable.hpp>
23 
24 //#include "ScopeExit.mpp"
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 
27 namespace senf {
28 
29  class ScopeExit : boost::noncopyable
30  {
31  public:
32  typedef boost::function<void ()> Function;
33 
34  explicit ScopeExit(Function const & fn);
35  ~ScopeExit();
36 
37  private:
38  Function fn_;
39  };
40 
41 }
42 
43 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 #include "ScopeExit.cci"
45 //#include "ScopeExit.ct"
46 //#include "ScopeExit.cti"
47 #endif
48 
49 
50 // Local Variables:
51 // mode: c++
52 // fill-column: 100
53 // comment-column: 40
54 // c-file-style: "senf"
55 // indent-tabs-mode: nil
56 // ispell-local-dictionary: "american"
57 // compile-command: "scons -u test"
58 // End:
ScopeExit(Function const &fn)
boost::function< void()> Function
Definition: ScopeExit.hh:32