source: trunk/src/duchamp.cc @ 120

Last change on this file since 120 was 120, checked in by Matthew Whiting, 18 years ago

Introduced error and warning reporting functions, to normalise the format
of errors and warnings. Definitions of functions go in duchamp.cc.
Changed all code that reports errors/warnings to use these new functions.

Fixed a couple of bugs that affected the way 2D images were dealt with:
ReconSearch? now looks at how many dimensions there are in the data array
before choosing the dimension of the reconstruction, and the minChannels
test was improved for the case of minChannels=0.

Some minor additions made to the Guide as well.

File size: 725 bytes
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  std::string preamble = "WARNING <" + subroutine + "> : ";
9  std::cerr << preamble;
10  for(int i=0;i<warning.size();i++){
11    std::cerr << warning[i];
12    if((i!=warning.size()-1)&&(warning[i]=='\n'))
13      std::cerr << std::setw(preamble.size()) <<": ";
14  }
15}
16
17void duchampError(std::string subroutine, std::string error)
18{
19  std::string preamble = "ERROR <" + subroutine + "> : ";
20  std::cerr << preamble;
21  for(int i=0;i<error.size();i++){
22    std::cerr << error[i];
23    if((i!=error.size()-1)&&(error[i]=='\n'))
24      std::cerr << std::setw(preamble.size()) <<": ";
25  }
26}
27
Note: See TracBrowser for help on using the repository browser.