]>
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 | ||
72095f7c | 10 | //_____________________________________________________________________________ |
2817d3e2 | 11 | TG4Globals::TG4Globals() { |
12 | // | |
13 | } | |
14 | ||
72095f7c | 15 | //_____________________________________________________________________________ |
2817d3e2 | 16 | TG4Globals::~TG4Globals() { |
17 | // | |
18 | } | |
19 | ||
20 | // static methods | |
21 | ||
72095f7c | 22 | //_____________________________________________________________________________ |
2817d3e2 | 23 | void TG4Globals::Exception(const char* string) |
24 | { | |
25 | // Prints error message end exits the program. | |
26 | // --- | |
27 | ||
28 | if (string) | |
3c7cd15a | 29 | { G4cerr << G4endl << " " << string << G4endl; } |
30 | G4cerr << "*** TG4Exception: Aborting execution ***" << G4endl; | |
2817d3e2 | 31 | exit(1); |
32 | } | |
33 | ||
72095f7c | 34 | //_____________________________________________________________________________ |
2817d3e2 | 35 | void TG4Globals::Warning(const char* string) |
36 | { | |
37 | // Prints warning message. | |
38 | // --- | |
39 | ||
3c7cd15a | 40 | G4cerr << "++++ TG4Warning: ++++" << G4endl; |
2817d3e2 | 41 | if (string) |
3c7cd15a | 42 | { G4cerr << " " << string << G4endl; } |
43 | G4cerr << "+++++++++++++++++++++++" << G4endl; | |
2817d3e2 | 44 | } |
68a77073 | 45 | |
72095f7c | 46 | //_____________________________________________________________________________ |
68a77073 | 47 | void TG4Globals::AppendNumberToString(G4String& s, G4int a) |
48 | { | |
49 | // Appends number to string. | |
50 | // --- | |
51 | ||
52 | const char* kpNumber="0123456789"; | |
53 | G4String p=""; G4String q=""; | |
54 | do | |
55 | { | |
56 | G4int b=a/10; | |
57 | G4int c=a%10; | |
58 | p=kpNumber[c]; | |
59 | q=p.append(q); | |
60 | a=b; | |
61 | } while (a>0); | |
62 | s.append(q); | |
63 | } | |
64 |