Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef WEIGHTED_ATOM_ITERATOR_H
00036 #define WEIGHTED_ATOM_ITERATOR_H
00037
00038 #include <ESBTL/iterators.h>
00039
00040
00041
00042
00043 namespace ESBTL{
00044
00045
00057 template <class Model,class Weighted_atom,class Weight_functor>
00058 class Weighted_atom_iterator:
00059 public boost::iterator_facade<
00060 Weighted_atom_iterator<Model,Weighted_atom,Weight_functor>,
00061 Weighted_atom,
00062 boost::forward_traversal_tag,
00063 Weighted_atom >
00064 {
00065 private:
00066 typedef typename Model::System::Atom Atom;
00067
00068 public:
00069
00075 template<class Functor_parameters>
00076 Weighted_atom_iterator(typename Model::Atoms_const_iterator it,Functor_parameters params):atom_iterator(it),weight(params){}
00077
00078 private:
00079 friend class boost::iterator_core_access;
00080
00081 void increment(){
00082 ++atom_iterator;
00083 }
00084
00085 bool equal(Weighted_atom_iterator const& other) const{
00086 return atom_iterator==other.atom_iterator;
00087 }
00088
00089 Weighted_atom dereference() const {
00090 return Weighted_atom(*atom_iterator,weight(*atom_iterator));
00091 }
00092
00093
00094 typename Model::Atoms_const_iterator atom_iterator;
00095 Weight_functor weight;
00096 };
00097
00098 }
00099
00100 #endif //WEIGHTED_ATOM_ITERATOR_H