Commit 2a9bb575 by maarten

stats werk

git-svn-id: svn+ssh://gitlab/srv/svn-repos/pdb-redo/trunk@191 a1961a4f-ab94-4bcc-80e8-33b5a54de466
parent 821c1ef9
......@@ -95,8 +95,11 @@ class Atom
bool isWater() const;
int charge() const;
boost::any property(const std::string& name) const;
void property(const std::string& name, const boost::any& value);
template<typename T>
T property(const std::string& name) const;
template<typename T>
void property(const std::string& name, const T& value);
// specifications
std::string labelAtomId() const;
......
......@@ -388,11 +388,16 @@ bool Atom::isWater() const
return mImpl->isWater();
}
boost::any Atom::property(const std::string& name) const
template<>
string Atom::property<string>(const std::string& name) const
{
string s = mImpl->mRow[name].as<string>();
return boost::any(s);
return mImpl->mRow[name].as<string>();
}
template<>
float Atom::property<float>(const std::string& name) const
{
return stof(mImpl->mRow[name].as<string>());
}
bool Atom::operator==(const Atom& rhs) const
......@@ -612,7 +617,7 @@ AtomView Structure::waters() const
for (auto& a: mImpl->mAtoms)
{
if (boost::any_cast<string>(a.property("label_entity_id")) == waterEntityId)
if (a.property<string>("label_entity_id") == waterEntityId)
result.push_back(a);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment