25#include "calibUtil/Metadata.h"
35 std::cout <<
"Invoke as follows: " << std::endl;
36 std::cout <<
"calibCoverage calibtype instrument flavor level start db"
38 std::cout <<
"All arguments but the first are optional. Defaults are: " << std::endl;
39 std::cout <<
"instrument = 'LAT'" << std::endl;
40 std::cout <<
"flavor = 'vanilla'" << std::endl;
41 std::cout <<
"level = 'PROD'" << std::endl;
42 std::cout <<
"start = '1970-1-1 00:00'" << std::endl;
43 std::cout <<
"db = 'calib'" << std::endl;
52int main(
int argc,
char* argv[]) {
66 std::string dbname =
"calib";
68 std::string defValue =
"*";
71 if ((argv[6]) !=
"*") dbname = std::string(argv[6]);
73 Metadata*
meta =
new Metadata(defValue, defValue, dbname);
76 std::cerr <<
"Unable to construct calibUtil::Metadata object "<< std::endl;
81 bool ok =
meta->connectRead(ret);
84 std::cerr <<
"Connection to metadata dbs failed with return code "
91 std::string instr(
"LAT");
92 std::string flavor(
"vanilla");
93 std::string level(
"PROD");
99 if (!strcmp(argv[2],
"*")) instr = std::string(argv[2]);
101 if (!strcmp(argv[3],
"*")) flavor = std::string(argv[3]);
103 if (!strcmp(argv[4],
"*")) level = std::string(argv[4]);
109 ts = Timestamp(std::string(argv[5]));
112 std::cerr <<
"Caught facilities::BadTimeInput exception with complaint "
113 << ex.
complaint << std::endl <<
"Exiting..." << std::endl;
118 else ts = Timestamp(0,0);
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;
142 std::vector<std::string> calibTypes;
147 std::string arg1(argv[1]);
153 for (
unsigned i = 0; i < calibTypes.size(); i++) {
154 unsigned ret = cov.
checkType(calibTypes[i]);
156 std::cerr <<
"Type " << calibTypes[i] <<
" failed with return code "
160 std::cout <<
"Type " << calibTypes[i] <<
" ok in metadata database "
unsigned checkType(std::string calibtype)
bool expandTypes(std::string &nickname, std::vector< std::string > &types)
std::vector< std::string > StringVector