// Basic #include <fstream> #include <iostream> #include <iomanip> #include <string> #include <vector> // Boost #include <boost/program_options.hpp> // Custom #include "BulkDbAccess.h" #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); } fileName = string(argv[1]); vector<string> apdSerials = loadSerialsFromFileName(fileName); AbsDbAccess* _dba = suitedDbAccess(apdSerials.size()); for (size_t i = 0 ; i < apdSerials.size() ; i++ ) { if (apdSerials[i].size() == 9) apdSerials[i] = "0" + apdSerials[i]; if (_dba->apdAvailable( uint( stoul ( apdSerials[i] ) ) ) ) cout << "S/N " << apdSerials[i] << " is in Box " << _dba->box( uint( stoul( apdSerials[i] ) ) ) << " on position " << _dba->pos_in_box( uint( stoul( apdSerials[i] ) ) ) << ", Location: '" << _dba->location( uint( stoul( apdSerials[i] ) ) ) << "'" << endl; else cout << "UNAVAILABLE S/N " << apdSerials[i] << " was assigned to Box " << _dba->box( uint( stoul( apdSerials[i] ) ) ) << " on position " << _dba->pos_in_box( uint( stoul( apdSerials[i] ) ) ) << ", Location: '" << _dba->location( uint( stoul( apdSerials[i] ) ) ) << "'" << endl; } return 0; }