finitediff
Utilities.h
Go to the documentation of this file.
1 /*
2 Copyright 2017 Laurent Claessens
3 contact : laurent@claessens-donadello.eu
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
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.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
24 #ifndef __UTILITIES_H_062410__
25 #define __UTILITIES_H_062410__
26 
27 #include <sstream>
28 #include <iostream>
29 
43 template <class T>
44 unsigned int value_length(const T& value)
45 {
46  std::stringstream s;
47  s<<value;
48  return s.tellp();
49 }
50 
53 void echo_function_test(const std::string& s);
54 
58 void echo_single_test(const std::string& s);
59 
63 extern std::ostream& debug_print;
64 
71 template <class M>
72 void debug_matrix_print(const std::string& name, const M& mtr)
73 {
74  std::cout<<name<<std::endl;
75  std::cout<<mtr<<std::endl;
76 }
77 
84 template <class T>
85 void debug_value_print(const std::string& text, const T& v)
86 {
87  std::cout<<text<<" : "<<v<<std::endl;
88 }
89 
90 
108 void tooGenericWarning(const std::string& message);
109 
110 #endif
void debug_value_print(const std::string &text, const T &v)
Print a small message and a value, for debug purpose.
Definition: Utilities.h:85
void tooGenericWarning(const std::string &message)
Display a small warning.
Definition: Utilities.cpp:34
void debug_matrix_print(const std::string &name, const M &mtr)
Definition: Utilities.h:72
void echo_single_test(const std::string &s)
Definition: Utilities.cpp:26
std::ostream & debug_print
unsigned int value_length(const T &value)
Definition: Utilities.h:44
void echo_function_test(const std::string &s)
Definition: Utilities.cpp:21