source: molecuilder/src/Descriptors/AtomIdDescriptor.cpp@ e65cc0

Last change on this file since e65cc0 was 98a2987, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added -Wall flag and fixed several small hickups

  • Property mode set to 100644
File size: 853 bytes
RevLine 
[86b917]1/*
2 * AtomIdDescriptor.cpp
3 *
4 * Created on: Feb 5, 2010
5 * Author: crueger
6 */
7
8#include "AtomIdDescriptor.hpp"
[323177]9#include "AtomIdDescriptor_impl.hpp"
[86b917]10
11#include "atom.hpp"
12
13using namespace std;
14
[323177]15
[33bc66]16AtomIdDescriptor_impl::AtomIdDescriptor_impl(atomId_t _id) :
[86b917]17 id(_id)
18{}
19
[323177]20AtomIdDescriptor_impl::~AtomIdDescriptor_impl()
[86b917]21{}
22
[98a2987]23bool AtomIdDescriptor_impl::predicate(std::pair<atomId_t,atom*> atom) {
[e7e088]24 return atom.first==id;
[973c03]25}
26
[33bc66]27AtomDescriptor AtomById(atomId_t id){
[323177]28 return AtomDescriptor(AtomDescriptor::impl_ptr(new AtomIdDescriptor_impl(id)));
[973c03]29}
30
[e7e088]31atom *AtomIdDescriptor_impl::find(){
[33bc66]32 World::AtomSet atoms = getAtoms();
33 World::AtomSet::iterator res = atoms.find(id);
[86b917]34 return (res!=atoms.end())?((*res).second):0;
35}
36
[e7e088]37vector<atom*> AtomIdDescriptor_impl::findAll(){
[86b917]38 atom *res = find();
39 return (res)?(vector<atom*>(1,res)):(vector<atom*>());
40}
Note: See TracBrowser for help on using the repository browser.