1 #ifndef _theplu_yat_utility_weighted_iterator_archetype
2 #define _theplu_yat_utility_weighted_iterator_archetype
25 #include <yat/utility/DataWeight.h>
26 #include <yat/utility/DataWeightProxy.h>
28 #include <boost/iterator/iterator_archetypes.hpp>
29 #include <boost/iterator/iterator_concepts.hpp>
30 #include <boost/iterator/iterator_facade.hpp>
47 namespace weighted_iterator_archetype {
53 template<
class AccessCategory>
struct Reference {};
57 struct Reference<boost::iterator_archetypes::readable_iterator_t>
59 typedef const utility::DataWeightProxy<const double*, const double*> type;
65 struct Reference<boost::iterator_archetypes::readable_writable_iterator_t>
67 typedef utility::DataWeightProxy<double*, double*> type;
74 template<
class TraversalCategory>
struct Difference {};
80 struct Difference<boost::incrementable_traversal_tag>
81 {
typedef bogus type; };
84 struct Difference<boost::single_pass_traversal_tag>
85 {
typedef bogus type; };
88 struct Difference<boost::forward_traversal_tag>
89 {
typedef int type; };
92 struct Difference<boost::bidirectional_traversal_tag>
93 {
typedef int type; };
96 struct Difference<boost::random_access_traversal_tag>
97 {
typedef int type; };
132 template<
typename AccessCategory,
typename TraversalCategory>
134 :
public boost::iterator_facade<
135 WeightedIteratorArchetype<AccessCategory, TraversalCategory>
138 , typename detail::weighted_iterator_archetype::Reference<AccessCategory>::type
139 , typename detail::weighted_iterator_archetype::Difference<TraversalCategory>::type>
171 friend class boost::iterator_core_access;
173 typename detail::weighted_iterator_archetype::Reference<AccessCategory>::type
174 dereference(
void)
const
175 {
return typename detail::weighted_iterator_archetype::Reference<AccessCategory>::type(NULL, NULL); }
178 bool equal(
const me& other)
const
179 { is_single_pass(TraversalCategory());
return true; }
182 void increment(
void) {}
186 { is_bidirectional(TraversalCategory()); }
189 int distance_to(
const me& other)
const
190 { is_random(TraversalCategory());
return 0; }
193 void advance(
int) { is_random(TraversalCategory()); }
195 void is_single_pass(boost::single_pass_traversal_tag)
const {}
196 void is_forward(boost::forward_traversal_tag)
const {}
197 void is_bidirectional(boost::bidirectional_traversal_tag)
const {}
198 void is_random(boost::random_access_traversal_tag)
const {}
202 #endif // end namspace theplu yat and utility
WeightedIteratorArchetype(WeightedIteratorArchetype_ctor_arg arg)
Constructor.
Definition: WeightedIteratorArchetype.h:158
WeightedIteratorArchetype(void)
Default Constructor.
Definition: WeightedIteratorArchetype.h:149
Definition: WeightedIteratorArchetype.h:42
Definition: WeightedIteratorArchetype.h:133
WeightedIteratorArchetype(const WeightedIteratorArchetype< boost::iterator_archetypes::readable_writable_iterator_t, TraversalCategory > &other)
Definition: WeightedIteratorArchetype.h:167