Created
November 22, 2013 15:53
-
-
Save fishman/7602115 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from /Users/timebomb/Gentoo/usr/include/boost/random.hpp:40: | |
In file included from /Users/timebomb/Gentoo/usr/include/boost/random/lagged_fibonacci.hpp:29: | |
/Users/timebomb/Gentoo/usr/include/boost/random/uniform_01.hpp:94:32: error: no type named | |
'result_type' in 'rise::scenario::pathloss::detail::HashRNG' | |
typedef typename Engine::result_type base_result; | |
~~~~~~~~~~~~~~~~~^~~~~~~~~~~ | |
/Users/timebomb/Gentoo/usr/include/boost/random/normal_distribution.hpp:153:19: note: in instantiation | |
of function template specialization | |
'boost::random::detail::new_uniform_01<double>::operator()<rise::scenario::pathloss::detail::HashRNG>' | |
requested here | |
_r1 = boost::uniform_01<RealType>()(eng); | |
^ | |
framework/rise/src/scenario/pathloss/ITUUMi.cpp:79:24: note: in instantiation of function template | |
specialization | |
'boost::random::normal_distribution<double>::operator()<rise::scenario::pathloss::detail::HashRNG>' | |
requested here | |
sh = shadow(hrng); | |
/******************************************************************************* | |
* This file is part of openWNS (open Wireless Network Simulator) | |
* _____________________________________________________________________________ | |
* | |
* Copyright (C) 2004-2007 | |
* Chair of Communication Networks (ComNets) | |
* Kopernikusstr. 5, D-52074 Aachen, Germany | |
* phone: ++49-241-80-27910, | |
* fax: ++49-241-80-22242 | |
* email: info@openwns.org | |
* www: http://www.openwns.org | |
* _____________________________________________________________________________ | |
* | |
* openWNS is free software; you can redistribute it and/or modify it under the | |
* terms of the GNU Lesser General Public License version 2 as published by the | |
* Free Software Foundation; | |
* | |
* openWNS is distributed in the hope that it will be useful, but WITHOUT ANY | |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
* details. | |
* | |
* You should have received a copy of the GNU Lesser General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
* | |
******************************************************************************/ | |
#ifndef RISE_SCENARIO_PATHLOSS_DETAIL_HASHRNG_HPP | |
#define RISE_SCENARIO_PATHLOSS_DETAIL_HASHRNG_HPP | |
#include <RISE/scenario/pathloss/DistanceDependent.hpp> | |
#include <boost/random.hpp> | |
namespace rise { namespace scenario { namespace pathloss { | |
namespace detail { | |
/** | |
* @brief Helper that can be used as pseudo-random number generator for | |
* boost distributions. This may only be used to draw one random number | |
* from the distribution. DO NOT USE as a random number generator!!! | |
* | |
* @author Daniel Bueltmann <openwns@doender.de> | |
*/ | |
class HashRNG | |
{ | |
public: | |
HashRNG(unsigned int initialSeed, | |
wns::Position p1, | |
wns::Position p2, | |
bool correlateBS, | |
bool correlateUT); | |
static const bool has_fixed_range = true; | |
double | |
operator()(); | |
double | |
min() | |
{ | |
return 0.0; | |
} | |
double | |
max() | |
{ | |
return 1.0; | |
} | |
private: | |
template<typename T> | |
void combine( unsigned int& hash, T t) | |
{ | |
unsigned int* it= (unsigned int*)(&t); | |
assure(sizeof(T) % sizeof(unsigned int) == 0, "Incompatible hash types in HashRNG::combineDouble"); | |
int count = sizeof(T) / sizeof(unsigned int); | |
for (int ii=0; ii < count; ++ii) | |
{ | |
// DJB Hash function | |
hash = ((hash << 5) + hash) + *it; | |
it++; | |
} | |
} | |
boost::mt19937 rng; | |
boost::uniform_real<> uni; | |
boost::variate_generator<boost::mt19937&, boost::uniform_real<> > dis; | |
unsigned int myHash; | |
}; | |
} // detail | |
} // pathloss | |
} // scenario | |
} // rise | |
#endif // RISE_SCENARIO_PATHLOSS_DETAIL_HASHRNG_HPP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment