STIR  6.3.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 
24 START_NAMESPACE_STIR
25 
27 
39 void warning(const char* const s, ...);
40 
42 
62 template <class STRING>
63 inline void
64 warning(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 }
73 END_NAMESPACE_STIR
74 #endif
void warning(const STRING &string, const int verbosity_level=1)
Use this function for writing warning messages.
Definition: warning.h:64
Declaration of class stir::Verbosity.
const Array< num_dimensions - num_dimensions2, elemT > & get(const Array< num_dimensions, elemT > &a, const BasicCoordinate< num_dimensions2, int > &c)
an alternative for array indexing using BasicCoordinate objects
Definition: array_index_functions.inl:114