MeDiPack  1.3.1
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
debugInformation.cpp
Go to the documentation of this file.
1/*
2 * MeDiPack, a Message Differentiation Package
3 *
4 * Copyright (C) 2015-2025 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of MeDiPack (http://scicomp.rptu.de/software/medi).
11 *
12 * MeDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation, either
15 * version 3 of the License, or (at your option) any later version.
16 *
17 * MeDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU
23 * Lesser General Public License along with MeDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Authors: Max Sagebaum, Tim Albring (SciComp, University of Kaiserslautern-Landau)
27 */
28
29#pragma once
30
31
32#include <iostream>
33
35
39namespace medi {
40
41#if MEDI_DebugInformation
42std::string debugInformation;
43#endif
44
45void printDebugInformationWarning(std::string const& functionName) {
46 std::cerr << "The MeDiPack debug interface function '" << functionName << "' is called without enabling the debug "
47 "interface. Either enabled is with the preprocessor option '-DMEDI_DebugInformation=1' or disable this "
48 "warning with '-DMEDI_DebugInformation_Warning=0'." << std::endl;
49}
50
51void setDebugInformation(std::string const& info) {
52#if MEDI_DebugInformation
53 debugInformation = info;
54#elif MEDI_DebugInformation_Warning
55 printDebugInformationWarning("setDebugInformation");
56#endif
57}
58
59std::string getDebugInformation() {
60#if MEDI_DebugInformation
61 return debugInformation;
62#else
63# if MEDI_DebugInformation_Warning
64 printDebugInformationWarning("getDebugInformation");
65# endif
66 return "";
67#endif
68}
69
71#if MEDI_DebugInformation
72 debugInformation = "info""";
73#elif MEDI_DebugInformation_Warning
74 printDebugInformationWarning("clearDebugInformation");
75#endif
76}
77
78}
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
void clearDebugInformation()
Definition debugInformation.cpp:70
void printDebugInformationWarning(std::string const &functionName)
Definition debugInformation.cpp:45
std::string getDebugInformation()
Definition debugInformation.cpp:59
void setDebugInformation(std::string const &info)
Definition debugInformation.cpp:51