/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * AtomIdDescriptor.cpp * * Created on: Feb 5, 2010 * Author: crueger */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "AtomIdDescriptor.hpp" #include "AtomIdDescriptor_impl.hpp" #include "atom.hpp" #include "CodePatterns/ObservedContainer_impl.hpp" using namespace std; AtomIdDescriptor_impl::AtomIdDescriptor_impl(atomId_t _id) : id(_id) {} AtomIdDescriptor_impl::~AtomIdDescriptor_impl() {} bool AtomIdDescriptor_impl::predicate(std::pair atom) { return atom.first==id; } AtomDescriptor AtomById(atomId_t id){ return AtomDescriptor(AtomDescriptor::impl_ptr(new AtomIdDescriptor_impl(id))); } atom *AtomIdDescriptor_impl::find(){ World::AtomSet &atoms = getAtoms(); World::AtomSet::iterator res = atoms.find(id); return (res!=atoms.end())?((*res).second):0; } vector AtomIdDescriptor_impl::findAll(){ atom *res = find(); return (res)?(vector(1,res)):(vector()); }