OFFIS DCMTK  Version 3.6.0
ndc.h
Go to the documentation of this file.
1 // Module: Log4CPLUS
2 // File: ndc.h
3 // Created: 6/2001
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright 2001-2009 Tad E. Smith
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 
25 #ifndef _LO4CPLUS_NDC_HEADER_
26 #define _LO4CPLUS_NDC_HEADER_
27 
28 #include "dcmtk/oflog/config.h"
29 #include "dcmtk/oflog/tstring.h"
32 
33 //#include <map>
34 //#include <stack>
35 #include "dcmtk/ofstd/ofstack.h"
36 
37 #if (defined(__MWERKS__) && defined(__MACOS__))
38 using STD_NAMESPACE size_t;
39 #endif
40 
41 
42 namespace log4cplus {
43  // Forward declarations
44  class NDC;
45  struct DiagnosticContext;
46  typedef OFStack<DiagnosticContext> DiagnosticContextStack;
47 
48 #if defined (_MSC_VER)
49  LOG4CPLUS_EXPORT NDC& getNDC();
50 #endif
51 
52 
117  class LOG4CPLUS_EXPORT NDC : protected log4cplus::helpers::LogLogUser {
118  public:
127  void clear();
128 
142  DiagnosticContextStack cloneStack();
143 
158  void inherit(const DiagnosticContextStack& stack);
159 
163  log4cplus::tstring get();
164 
170  size_t getDepth();
171 
183  log4cplus::tstring pop();
184 
194  log4cplus::tstring peek();
195 
210  void push(const log4cplus::tstring& message);
211 
221  void remove();
222 
253  void setMaxDepth(size_t maxDepth);
254 
255  // Dtor
256  ~NDC();
257 
258  private:
259  // Methods
260  DiagnosticContextStack* getPtr();
261 
262  // Data
263  LOG4CPLUS_THREAD_LOCAL_TYPE threadLocal;
264 
265  // Disallow construction (and copying) except by getNDC()
266  NDC();
267  NDC(const NDC&);
268  NDC& operator=(const NDC&);
269 
270  // Friends
271 #if defined (_MSC_VER)
272  friend LOG4CPLUS_EXPORT NDC& getNDC();
273 #else
274  friend NDC& getNDC();
275 #endif
276  };
277 
278 
282  LOG4CPLUS_EXPORT NDC& getNDC();
283 
284 
288  struct LOG4CPLUS_EXPORT DiagnosticContext {
289  // Ctors
290  DiagnosticContext(const log4cplus::tstring& message, DiagnosticContext *parent);
291  DiagnosticContext(const log4cplus::tstring& message);
292 
293  // Data
296  };
297 
298 
303  class LOG4CPLUS_EXPORT NDCContextCreator {
304  public:
307 
310  };
311 
312 } // end namespace log4cplus
313 
314 
315 #endif // _LO4CPLUS_NDC_HEADER_


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2