26{
29
31 string usr;
32 string pwd;
33 string cookie;
34 string id;
35 int run;
37
38 try {
39
40 JParser<> zap(
"Auxiliary program to print firmware vesion.");
41
46 zap[
'D'] =
make_field(
id,
"detector identifier") =
"";
49
50 zap(argc, argv);
51 }
52 catch(const exception &error) {
53 FATAL(error.what() << endl);
54 }
55
56
57 try {
58 JDB::reset(usr, pwd, cookie);
59 }
60 catch(const exception& error) {
61 FATAL(error.what() << endl);
62 }
63
64 const string detid = getDetector<string>(id);
65
67
68 try {
69
71
72 if (! (rs >> clbmap)) {
74 }
75
76 rs.Close();
77 }
78 catch(const exception& error) {
79 FATAL(
"Detector " << detid <<
" - " << error.what() << endl);
80 }
81
82 if (clbmap.empty()) {
83 FATAL(
"Detector " << detid <<
" - " <<
" no data." << endl);
84 }
85
86
88
89 try {
90
91 JSelector selection(&JDatalogNumbers::PARAMETER_NAME, "BUILD*");
92
94
95 ResultSet& rs =
getResultSet(getTable<JDatalogNumbers>(), selection);
96
98
99 const int value = (int) parameters.DATA_VALUE;
100
101 if (value != 0) {
102
103 const size_t ls[] = {
104 parameters.PARAMETER_NAME.find('['),
105 parameters.PARAMETER_NAME.find(']')
106 };
107
109
110 string& version = zmap[parameters.SOURCE_NAME];
111
112 size_t index;
113
114 istringstream(parameters.PARAMETER_NAME.substr(
ls[0] + 1,
ls[1] -
ls[0] + 1)) >> index;
115
116 if (version.size() <= index) {
117 version.append(index - version.size() + 1, ' ');
118 }
119
120 DEBUG(parameters.PARAMETER_NAME <<
' ' <<
ls[0] <<
' ' <<
ls[1] <<
' ' << index <<
' ' << value << endl);
121
122 version[index] = (char) value;
123 }
124 }
125 }
126
127 rs.Close();
128 }
129 catch(const exception& error) {
130 FATAL(error.what() << endl);
131 }
132
133
134 const struct {
135 bool operator()(
const JCLBMap& first,
const JCLBMap& second)
const
136 {
139 else
141 }
142 } compare;
143
144
145 sort(clbmap.begin(), clbmap.end(), compare);
146
147 for (const auto& i : clbmap) {
148 cout <<
"Firmware: " <<
FILL(4,
'0') << i.DUID <<
'.' <<
FILL(2,
'0') << i.FLOORID <<
" " << setw(24) << left << i.UPI <<
" \"" << zmap[i.UPI.toString()] <<
"\"" << right << endl;
149 }
150
151 return 0;
152}
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for sequence of same character.
Wrapper class for server name.
Template definition for getting table specific selector.
Auxiliary data structure to list files in directory.