24{
27
28 string inputFile;
30
31 try {
32
33 JParser<> zap(
"Auxiliary program to print UUID.");
34
37
38 zap(argc, argv);
39 }
40 catch(const exception &error) {
41 FATAL(error.what() << endl);
42 }
43
44 if (inputFile != "") {
45
46 if (getFilenameExtension(inputFile) == ROOT_FILE_FORMAT) {
47
48 gErrorIgnoreLevel = kError;
49
50 TFile* file = TFile::Open(inputFile.c_str(), "EXISTS");
51
52 if (file != NULL) {
53 file->GetUUID().Print();
54 file->Close();
55 } else
56 return 1;
57
58 } else if (getFilenameExtension(inputFile) == ASCII_FILE_FORMAT ||
59 getFilenameExtension(inputFile) == KM3NET_DETECTOR_FILE_FORMAT) {
60
61 ifstream in(inputFile.c_str());
62
64
65 if (in >> comment && comment.
hasUUID())
66 cout << comment.
getUUID() << endl;
67 else
68 return 1;
69
70 in.close();
71
72 } else if (getFilenameExtension(inputFile) == BINARY_DETECTOR_FILE_FORMAT[0] ||
73 getFilenameExtension(inputFile) == BINARY_DETECTOR_FILE_FORMAT[1]) {
74
76
78
79 char c;
80
81 for (string buffer; in >> c && c == JComment::START_COMMENT; ) {
82
83 in >> buffer;
84
86 }
87
89 cout << comment.
getUUID() << endl;
90 else
91 return 1;
92
93 in.close();
94 }
95
96 } else {
97
98 cout << JUUID::rndm() << endl;
99 }
100
101 return 0;
102}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Binary buffered file input.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).