diff options
author | mutantturkey <mutantturke@gmail.com> | 2012-07-06 18:11:16 -0400 |
---|---|---|
committer | mutantturkey <mutantturke@gmail.com> | 2012-07-06 18:11:16 -0400 |
commit | c96c9c3aacb1f39f6bffa24966801f440d553d48 (patch) | |
tree | dbb0910d21157429297704edaa0bf3b30f017820 /fly-tools/std-deviation | |
parent | 0159be4df05a56d131862e55090aca58b3581017 (diff) |
initial implement of getops, still need to check properly
Diffstat (limited to 'fly-tools/std-deviation')
-rw-r--r-- | fly-tools/std-deviation/StandardDeviation.cpp | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/fly-tools/std-deviation/StandardDeviation.cpp b/fly-tools/std-deviation/StandardDeviation.cpp index 04c301d..da6ed3a 100644 --- a/fly-tools/std-deviation/StandardDeviation.cpp +++ b/fly-tools/std-deviation/StandardDeviation.cpp @@ -10,6 +10,43 @@ vector<double> currentHistogramValues; int main(int argc, char* argv[]) { + int c; + string usage = "standard-deviation -l <list-of-files> -i <input-path> -o <output-file> -t <type>"; + char *inputFileListName; + char *inputPath; + char *outputFileName; + char *distributionType; + string inputFileList; + + while ((c = getopt (argc, argv, "i:o:l:t:h")) != -1) + switch (c) + { + case 'l': + inputFileListName = optarg; + break; + case 'i': + inputPath = optarg; + break; + case 'o': + outputFileName = optarg; + break; + case 't': + distributionType = optarg; + break; + case 'h': + cout << usage << endl; + exit(1); + break; + default: + break; + } + +// if( (inputFileListName == NULL) || (inputPath == NULL) || (distributionType == NULL) || (outputFileName == NULL) ) { +// cerr << usage << endl; +// exit(1); +// } + + // argv[1] input file containing the list of files // argv[2] output file containing the standard deviation and file name pair // argv[3] data file path @@ -20,10 +57,10 @@ int main(int argc, char* argv[]) { exit(1); } - ifstream inputFileNames(argv[1]); - ofstream outputFile(argv[2]); - string prefixPath(argv[3]); - string metricName(argv[4]); + ifstream inputFileNames(inputFileListName); + ofstream outputFile(outputFileName); + string prefixPath(inputPath); + string metricName(distributionType); if (inputFileNames.fail() == true) { cout << "Input File can not be opened"<<endl; @@ -75,7 +112,6 @@ int main(int argc, char* argv[]) { } // standard deviation - standardDev = sumSquaredResults/(N-1); standardDev = sqrt(standardDev); |