Clean up types

This commit is contained in:
Lukas Joswiak 2021-08-23 10:57:46 -07:00
parent 8c9f99d402
commit e2d897a2c2
2 changed files with 11 additions and 11 deletions

View File

@ -357,35 +357,35 @@ bool Knobs::isAtomic(std::string const& knob) const {
void Knobs::initKnob(double& knob, double value, std::string const& name, Atomic atomic) {
if (!explicitlySetKnobs.count(toLower(name))) {
knob = value;
double_knobs[toLower(name)] = KnobValue<double*>{ &knob, atomic };
double_knobs[toLower(name)] = KnobValue<double>{ &knob, atomic };
}
}
void Knobs::initKnob(int64_t& knob, int64_t value, std::string const& name, Atomic atomic) {
if (!explicitlySetKnobs.count(toLower(name))) {
knob = value;
int64_knobs[toLower(name)] = KnobValue<int64_t*>{ &knob, atomic };
int64_knobs[toLower(name)] = KnobValue<int64_t>{ &knob, atomic };
}
}
void Knobs::initKnob(int& knob, int value, std::string const& name, Atomic atomic) {
if (!explicitlySetKnobs.count(toLower(name))) {
knob = value;
int_knobs[toLower(name)] = KnobValue<int*>{ &knob, atomic };
int_knobs[toLower(name)] = KnobValue<int>{ &knob, atomic };
}
}
void Knobs::initKnob(std::string& knob, const std::string& value, const std::string& name, Atomic atomic) {
if (!explicitlySetKnobs.count(toLower(name))) {
knob = value;
string_knobs[toLower(name)] = KnobValue<std::string*>{ &knob, atomic };
string_knobs[toLower(name)] = KnobValue<std::string>{ &knob, atomic };
}
}
void Knobs::initKnob(bool& knob, bool value, std::string const& name, Atomic atomic) {
if (!explicitlySetKnobs.count(toLower(name))) {
knob = value;
bool_knobs[toLower(name)] = KnobValue<bool*>{ &knob, atomic };
bool_knobs[toLower(name)] = KnobValue<bool>{ &knob, atomic };
}
}

View File

@ -49,7 +49,7 @@ class Knobs {
protected:
template <class T>
struct KnobValue {
T value;
T* value;
Atomic atomic;
};
@ -62,11 +62,11 @@ protected:
void initKnob(std::string& knob, const std::string& value, const std::string& name, Atomic atomic = Atomic::YES);
void initKnob(bool& knob, bool value, std::string const& name, Atomic atomic = Atomic::YES);
std::map<std::string, KnobValue<double*>> double_knobs;
std::map<std::string, KnobValue<int64_t*>> int64_knobs;
std::map<std::string, KnobValue<int*>> int_knobs;
std::map<std::string, KnobValue<std::string*>> string_knobs;
std::map<std::string, KnobValue<bool*>> bool_knobs;
std::map<std::string, KnobValue<double>> double_knobs;
std::map<std::string, KnobValue<int64_t>> int64_knobs;
std::map<std::string, KnobValue<int>> int_knobs;
std::map<std::string, KnobValue<std::string>> string_knobs;
std::map<std::string, KnobValue<bool>> bool_knobs;
std::set<std::string> explicitlySetKnobs;
public: