/* * AtomIdDescriptor.cpp * * Created on: Feb 5, 2010 * Author: crueger */ #include "AtomIdDescriptor.hpp" #include "atom.hpp" using namespace std; AtomIdDescriptor::AtomIdDescriptor(int _id) : id(_id) {} AtomIdDescriptor::~AtomIdDescriptor() {} bool AtomIdDescriptor::predicate(std::pair atom) { return atom.second->getId()==id; } AtomDescriptor::desc_ptr AtomIdDescriptor::clone() const{ return desc_ptr(new AtomIdDescriptor(id)); } #if 0 // so far the lookuptable for Atoms-by-id does not work, since atoms don't get an ID upon creation. // instead of this we rely on walking through all atoms. atom *AtomIdDescriptor::find(){ map atoms = getAtoms(); map::iterator res = atoms.find(id); return (res!=atoms.end())?((*res).second):0; } vector AtomIdDescriptor::findAll(){ atom *res = find(); return (res)?(vector(1,res)):(vector()); } #endif