Generated on Tue Dec 16 13:34:01 2008 for ell-3.0.0 by doxygen 1.5.1

src/ell/IterableNeighbors.hh

Go to the documentation of this file.
00001 #ifndef ITERABLENEIGHBORS_HH_
00002 #define ITERABLENEIGHBORS_HH_
00003 
00004 #include "ell/State.hh"
00005 
00006 namespace ell
00007 {
00008 
00016     class IterableNeighbors
00017     {
00018     public:
00019         
00020         virtual ~IterableNeighbors() {};
00021 
00024         virtual size_t getNeighborNumber(void) const = 0;
00025         
00032         virtual State* getNeighbor(const size_t index, State* neigh) const = 0;
00033         
00042         virtual State* undoNeighborChange(const size_t index, State* const neigh) const = 0;
00043         
00051         virtual State* applyNeighborChange(const size_t index, State* const copy) const = 0;
00052         
00053     }; // class
00054     
00055     
00062     class SuccessiveNeighborList : public State::NeighborList {
00063     
00064     protected:
00065         const IterableNeighbors *source;
00066         
00068         class ItState : public State::NeighborList::ItState {
00069         public:
00070             size_t idx; 
00071             ItState():idx(0) {}
00072             ItState(const ItState &itstate) : idx(itstate.idx) {}
00073             virtual ItState * clone() const { return new ItState(*this); }
00074         };
00075     
00076     public:
00077         SuccessiveNeighborList(const IterableNeighbors* source_);
00078     
00079         virtual ~SuccessiveNeighborList();
00080   
00088         virtual State* 
00089         next(State::NeighborList::ItState *itstate, State* const elem) const;
00090 
00097         virtual State* first(State::NeighborList::ItState** itstate) const;
00098     }; // class 
00099 
00106     class RandomNeighborList : public State::NeighborList {
00107     
00108     protected:
00109         const IterableNeighbors *source;
00110         std::vector<size_t> idx2apply;
00111         
00113         class ItState : public State::NeighborList::ItState {
00114         public:
00115             size_t pos; 
00116             ItState():pos(0) {}
00117             ItState(const ItState &itstate) : pos(itstate.pos) {}
00118             virtual ItState * clone() const { return new ItState(*this); }
00119         };
00120     
00121     public:
00122         RandomNeighborList(const IterableNeighbors* source);
00123     
00124         virtual ~RandomNeighborList();
00125   
00133         virtual State* 
00134         next(State::NeighborList::ItState *itstate, State* elem) const;
00135 
00142         virtual State* first(State::NeighborList::ItState** itstate) const;
00143     }; // class 
00144 
00145 } // namespace ell
00146 
00147 #endif /*ITERABLENEIGHBORS_HH_*/