52 {
53
56
57 if (argc < 2) {
59 exit(0);
60 }
61
62
63
64
65
66 std::string dbname = "calib";
67
68 std::string defValue = "*";
69
70 if (argc > 6) {
71 if ((argv[6]) != "*") dbname = std::string(argv[6]);
72 }
73 Metadata*
meta =
new Metadata(defValue, defValue, dbname);
74
75 if (!meta) {
76 std::cerr << "Unable to construct calibUtil::Metadata object "<< std::endl;
77 std::cerr.flush();
78 exit(1);
79 }
80 Metadata::eRet ret;
81 bool ok =
meta->connectRead(ret);
82
83 if (!ok) {
84 std::cerr << "Connection to metadata dbs failed with return code "
85 << ret << std::endl;
86 std::cerr.flush();
87 exit(1);
88 }
90
91 std::string instr("LAT");
92 std::string flavor("vanilla");
93 std::string level("PROD");
94
95 Timestamp ts;
96
97
98 if (argc > 2) {
99 if (!strcmp(argv[2], "*")) instr = std::string(argv[2]);
100 if (argc > 3) {
101 if (!strcmp(argv[3], "*")) flavor = std::string(argv[3]);
102 if (argc > 4) {
103 if (!strcmp(argv[4], "*")) level = std::string(argv[4]);
104 }
105 }
106 }
107 if (argc > 5) {
108 try {
109 ts = Timestamp(std::string(argv[5]));
110 }
112 std::cerr << "Caught facilities::BadTimeInput exception with complaint "
113 << ex.
complaint << std::endl <<
"Exiting..." << std::endl;
114 std::cerr.flush();
115 exit(1);
116 }
117 }
118 else ts = Timestamp(0,0);
119
120
121
122 if (rdb) {
125 cols.reserve(2);
126 vals.reserve(2);
127
128 cols.push_back(std::string("instrument"));
129 vals.push_back(instr);
130 cols.push_back(std::string("proc_level"));
131 vals.push_back(level);
132 if (!(
meta->checkValues(cols, vals))) {
133 std::cout << "Non-standard value for instrument or level. " << std::endl;
134 std::cout << "Supplied values were " << instr <<", " << level
135 << ", respectively." << std::endl;
136 }
137 }
138
139 Coverage cov(meta, instr, flavor, level, ts);
140
141
142 std::vector<std::string> calibTypes;
143
144
145
146
147 std::string arg1(argv[1]);
148 bool expanded = cov.expandTypes(arg1, calibTypes);
149 if (!expanded) {
150 exit(1);
151 }
152
153 for (unsigned i = 0; i < calibTypes.size(); i++) {
154 unsigned ret = cov.checkType(calibTypes[i]);
155 if (ret > 0) {
156 std::cerr << "Type " << calibTypes[i] << " failed with return code "
157 << ret << std::endl;
158 }
159 else {
160 std::cout << "Type " << calibTypes[i] << " ok in metadata database "
161 << std::endl;
162 }
163 }
164 return 0;
165}
std::vector< std::string > StringVector