/* * MoleculeIdDescriptor.cpp * * Created on: Feb 5, 2010 * Author: crueger */ #include "Helpers/MemDebug.hpp" #include "MoleculeIdDescriptor.hpp" #include "MoleculeIdDescriptor_impl.hpp" #include "Patterns/ObservedContainer_impl.hpp" #include "molecule.hpp" using namespace std; MoleculeIdDescriptor_impl::MoleculeIdDescriptor_impl(moleculeId_t _id) : id(_id) {} MoleculeIdDescriptor_impl::~MoleculeIdDescriptor_impl() {} bool MoleculeIdDescriptor_impl::predicate(std::pair molecule) { return molecule.first==id; } MoleculeDescriptor MoleculeById(moleculeId_t id){ return MoleculeDescriptor(MoleculeDescriptor::impl_ptr(new MoleculeIdDescriptor_impl(id))); } molecule *MoleculeIdDescriptor_impl::find(){ World::MoleculeSet &molecules = getMolecules(); World::MoleculeSet::iterator res = molecules.find(id); return (res!=molecules.end())?((*res).second):0; } vector MoleculeIdDescriptor_impl::findAll(){ molecule *res = find(); return (res)?(vector(1,res)):(vector()); }