]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: global | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4Globals.h" | |
7 | ||
8 | #include <stdlib.h> | |
9 | ||
10 | TG4Globals::TG4Globals() { | |
11 | // | |
12 | } | |
13 | ||
14 | TG4Globals::~TG4Globals() { | |
15 | // | |
16 | } | |
17 | ||
18 | // static methods | |
19 | ||
20 | void TG4Globals::Exception(const char* string) | |
21 | { | |
22 | // Prints error message end exits the program. | |
23 | // --- | |
24 | ||
25 | if (string) | |
3c7cd15a | 26 | { G4cerr << G4endl << " " << string << G4endl; } |
27 | G4cerr << "*** TG4Exception: Aborting execution ***" << G4endl; | |
2817d3e2 | 28 | exit(1); |
29 | } | |
30 | ||
31 | void TG4Globals::Warning(const char* string) | |
32 | { | |
33 | // Prints warning message. | |
34 | // --- | |
35 | ||
3c7cd15a | 36 | G4cerr << "++++ TG4Warning: ++++" << G4endl; |
2817d3e2 | 37 | if (string) |
3c7cd15a | 38 | { G4cerr << " " << string << G4endl; } |
39 | G4cerr << "+++++++++++++++++++++++" << G4endl; | |
2817d3e2 | 40 | } |
68a77073 | 41 | |
42 | void TG4Globals::AppendNumberToString(G4String& s, G4int a) | |
43 | { | |
44 | // Appends number to string. | |
45 | // --- | |
46 | ||
47 | const char* kpNumber="0123456789"; | |
48 | G4String p=""; G4String q=""; | |
49 | do | |
50 | { | |
51 | G4int b=a/10; | |
52 | G4int c=a%10; | |
53 | p=kpNumber[c]; | |
54 | q=p.append(q); | |
55 | a=b; | |
56 | } while (a>0); | |
57 | s.append(q); | |
58 | } | |
59 |