testCmd.cc
// -*- C++ -*-
// $Id: testCmd.cc,v 1.6 1998/12/05 18:31:18 evc Exp $
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// This is a small program for testing the HepCmdLine class.
//
#define HEP_SHORT_NAMES
#include "CLHEP/String/CmdLine.h"
#include "CLHEP/config/iostream.h"
int main(int argc, char **argv)
{
CmdLine cmd(argc,argv);
CmdArgInt nevents('n',"nevents","count","Number of Events",1);
CmdArgFloat cut(0,"cut","mass","phi mass cut",0.2);
CmdArgString filename('i',"file","filename","Input filename");
CmdArgBoolean flag('x',"flag","A flag");
CmdArgFloat cut2('c',"","mass","Short arg only",0.2);
CmdArgInt n2("n2", "Positional Integer");
CmdArgString s1("s1", "Positional String", "fred");
cmd.append(&nevents,&cut,&filename,&flag,&cut2,0);
cmd.append(&n2,&s1,0);
cmd.parse();
std::cout << "Number of events is " << nevents << std::endl;
std::cout << "Mass cut is " << cut << std::endl;
std::cout << "The flag is now " << (HepBoolean)flag << std::endl;
if ((const char *)filename == 0)
std::cout << "No file specified" << std::endl;
else
std::cout << "Input file is " << filename << std::endl;
std::cout << "Cut2 is " << cut2 << std::endl;
std::cout << "Positional n2 = " << n2 << std::endl;
std::cout << "Positional s1 = " << s1 << std::endl;
return 0;
}
Generated by GNU enscript 1.6.1.