source: trunk/src/duchamp.cc @ 221

Last change on this file since 221 was 221, checked in by Matthew Whiting, 17 years ago

More documentation being added to source code, with a new file (src/Utils/Hanning.cc) added as well.

File size: 1.2 KB
Line 
1#include <iostream>
2#include <iomanip>
3#include <string>
4#include <duchamp.hh>
5
6void duchampWarning(std::string subroutine, std::string warning)
7{
8  /**
9   * Prints a WARNING message to the standard error stream, quoting
10   * the subroutine that the problem occurred in, and a descriptive
11   * warning text.
12   *
13   * Format: WARNING \<function\> : Something happened that you should be aware of.
14   */
15  std::string preamble = "WARNING <" + subroutine + "> : ";
16  std::cerr << preamble;
17  for(int i=0;i<warning.size();i++){
18    std::cerr << warning[i];
19    if((i!=warning.size()-1)&&(warning[i]=='\n'))
20      std::cerr << std::setw(preamble.size()) <<": ";
21  }
22}
23
24void duchampError(std::string subroutine, std::string error)
25{
26  /**
27   * Prints an ERROR message to the standard error stream, quoting
28   * the subroutine that the problem occurred in, a descriptive
29   * warning text, and sounding the bell.
30   *
31   * Format: ERROR \<function\> : Something bad happened.
32   */
33  std::string preamble = "\aERROR <" + subroutine + "> : ";
34  std::cerr << preamble;
35  for(int i=0;i<error.size();i++){
36    std::cerr << error[i];
37    if((i!=error.size()-1)&&(error[i]=='\n'))
38      std::cerr << std::setw(preamble.size()-1) <<": ";
39  }
40}
Note: See TracBrowser for help on using the repository browser.