Add boolean and integer types to AnyMap
This commit is contained in:
parent
c85ba586d2
commit
7fab7f3cd3
2 changed files with 25 additions and 1 deletions
|
|
@ -85,6 +85,10 @@ public:
|
|||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
AnyValue& operator=(const char* value) {
|
||||
m_value = std::string(value);
|
||||
return *this;
|
||||
}
|
||||
const std::string& asString() const {
|
||||
return as<std::string>();
|
||||
}
|
||||
|
|
@ -97,6 +101,26 @@ public:
|
|||
return as<double>();
|
||||
}
|
||||
|
||||
AnyValue& operator=(bool value) {
|
||||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
bool asBool() const {
|
||||
return as<bool>();
|
||||
}
|
||||
|
||||
AnyValue& operator=(long int value) {
|
||||
m_value = value;
|
||||
return *this;
|
||||
}
|
||||
AnyValue& operator=(int value) {
|
||||
m_value = static_cast<long int>(value);
|
||||
return *this;
|
||||
}
|
||||
long int asInt() const {
|
||||
return as<long int>();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
AnyValue& operator=(const std::vector<T>& value) {
|
||||
m_value = value;
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ TEST(DebyeHuckel, fromScratch)
|
|||
sOH->extra["ionic_radius"] = 3.5e-10;
|
||||
auto sNaCl = make_species("NaCl(aq)", "Na:1, Cl:1", -96.03e6*4.184,
|
||||
298.15, -174.5057463, 333.15, -174.5057463);
|
||||
sNaCl->extra["weak_acid_charge"] = -1;
|
||||
sNaCl->extra["weak_acid_charge"] = -1.0;
|
||||
sNaCl->extra["electrolyte_species_type"] = "weakAcidAssociated";
|
||||
for (auto& s : {sH2O, sNa, sCl, sH, sOH, sNaCl}) {
|
||||
p.addSpecies(s);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue