ATLAS Offline Software
Loading...
Searching...
No Matches
han_results_print.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4
5#include <cstdlib>
6#include <filesystem>
7#include <iostream>
8#include <string>
9
12
13namespace
14{
15 int usage(const std::string& command_name, int exit_code);
16
17 class CmdLineArgs
18 {
19 public:
20 int parse(int argc, char* argv[]);
21
22 std::string command;
23 std::string hresults;
24 };
25} // unnamed namespace
26
27int main ATLAS_NOT_THREAD_SAFE(int argc, char* argv[]) {
28 CmdLineArgs arg;
29 int rc = arg.parse(argc, argv);
30
31 if (rc != 0) return rc;
32
33 std::string resultsName(arg.hresults);
34
35 if (!std::filesystem::exists(resultsName)) {
36 std::cerr << "File " << resultsName << " does not seem to exist. Exiting" << std::endl;
37 return 1;
38 }
39
40 dqutils::HanOutputFile of(resultsName);
41
43 return 0;
44}
45
46// ************************************************************
47// Private Functions
48// ************************************************************
49
50namespace
51{
52 int usage(const std::string& command_name, int exit_code) {
53 std::string message;
54 message += "\n";
55 message += "This program takes as an argument the name of a \'han\' results\n";
56 message += "file and prints the statuses of all assessments to stdout.\n";
57
58 std::string::size_type s = command_name.size();
59 std::string::size_type p = command_name.rfind('/', s);
60 std::string short_name = command_name.substr(p + 1, s);
61
62 std::cout << "\n";
63 std::cout << "Usage: " << short_name << " <results_file>\n";
64 std::cout << message << "\n";
65 return exit_code;
66 }
67
68 int CmdLineArgs::parse(int argc, char* argv[]) {
69 command = argv[0];
70 if (argc > 2) return usage(command, 1);
71
72 if (argc < 2) return usage(command, 0);
73
74 hresults = argv[1];
75 return 0;
76 }
77} // unnamed namespace
int main(int, char **)
Main class for all the CppUnit test classes.
static Double_t rc
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
virtual void printAllDQAssessments()
std::map< std::string, std::string > parse(const std::string &list)
StatusCode usage()