Lumiera  0.pre.03
»edit your freedom«
nobug-resource-handle-context.hpp
Go to the documentation of this file.
1 /*
2  NOBUG-RESOURCE-HANDLE-CONTEXT.hpp - thread local stack to manage NoBug resource handles
3 
4  Copyright (C) Lumiera.org
5  2010, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
43 #ifndef LIB_NOBUG_RESOURCE_HANDLE_CONTEXT_H
44 #define LIB_NOBUG_RESOURCE_HANDLE_CONTEXT_H
45 
46 
47 #include "lib/error.hpp"
49 #include "lib/thread-local.hpp"
50 
51 #include <nobug.h>
52 
53 
54 
55 namespace lib {
56 
57 
58 
59 #ifdef NOBUG_MODE_ALPHA
60 
61 
66  class NobugResourceHandleContext
67  : DiagnosticContext<nobug_resource_user*>
68  {
69  public:
70  };
71 
72 
73 #else /* not NOBUG_ALPHA */
74 
75 
81  {
82 
83  typedef nobug_resource_user* Handle;
84 
85  public:
86 
87  operator Handle ()
88  {
89  return 0;
90  }
91 
94  access ()
95  {
96  UNIMPLEMENTED ("how to disable DiagnosticContext with minimum overhead");
97  }
98  };
99 #endif /* NOBUG_ALPHA? */
100 
101 
102 
103 } // namespace lib
104 #endif
static NobugResourceHandleContext & access()
accessing the innermost diagnostic context created
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Facility for collecting diagnostic context information explicitly.
Implementation namespace for support and library code.
Disabled placeholder for the Diagnostic context, not used in release builds.
Lumiera error handling (C++ interface).