User Manual, Developers Guide and API Documentation

stateval.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef WNS_EVALUATION_STATISTICS_STATEVAL_HPP
00029 #define WNS_EVALUATION_STATISTICS_STATEVAL_HPP
00030 
00031 #include <WNS/PyConfigViewCreator.hpp>
00032 
00033 namespace wns { namespace evaluation { namespace statistics {
00034             template <typename T>
00035             T getMaxError();
00036 
00037             template <>
00038             inline
00039             double getMaxError<double>()
00040             {
00041                 return 0.000000001;
00042             }
00043 
00044             class StatEvalInterface
00045             {
00046             public:
00047                 virtual
00048                 ~StatEvalInterface(){}
00049 
00050                 virtual void
00051                 put(double) = 0;
00052 
00053                 virtual void
00054                 reset() = 0;
00055 
00056                 virtual const std::string&
00057                 getName() const = 0;
00058 
00059                 virtual void
00060                 print(std::ostream&) const = 0;
00061 
00067                 virtual void
00068                 printLog(std::ostream&) = 0;
00069             };
00070 
00074             class StatEval : public StatEvalInterface
00075             {
00076             public:
00080                 enum functionType
00081                 {
00082                     df,
00083                     cdf,
00084                     pf
00085                 };
00086 
00087 
00091                 enum formatType
00092                 {
00093                     fixed,
00094                     scientific
00095                 };
00096 
00097 
00098                 StatEval(formatType  format,
00099                          std::string name,
00100                          std::string desc);
00101 
00102                 StatEval(const wns::pyconfig::View& config);
00103 
00104                 virtual ~StatEval();
00105 
00109                 virtual
00110                 void print(std::ostream& stream) const;
00111 
00112                 virtual void
00113                 printLog(std::ostream& stream);
00114 
00118                 enum statEvalType
00119                 {
00120                     all = 0,
00121                     lref, lreg, plref, plreg,
00122                     moments, pmoments,
00123                     batchMns, pbatchMns,
00124                     histogrm, phistogrm,
00125                     dlref, dlreg, dlrep, pdlref, pdlreg, pdlrep,
00126                     dlref_nonequi, dlreg_nonequi, dlrep_nonequi,
00127                     pdlref_nonequi, pdlreg_nonequi, pdlrep_nonequi,
00128                     pdf, ppdf,
00129                     logeval, plogeval,
00130                     probetext, pprobetext, unknown
00131                 };
00132 
00136                 virtual void
00137                 put(double xI);
00138 
00142                 virtual double
00143                 mean() const;
00144 
00148                 virtual double
00149                 variance() const;
00150 
00154                 virtual double
00155                 relativeVariance() const;
00156 
00160                 virtual double
00161                 coeffOfVariation() const;
00162 
00166                 virtual double
00167                 M2() const;
00168 
00172                 virtual double
00173                 M3() const;
00174 
00178                 virtual double
00179                 Z3() const;
00180 
00184                 virtual double
00185                 skewness() const;
00186 
00190                 virtual double
00191                 deviation() const;
00192 
00196                 virtual double
00197                 relativeDeviation() const;
00198 
00202                 virtual unsigned long int
00203                 trials() const;
00204 
00208                 virtual double
00209                 min() const;
00210 
00214                 virtual double
00215                 max() const;
00216 
00220                 virtual void
00221                 reset();
00222 
00226                 virtual const
00227                 std::string& getName() const;
00228 
00232                 virtual const std::string&
00233                 getDesc() const;
00234 
00238                 virtual void
00239                 setFormat(formatType format);
00240 
00244                 virtual formatType
00245                 getFormat() const;
00246 
00250                 static statEvalType
00251                 mapToStatEvalType(std::string type);
00252 
00253 
00257                 static std::string
00258                 mapEvalTypeToString(statEvalType);
00259 
00260             protected:
00261 
00265                 void
00266                 printBanner(std::ostream& stream    ,
00267                             std::string probeTypeDesc,
00268                             std::string errorString) const;
00269 
00273                 double minValue_;
00274 
00278                 double maxValue_;
00279 
00283                 unsigned long int numTrials_;
00284 
00288                 double sum_;
00289 
00293                 double squareSum_;
00294 
00298                 double cubeSum_;
00299 
00303                 StatEval::formatType format_;
00304 
00308                 std::string name_;
00309 
00313                 std::string desc_;
00314 
00318                 std::string prefix_;
00319 
00323                 double scalingFactor_;
00324             };
00325 
00326 
00327             typedef wns::PyConfigViewCreator<StatEvalInterface, StatEvalInterface> Creator;
00328             typedef wns::StaticFactory<Creator> Factory;
00329 
00330         } // statistics
00331     } //evaluation
00332 } // wns
00333 
00334 #endif  // WNS_EVALUATION_STATISTICS_STATEVAL_HPP

Generated on Sun May 27 03:31:39 2012 for openWNS by  doxygen 1.5.5