-// $Id: AliHLTCaloUtilities.cxx 34264 2009-08-14 18:29:23Z odjuvsla $
+// $Id: AliHLTCALOUtilities.cxx 34264 2009-08-14 18:29:23Z odjuvsla $
/**************************************************************************
* This file is property of and copyright by the Experimental Nuclear *
AliHLTCaloUtilities::AliHLTCaloUtilities()
{
- // See header file for documentation
-}
-
-
-AliHLTCaloUtilities::~AliHLTCaloUtilities()
-{
- // See header file for documentation
-}
-
-
-bool
-AliHLTCaloUtilities::ScanSingleIntArgument(int argc, const char** argv, const char *name, int *value)
-{
- // See header file for documentation
- // cout << "AliHLTCaloUtilities::ScanSingleIntArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
- int tmpIndex = DoExistArgument(argc, argv, name);
-
- if( tmpIndex >= 0)
- {
- if(value == 0)
- {
- return true;
- }
-
- else
- {
- if(tmpIndex +1 < argc)
- {
- *value = atoi(argv[tmpIndex +1]);
- return true;
- }
- }
- }
-
- else
- {
- return false;
- }
- return false;
-}
-
-bool
-AliHLTCaloUtilities::ScanSingleFloatArgument(int argc, const char** argv, const char *name, float *value)
-{
- // See header file for documentation
- // cout << "AliHLTCaloUtilities::ScanSingleFloatArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
-
- int tmpIndex = DoExistArgument(argc, argv, name);
-
- if( tmpIndex >= 0)
- {
- if(value == 0)
- {
- return true;
- }
-
- else
- {
- if(tmpIndex +1 < argc)
- {
- *value = atof(argv[tmpIndex +1]);
- return true;
- }
- }
- }
- else
- {
- return false;
- }
- return false;
-}
-
-
-
-bool
-AliHLTCaloUtilities::ScanSingleNameArgument(int argc, const char** argv, const char *name, char *outname)
-{
- // See header file for documentation
- // cout << "AliHLTCaloUtilities::ScanSingleNameArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
- int tmpIndex = DoExistArgument(argc, argv, name);
-
- if( tmpIndex >= 0)
- {
- if(outname == 0)
- {
- return true;
- }
-
- else
- {
- if(tmpIndex +1 < argc)
- {
- // *value = atoi(argv[tmpIndex +1]);
- sprintf(outname, "%s", argv[tmpIndex +1] );
-
- return true;
- }
- }
- }
- else
- {
- return false;
- }
- return false;
}
-bool
-AliHLTCaloUtilities::ScanSingleArgument(int argc, const char** argv, const char *name)
-{
- // See header file for documentation
- // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" = " << DoExistArgument(argc, argv, name) <<endl;
-
- if( DoExistArgument(argc, argv, name) >=0)
- {
- // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" > 0" <<endl;
- return true;
- }
- else
- {
- // cout << "AliHLTCaloUtilities::ScanSingleArgument " << name <<" > 0" <<endl;
- return false;
- }
-
-}
-
-
-
-bool
-AliHLTCaloUtilities::CheckFile(const char *fileName, const char *opt) const
+AliHLTCaloUtilities::~AliHLTCaloUtilities()
{
- //returns true if the file specified by "fileName exists and has acceees rights specified by "opt",
- //returns false if it doesnt exist, or it exists, but doesnt have the access right specified by "opt"
- FILE *fp = fopen(fileName, opt);
- if(fp == 0)
- {
- return false;
- }
- else
- {
- fclose(fp);
- return true;
- }
}
-
-
-int
-AliHLTCaloUtilities::DoExistArgument(const int argc, const char** argv, const char *name) const
-{
- // returns the index if the argument if it exists
- // returns a negative value if it doesnt exist
- string s1;
-
- for(int i= 0; i< argc; i++)
- {
- s1.assign(argv[i]);
-
- if(s1 == name)
- {
- // cout << "AliHLTCaloUtilities::DoExistArgumen , argument = " << name << " Exists" <<endl;
- return i;
- }
- }
-
- // cout << "AliHLTCaloUtilities::DoExistArgumen , argument = " << name << " does not exist " <<endl;
- return -1;
-
-
-}