Source · fairmq/tools/
runUuidGenerator.cxxsource
Described in Test your devices, Helpers in fair::mq::tools.
1/********************************************************************************2* Copyright (C) 2014-2021 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *3* *4* This software is distributed under the terms of the *5* GNU Lesser General Public Licence (LGPL) version 3, *6* copied verbatim in the file "LICENSE" *7********************************************************************************/8 9#include <fairmq/tools/Unique.h>10 11#include <boost/program_options.hpp>12 13#include <iostream>14#include <string>15 16using namespace std;17using namespace boost::program_options;18 19int main(int argc, char** argv)20{21 try22 {23 bool hash = false;24 25 options_description desc("Options");26 desc.add_options()27 ("hash,h", value<bool>(&hash)->implicit_value(true), "Generates UUID and returns its hash.")28 ("help", "Print help");29 30 variables_map vm;31 store(parse_command_line(argc, argv, desc), vm);32 33 if (vm.count("help"))34 {35 cout << "UUID generator" << endl << desc << endl;36 return 0;37 }38 39 notify(vm);40 41 if (hash)42 {43 std::cout << fair::mq::tools::UuidHash() << std::endl;44 }45 else46 {47 std::cout << fair::mq::tools::Uuid() << std::endl;48 }49 50 return 0;51 }52 catch (exception& e)53 {54 cerr << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" << endl;55 return 2;56 }57 58 return 0;59}