00001 00011 #ifndef PREDICATEBASEDCONNECTIONS_H 00012 #define PREDICATEBASEDCONNECTIONS_H 00013 00014 #include "ConnectionIterator.h" 00015 #include "SpatialSimObjectPopulation.h" 00016 #include "ConnectionDecisionPredicate.h" 00017 00018 #include <boost/shared_ptr.hpp> 00019 using boost::shared_ptr; 00020 00022 class PredicateBasedConnections : public ConnectionIterator { 00023 00024 public: 00025 00027 PredicateBasedConnections( shared_ptr<ConnectionDecisionPredicate> predicate ); 00028 00030 PredicateBasedConnections( shared_ptr<ConnectionDecisionPredicate> predicate, MPI::Intracomm const& mpiComm ); 00031 00032 virtual ~PredicateBasedConnections() { /* NOOP */ }; 00033 00034 virtual void init(const SimObjectPopulation &src, const SimObjectPopulation &dst); 00035 00036 virtual void reset(SimObject::ID::SortedVector::const_iterator src_begin, 00037 SimObject::ID::SortedVector::const_iterator src_end, 00038 SimObject::ID::SortedVector::const_iterator dst_begin, 00039 SimObject::ID::SortedVector::const_iterator dst_end); 00040 00041 virtual bool next( pair<SimObject::ID, SimObject::ID> &connection ); 00042 00043 private: 00044 const SimObjectPopulation * src_popul; 00045 const SimObjectPopulation * dst_popul; 00046 00047 int curr_src_idx; 00048 int curr_dst_idx; 00049 00050 int max_src_idx; 00051 int max_dst_idx; 00052 00053 SimObject::ID::SortedVector::const_iterator src_begin_it; 00054 SimObject::ID::SortedVector::const_iterator dst_begin_it; 00055 00056 shared_ptr<ConnectionDecisionPredicate> decision; 00057 }; 00058 00059 #endif