$search
00001 /* 00002 * NDC.hh 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #ifndef _LOG4CPP_NDC_HH 00011 #define _LOG4CPP_NDC_HH 00012 00013 #include <log4cpp/Portability.hh> 00014 #include <string> 00015 #include <vector> 00016 00017 namespace log4cpp { 00069 class LOG4CPP_EXPORT NDC { 00070 public: 00071 00072 struct DiagnosticContext { 00073 DiagnosticContext(const std::string& message); 00074 DiagnosticContext(const std::string& message, 00075 const DiagnosticContext& parent); 00076 00077 std::string message; 00078 std::string fullMessage; 00079 }; 00080 00081 typedef std::vector<DiagnosticContext> ContextStack; 00082 00091 static void clear(); 00092 00106 static ContextStack* cloneStack(); 00107 00112 static const std::string& get(); 00113 00118 static size_t getDepth(); 00119 00120 static void inherit(ContextStack* stack); 00121 00132 static std::string pop(); 00133 00142 static void push(const std::string& message); 00143 00150 static void setMaxDepth(int maxDepth); 00151 00156 static NDC& getNDC(); 00157 00158 NDC(); 00159 virtual ~NDC(); 00160 00161 public: 00162 virtual void _clear(); 00163 virtual ContextStack* _cloneStack(); 00164 virtual const std::string& _get() const; 00165 virtual size_t _getDepth() const; 00166 virtual void _inherit(ContextStack* stack); 00167 virtual std::string _pop(); 00168 virtual void _push(const std::string& message); 00169 virtual void _setMaxDepth(int maxDepth); 00170 00171 ContextStack _stack; 00172 }; 00173 } 00174 00175 #endif // _LOG4CPP_NDC_HH