Main Page | Class Hierarchy | Class List | File List | Class Members

configuration.h

00001 /* 00002 * Copyright (C) 2006 Dip. Ing. dell'Informazione, University of Pisa, Italy 00003 * http://info.iet.unipi.it/~cng/ns2measure/ns2measure.html 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA 00018 */ 00019 00032 #ifndef __MEASURE_CONFIGURATION_H 00033 #define __MEASURE_CONFIGURATION_H 00034 00035 #include <config.h> 00036 #include <object.h> 00037 #include <measure.h> 00038 00039 #include <set> 00040 #include <map> 00041 #include <vector> 00042 00043 #include <iostream> 00044 #include <fstream> 00045 #include <string> 00046 #include <cstdlib> 00047 00049 struct MetricDescAvg { 00050 public: 00052 bool relevant; 00054 bool output; 00056 bool check; 00058 double outCL; 00060 double CL; 00062 double threshold; 00063 00065 MetricDescAvg () : 00066 relevant (false), output (false), check (false) { } 00068 bool isRelevant () const { return relevant; } 00069 }; 00070 00072 struct MetricDescDst { 00073 public: 00075 MetricDescAvg pmf; 00077 MetricDescAvg cdf; 00079 MetricDescAvg mean; 00081 MetricDescAvg median; 00083 MetricDescAvg percentile95; 00085 MetricDescAvg percentile99; 00086 00088 MetricDescDst () { } 00090 bool isRelevant () const { 00091 if ( pmf.relevant == true || cdf.relevant == true || 00092 mean.relevant == true || median.relevant == true || 00093 percentile95.relevant == true || percentile99.relevant == true ) 00094 return true; 00095 return false; 00096 } 00097 }; 00098 00100 class Configuration : public Object { 00102 std::string outputFileName; 00104 unsigned int minReplics; 00106 unsigned int maxReplics; 00108 std::string headerName; 00110 std::string trailerName; 00112 std::map< std::string, std::vector<MetricDescAvg> > avg; 00114 std::map< std::string, std::vector<MetricDescDst> > dst; 00115 00117 00120 void insert (std::string s, unsigned int id, const MetricDescAvg& dsc); 00122 00126 void insert (std::string s, unsigned int id, 00127 std::string what, const MetricDescAvg& dsc); 00128 00130 00136 std::string getNextWord (std::istream& is, bool required = false); 00137 public: 00139 Configuration () : Object ("Configuration"), minReplics(0), maxReplics(0) { } 00141 ~Configuration () { } 00142 00144 void parse (std::string inputFileName); 00145 00147 std::string getOutputFileName () const { return outputFileName; } 00149 unsigned int getMinReplics () const { return minReplics; } 00151 unsigned int getMaxReplics () const { return maxReplics; } 00153 std::string getHeaderName () const { return headerName; } 00155 std::string getTrailerName () const { return trailerName; } 00157 void getDescAvg ( 00158 bool& valid, MetricDescAvg& dsc, // output 00159 std::string s, unsigned int id) { // input 00160 if ( avg.count (s) == 0 || id >= avg[s].size() ) valid = false; 00161 else { valid = true; dsc = avg[s][id]; } } 00163 void getDescDst ( 00164 bool& valid, MetricDescDst& dsc, // output 00165 std::string s, unsigned int id) { // input 00166 if ( dst.count (s) == 0 || id >= dst[s].size() ) valid = false; 00167 else { valid = true; dsc = dst[s][id]; } } 00168 00170 void dump (std::ostream& os); 00171 }; 00172 00173 #endif // __MEASURE_CONFIGURATION_H

Generated on Tue May 30 08:09:56 2006 for ns2measure by doxygen 1.3.7