34 #include <boost/algorithm/string.hpp>
35 #include <boost/algorithm/string/predicate.hpp>
43 using namespace boost;
50 split(args, spec, is_any_of(
"\t "));
54 args.erase(args.begin());
57 if (name ==
"uniform")
58 return make_shared<DiscreteRandomGeneratorUniform>();
62 return make_shared<DiscreteRandomGeneratorZipf>();
63 if (starts_with(args[0],
"--s=")) {
64 String s_str = args[0].substr(4);
66 s_val = strtod(s_str.c_str(), 0);
67 return make_shared<DiscreteRandomGeneratorZipf>(s_val);
71 HT_FATALF(
"Unrecognized distribution (%s)", name.c_str());
std::string String
A String is simply a typedef to std::string.
static DiscreteRandomGeneratorPtr create(const String &spec)
Creates a new DiscreteRandomGenerator instance.
Discrete Random Generator creating a zipfian distribution.
std::shared_ptr< DiscreteRandomGenerator > DiscreteRandomGeneratorPtr
Factory for Discrete Random Generators.
Logging routines and macros.
Compatibility Macros for C/C++.
#define HT_FATALF(msg,...)
bool split(int flags)
Tests the SPLIT bit of flags