From 234aac3fc9a34389859b0aab5ac042032b8db8f7 Mon Sep 17 00:00:00 2001 From: Jan Reher <jreher@ep1.rub.de> Date: Thu, 14 Nov 2019 17:31:14 +0100 Subject: [PATCH] Added program to query the batch (before and after irradiation) of a list of APDs. --- getbatch.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 getbatch.cpp diff --git a/getbatch.cpp b/getbatch.cpp new file mode 100644 index 0000000..ae1ae29 --- /dev/null +++ b/getbatch.cpp @@ -0,0 +1,41 @@ +// Basic +#include <fstream> +#include <iostream> +#include <iomanip> +#include <string> +#include <vector> + +// Boost +#include <boost/program_options.hpp> + +// Custom +#include "ProdDbAccess.h" +#include "toolbox.cpp" + +using namespace std; +namespace po = boost::program_options; + +static string fileName = "serials.dat"; + +int main(int argc, char* argv[]) { + if ( argc < 2 ) { + cerr << "ERROR: Missing parameters! Please provide the name of a text file containing the serials needed." << endl; + exit(1); + } + if ( argc > 2 ) { + cerr << "ERROR: Too many parameters! Please only provide the name of a text file containing the serials needed." << endl; + exit(1); + } + ProdDbAccess* _dba = new ProdDbAccess(); + + fileName = string(argv[1]); + + vector<string> apdSerials = loadSerialsFromFileName(fileName); + + for (size_t i = 0 ; i < apdSerials.size() ; i++ ) { + if (apdSerials[i].size() == 9) apdSerials[i] = "0" + apdSerials[i]; + cout << "S/N: " << apdSerials[i] << " New: " << _dba->getBatchNew( uint( stoul( apdSerials[i] ) ) ) << " Old: " << _dba->getBatchIrr( uint( stoul( apdSerials[i] ) ) ) << endl; + } + + return 0; +} -- GitLab