Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JSonDiff.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3#include <fstream>
4
5#include "JSon/JSon.hh"
6#include "JSon/JComparator.hh"
7
8#include "Jeep/JParser.hh"
9#include "Jeep/JMessage.hh"
10
11
12/**
13 * \file
14 *
15 * Auxiliary program to compare (part of) JSon files.
16 * \author mdejong
17 */
18int main(int argc, char **argv)
19{
20 using namespace std;
21 using namespace JPP;
22
23 string ja;
24 string jb;
25 string outputFile;
26 string key;
27 int debug;
28
29 try {
30
31 JParser<> zap("Auxiliary program to compare (part of) JSon files.");
32
33 zap['a'] = make_field(ja);
34 zap['b'] = make_field(jb);
35 zap['o'] = make_field(outputFile) = "";
36 zap['k'] = make_field(key) = "";
37 zap['d'] = make_field(debug) = 1;
38
39 zap(argc, argv);
40 }
41 catch(const exception &error) {
42 FATAL(error.what() << endl);
43 }
44
45 JSON::JComparator compare;
46
47 json js = compare(JSon(ja), JSon(jb), key);
48
49 DEBUG(setw(2) << js << endl);
50
51 if (outputFile != "") {
52
53 ofstream out(outputFile.c_str());
54
55 out << js;
56
57 out.close();
58 }
59
60 return (js.empty() ? 0 : 1);
61}
string outputFile
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
Definition JSonDiff.cc:18
nlohmann::json json
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure to compare (part of) JSon data.
Auxiliary class to load json data from file.
Definition JSon.hh:63