STIR 6.4.0
warning.h
Go to the documentation of this file.
1//
2//
3#ifndef __stir_warning_H__
4#define __stir_warning_H__
5/*
6 Copyright (C) 2010- 2013, Hammersmith Imanet Ltd
7 This file is part of STIR.
8 SPDX-License-Identifier: Apache-2.0
9
10 See STIR/LICENSE.txt for details
11*/
20#include "stir/Verbosity.h"
21#include "stir/TextWriter.h"
22#include <sstream>
23
24START_NAMESPACE_STIR
25
27
39void warning(const char* const s, ...);
40
42
61
62template <class STRING>
63inline void
64warning(const STRING& string, const int verbosity_level = 1)
65{
66 if (Verbosity::get() >= verbosity_level)
67 {
68 std::stringstream sstr;
69 sstr << "\nWARNING: " << string << std::endl;
70 writeText(sstr.str().c_str(), WARNING_CHANNEL);
71 }
72}
73END_NAMESPACE_STIR
74#endif
Declaration of class stir::Verbosity.
void warning(const char *const s,...)
Print warning with format string a la printf.
Definition warning.cxx:41