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 ...@@ -95,8 +95,11 @@ class Atom
bool isWater() const; bool isWater() const;
int charge() const; int charge() const;
boost::any property(const std::string& name) const; template<typename T>
void property(const std::string& name, const boost::any& value); T property(const std::string& name) const;
template<typename T>
void property(const std::string& name, const T& value);
// specifications // specifications
std::string labelAtomId() const; std::string labelAtomId() const;
......
...@@ -388,11 +388,16 @@ bool Atom::isWater() const ...@@ -388,11 +388,16 @@ bool Atom::isWater() const
return mImpl->isWater(); 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 mImpl->mRow[name].as<string>();
}
return boost::any(s);
template<>
float Atom::property<float>(const std::string& name) const
{
return stof(mImpl->mRow[name].as<string>());
} }
bool Atom::operator==(const Atom& rhs) const bool Atom::operator==(const Atom& rhs) const
...@@ -612,7 +617,7 @@ AtomView Structure::waters() const ...@@ -612,7 +617,7 @@ AtomView Structure::waters() const
for (auto& a: mImpl->mAtoms) 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); 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