1 /******************************************************************************
3 * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
23 #include "base/i2-base.hpp"
24 #include "base/string.hpp"
30 class I2_BASE_API ContextTrace
35 void Print(std::ostream& fp) const;
37 size_t GetLength(void) const;
40 std::list<String> m_Frames;
43 I2_BASE_API std::ostream& operator<<(std::ostream& stream, const ContextTrace& trace);
50 class I2_BASE_API ContextFrame
53 ContextFrame(const String& message);
57 static std::list<String>& GetFrames(void);
59 friend class ContextTrace;
62 /* The currentContextFrame variable has to be volatile in order to prevent
63 * the compiler from optimizing it away. */
64 #define CONTEXT(message) volatile icinga::ContextFrame currentContextFrame(message)
67 #endif /* CONTEXT_H */