Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Descriptors/AtomDescriptor.cpp

    r112b09 r8cce2b  
    1212
    1313#include "World.hpp"
    14 
    1514#include "atom.hpp"
     15#include "Patterns/ObservedContainer_impl.hpp"
    1616
    1717#include <boost/bind.hpp>
    18 #include <cassert>
     18
    1919#include <iostream>
    2020
    2121using namespace std;
    2222
    23 typedef World::AtomSet::iterator atoms_iter_t;
     23typedef World::AtomSet::internal_iterator atoms_iter_t;
    2424
    2525/************************ Forwarding object **************************************/
     
    7474
    7575atom* AtomDescriptor_impl::find() {
    76   World::AtomSet atoms = getAtoms();
    77   atoms_iter_t res = find_if(atoms.begin(),atoms.end(),boost::bind(&AtomDescriptor_impl::predicate,this,_1));
    78   return (res!=atoms.end())?((*res).second):0;
     76  World::AtomSet &atoms = getAtoms();
     77  atoms_iter_t res = find_if(atoms.begin_internal(),atoms.end_internal(),boost::bind(&AtomDescriptor_impl::predicate,this,_1));
     78  return (res!=atoms.end_internal())?((*res).second):0;
    7979}
    8080
     
    8282  vector<atom*> res;
    8383  World::AtomSet atoms = getAtoms();
    84   atoms_iter_t iter;
    85   for(iter=atoms.begin();iter!=atoms.end();++iter) {
    86     if(predicate(*iter)){
    87       res.push_back((*iter).second);
    88     }
     84  for_each(atoms.begin_internal(),
     85           atoms.end_internal(),
     86           boost::bind(&AtomDescriptor_impl::checkAndAdd,
     87                       this,&res,_1));
     88  return res;
     89}
     90
     91void AtomDescriptor_impl::checkAndAdd(std::vector<atom*> *v,std::pair<atomId_t,atom*> p){
     92  if(predicate(p)){
     93    v->push_back(p.second);
    8994  }
    90   return res;
    9195}
    9296
Note: See TracChangeset for help on using the changeset viewer.