![]() |
User Manual, Developers Guide and API Documentation |
![]() |
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_DISTRIBUTION_DISTRIBUTION_HPP 00029 #define WNS_DISTRIBUTION_DISTRIBUTION_HPP 00030 00031 #include <WNS/PyConfigViewCreator.hpp> 00032 #include <WNS/distribution/RNGConfigCreator.hpp> 00033 #include <WNS/pyconfig/View.hpp> 00034 #include <WNS/StaticFactory.hpp> 00035 #include <WNS/simulator/Simulator.hpp> 00036 #include <WNS/rng/RNGen.hpp> 00037 #include <WNS/logger/Logger.hpp> 00038 00039 00040 #include <sstream> 00041 00042 namespace wns { namespace distribution { 00043 00049 class Distribution 00050 { 00051 public: 00052 Distribution() : 00053 rng_(wns::simulator::getRNG()) 00054 {}; 00055 00056 Distribution(wns::rng::RNGen* rng) : 00057 rng_(rng) 00058 {}; 00059 00060 virtual 00061 ~Distribution() 00062 {}; 00063 00068 virtual double 00069 operator()() = 0; 00070 00071 friend std::ostream& 00072 operator <<(std::ostream& os, const Distribution& d) 00073 { 00074 os << d.paramString(); 00075 return os; 00076 }; 00077 00078 protected: 00079 00080 wns::rng::RNGen* 00081 getRNG() 00082 { 00083 return rng_; 00084 }; 00085 00086 private: 00091 virtual std::string 00092 paramString() const = 0; 00093 00094 wns::rng::RNGen* rng_; 00095 00096 }; // Distribution 00097 00098 typedef PyConfigViewCreator<Distribution> DistributionCreator; 00099 typedef StaticFactory<DistributionCreator> DistributionFactory; 00100 00101 typedef RNGConfigCreator<Distribution> RNGDistributionCreator; 00102 typedef StaticFactory<RNGDistributionCreator> RNGDistributionFactory; 00103 00110 class IHasMean 00111 { 00112 public: 00113 00117 virtual double 00118 getMean() const = 0; 00119 }; 00120 } // distribution 00121 } // wns 00122 00123 #endif // NOT defined WNS_DISTRIBUTION_DISTRIBUTION_HPP 00124 00125 /* 00126 Local Variables: 00127 mode: c++ 00128 fill-column: 80 00129 c-basic-offset: 8 00130 c-comment-only-line-offset: 0 00131 c-tab-always-indent: t 00132 indent-tabs-mode: t 00133 tab-width: 8 00134 End: 00135 */ 00136
1.5.5