source: trunk/test/Suite.h @ 3792

Last change on this file since 3792 was 3792, checked in by Peter, 7 months ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 21.7 KB
Line 
1#ifndef _theplu_yat_test_suite_
2#define _theplu_yat_test_suite_
3
4// $Id: Suite.h 3792 2019-04-12 07:15:09Z peter $
5
6/*
7  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018 Peter Johansson
9
10  This file is part of the yat library, http://dev.thep.lu.se/yat
11
12  The yat library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU General Public License as
14  published by the Free Software Foundation; either version 3 of the
15  License, or (at your option) any later version.
16
17  The yat library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  General Public License for more details.
21
22  You should have received a copy of the GNU General Public License
23  along with yat. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26// ensure that config.h always is included first
27#ifndef YAT_VERSION
28#error header 'config.h' not included
29#endif
30
31#include <yat/utility/config_public.h>
32
33#define YAT_TEST_PROLOGUE "\n=== " << __func__ << " ===\n"
34
35// used to tell automake that test should be skipped
36#define EXIT_SKIP 77
37
38// SKIP_BAM_TEST is defined if we should skip bam tests
39#if !defined (YAT_HAVE_LIBBAM) || !defined (HAVE_SAMTOOLS_EXECUTABLE)
40#define SKIP_BAM_TEST
41#endif
42
43#include <yat/utility/VectorMutable.h>
44#include <yat/utility/WeightedIteratorArchetype.h>
45#include <yat/classifier/Target.h>
46
47#include <boost/concept_archetype.hpp>
48#include <boost/concept_check.hpp>
49#include <boost/iterator/iterator_categories.hpp>
50#include <boost/iterator/iterator_concepts.hpp>
51
52#include <iosfwd>
53#include <sstream>
54#include <vector>
55
56namespace theplu {
57namespace yat {
58namespace test {
59
60  /**
61     \internal utility class for tests
62   */
63  class Suite
64  {
65  public:
66    Suite(int argc, char* argv[], bool require_bam=false);
67
68    /**
69     */
70    ~Suite(void);
71
72    /**
73       set ok to 'b && ok'
74
75       \return b
76    */
77    bool add(bool b);
78
79    /**
80       \return In verbose mode std::cerr, else a ofstream to "/dev/null".
81    */
82    std::ostream& err(void) const;
83
84    /**
85       \return true if \f$ |a-b| <= N * \epsilon * min(|a|,|b|) \f$
86       where \f$ \epsilon \f$ is std::numeric_limits<double>().epsilon()
87    */
88    bool equal(double a, double b, unsigned long int N=1);
89
90    /**
91       \return true if |\a a - \a b| <= \a margin
92    */
93    bool equal_fix(double a, double b, double margin=0);
94
95    /**
96       \return true if \f$ |a-b| <= N * sqrt(\epsilon) * min(|a|,|b|) \f$
97       where \f$ \epsilon \f$ is std::numeric_limits<double>().epsilon()
98    */
99    bool equal_sqrt(double a, double b, unsigned long int N=1);
100
101    template<class MATRIX1, class MATRIX2>
102    bool equal_matrix(const MATRIX1& a, const MATRIX2& b,unsigned long int N=1);
103
104    /**
105       apply equal on ranges [first1, last1) and [first2, ...)
106    */
107    template<typename Iterator1, typename Iterator2>
108    bool equal_range(Iterator1 first1, Iterator1 last1, Iterator2 first2,
109                     unsigned int N=1);
110
111    /**
112       apply equal_fix on ranges [first1, last1) and [first2, ...)
113    */
114    template<typename Iterator1, typename Iterator2>
115    bool equal_range_fix(Iterator1 first1, Iterator1 last1, Iterator2 first2,
116                         double margin);
117
118    /**
119      \return true if test is ok
120    */
121    bool ok(void) const;
122
123    /**
124       \return In verbose mode std::cout, else a ofstream to "/dev/null".
125    */
126    std::ostream& out(void) const;
127
128    /**
129       In verbose mode a final message is sent to std::cout.
130
131       If ok() is true: "Test is ok." otherwise
132       "Test failed."
133
134       \return 0 if ok.
135     */
136    int return_value(void) const;
137
138    template<typename TrivialIterator>
139    void test_trivial_iterator(const TrivialIterator&);
140
141    template<typename InputIterator>
142    void test_input_iterator(InputIterator&);
143
144    template<typename OutputIterator>
145    void test_output_iterator(OutputIterator&);
146
147    template<typename ForwardIterator>
148    void test_forward_iterator(ForwardIterator);
149
150    template<typename BidirectionalIterator>
151    void test_bidirectional_iterator(BidirectionalIterator);
152
153    template<typename RandomAccessIterator>
154    void test_random_access_iterator(RandomAccessIterator);
155
156    template<typename Container2D>
157    void test_concept_container2d(const Container2D&);
158
159    template<typename MutableContainer2D>
160    void test_concept_mutable_container2d(MutableContainer2D&);
161
162    /**
163       Function writes to a stream using operator<<, creates a new
164       object using stream constructor, and the new object is written
165       to another stream, and function check if the two outputs are
166       equal.
167    */
168    template<class T>
169    bool test_stream(const T&) const;
170
171    /**
172       This function is similar to add(bool) and could be used to
173       detect/count known issues. When the issue is fixed, one can
174       replace the call to xadd(bool) with a call to add(bool).
175
176       If \a b is false a counter is incremented, which is used to in
177       return_value() to generate some printout on how many known
178       issues were detected.
179
180       If \a b is true, ok_ is set to false, becasue the known issue
181       is no longer an issue and one should replace the call with a
182       call to add(bool).
183     */
184    bool xadd(bool b);
185
186  private:
187    unsigned int known_issues_;
188    bool ok_;
189  };
190
191  /**
192     \return absolute path to test src dir
193  */
194  std::string abs_srcdir(void);
195
196  /**
197     \return absolute path to file
198     \param local_path path relative to srcdir
199   */
200  std::string filename(const std::string& local_path);
201
202  /*
203    class to test (at compile time) that a function (or class) works
204    with a Container2D. Do not run any test using this class because
205    the class is not really functional at run time.
206
207    \see boost/concept_archetype.hpp
208   */
209  template<typename T>
210  class container2d_archetype
211  {
212  public:
213    typedef T value_type;
214    typedef const T& const_reference;
215    typedef const T* const_iterator;
216    typedef const_iterator const_column_iterator;
217    typedef const_iterator const_row_iterator;
218    const_iterator begin(void) const { return &element_; }
219    const_column_iterator begin_column(size_t) const { return &element_; }
220    const_iterator begin_row(size_t) const { return &element_; }
221    const_iterator end(void) const { return NULL; }
222    const_column_iterator end_column(size_t) const { return NULL; }
223    const_iterator end_row(size_t) const { return NULL; }
224    size_t columns(void) const { return 0; }
225    size_t rows(void) const { return 0; }
226    const_reference operator()(size_t row, size_t column) const
227    { return element_; }
228
229  protected:
230    T element_;
231  };
232
233  /*
234    class to test (at compile time) that a function (or class) works
235    with a MutableContainer2D. Do not run any test using this class because
236    the class is not really functional at run time.
237
238    \see boost/concept_archetype.hpp
239   */
240  template<typename T>
241  class mutable_container2d_archetype : public container2d_archetype<T>
242  {
243  public:
244    typedef T& reference;
245    typedef T* iterator;
246    typedef iterator column_iterator;
247    typedef iterator row_iterator;
248    iterator begin(void) { return &this->element_; }
249    column_iterator begin_column(size_t) { return &this->element_; }
250    iterator begin_row(size_t) { return &this->element_; }
251    iterator end(void) { return NULL; }
252    column_iterator end_column(size_t) { return NULL; }
253    iterator end_row(size_t) { return NULL; }
254    reference operator()(size_t row, size_t column)
255    { return this->element_; }
256  };
257
258  /*
259    class to test (at compile time) that a function (or class) works
260    with a Distance. Do not run any test using this class because
261    the class is not really functional at run time.
262
263    \see boost/concept_archetype.hpp
264   */
265  class distance_archetype
266  {
267  public:
268    /// class must be constructible somehow, but we don't wanna assume
269    /// void constructor or any other common constructor so we use the
270    /// signature to allow construction without assuming too much.
271    distance_archetype(const boost::detail::dummy_constructor&) {};
272    distance_archetype(const distance_archetype&) {};
273    template<typename T1, typename T2>
274    double operator()(T1 first1, T1 last1, T2 first2) const { return 0.0; }
275  private:
276    distance_archetype(void);
277    distance_archetype& operator=(const distance_archetype&);
278  };
279
280  /*
281    class to test (at compile time) that a function (or class) works
282    with a NeighborWeighting. Do not run any test using this class because
283    the class is not really functional at run time.
284
285    \see boost/concept_archetype.hpp
286   */
287  class neighbor_weighting_archetype
288  {
289  public:
290    neighbor_weighting_archetype(void) {}
291    void operator()(const utility::VectorBase& distance,
292                    const std::vector<size_t>& k_sorted,
293                    const classifier::Target& target,
294                    utility::VectorMutable& prediction) const {}
295    neighbor_weighting_archetype& operator=(const neighbor_weighting_archetype&)
296    { return *this; }
297  private:
298    neighbor_weighting_archetype(const neighbor_weighting_archetype&) {};
299  };
300
301
302  // compilation tests on iterators
303
304  template<typename Iterator>
305  void test_readable_iterator(Iterator iterator)
306  {
307    BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<Iterator>));
308  }
309
310
311  template<typename Iterator>
312  void test_writable_iterator(Iterator iterator)
313  {
314    BOOST_CONCEPT_ASSERT((boost_concepts::WritableIterator<Iterator>));
315  }
316
317
318  template<typename Iterator>
319  void test_swappable_iterator(Iterator iterator)
320  {
321    BOOST_CONCEPT_ASSERT((boost_concepts::SwappableIterator<Iterator>));
322  }
323
324  template<typename Iterator>
325  void test_lvalue_iterator(Iterator iterator)
326  {
327    BOOST_CONCEPT_ASSERT((boost_concepts::LvalueIterator<Iterator>));
328  }
329
330  template<typename Iterator>
331  void test_incrementable_iterator(Iterator iterator)
332  {
333    BOOST_CONCEPT_ASSERT((boost_concepts::IncrementableIterator<Iterator>));
334  }
335
336  template<typename Iterator>
337  void test_single_pass_iterator(Iterator iterator)
338  {
339    BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<Iterator>));
340  }
341
342
343  template<typename Iterator>
344  void test_forward_traversal_iterator(Iterator iterator)
345  {
346    BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>));
347  }
348
349
350  template<typename Iterator>
351  void test_bidirectional_traversal_iterator(Iterator iterator)
352  {
353    BOOST_CONCEPT_ASSERT((boost_concepts::BidirectionalTraversal<Iterator>));
354  }
355
356
357  template<typename Iterator>
358  void test_random_access_traversal_iterator(Iterator iterator)
359  {
360    BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>));
361  }
362
363
364  // This function pulls out the iterator_category and checks that the
365  // iterator has implemented what is promised in the category.
366  //
367  // Likewise it pulls out the boost::iterator_traversal type and
368  // checks that the traversal is implemented as promised.
369  //
370  // Iterator is a model of input iterator (output iterator makes no
371  // sense as a const iterator)
372  template<typename Iterator>
373  void test_const_iterator(Iterator iterator);
374
375
376  // Similar to test_const_iterator but function also works for
377  // output_iterator and it tests that the iterator is mutable.
378  template<typename Iterator>
379  void test_mutable_iterator(Iterator iterator);
380
381  // functions used by test_const_iterator and test_mutable_iterator
382  namespace detail {
383
384    template<typename Iterator>
385    void test_iterator_traversal(Iterator iterator,
386                                 boost::incrementable_traversal_tag tag)
387    {
388      test_incrementable_iterator(iterator);
389    }
390
391
392    template<typename Iterator>
393    void test_iterator_traversal(Iterator iterator,
394                                 boost::single_pass_traversal_tag tag)
395    {
396      test_single_pass_iterator(iterator);
397    }
398
399
400    template<typename Iterator>
401    void test_iterator_traversal(Iterator iterator,
402                                 boost::forward_traversal_tag tag)
403    {
404      test_forward_traversal_iterator(iterator);
405    }
406
407
408    template<typename Iterator>
409    void test_iterator_traversal(Iterator iterator,
410                                 boost::bidirectional_traversal_tag tag)
411    {
412      test_bidirectional_traversal_iterator(iterator);
413    }
414
415
416    template<typename Iterator>
417    void test_iterator_traversal(Iterator iterator,
418                                 boost::random_access_traversal_tag tag)
419    {
420      test_random_access_traversal_iterator(iterator);
421    }
422
423
424    template<typename Iterator>
425    void test_iterator(Iterator iterator, std::forward_iterator_tag tag)
426    {
427      test_lvalue_iterator(iterator);
428      test_iterator(iterator);
429    }
430
431
432    template<typename Iterator>
433    void test_iterator(Iterator iterator, std::bidirectional_iterator_tag tag)
434    {
435      test_lvalue_iterator(iterator);
436      test_iterator(iterator);
437    }
438
439
440    template<typename Iterator>
441    void test_iterator(Iterator iterator, std::random_access_iterator_tag tag)
442    {
443      test_lvalue_iterator(iterator);
444      test_iterator(iterator);
445    }
446
447
448    // testing forward iterator (or bidirectional or random access)
449    template<typename Iterator>
450    void test_iterator(Iterator iterator)
451    {
452      typename boost::iterator_category<Iterator>::type tag;
453      test_iterator(iterator, tag);
454      typename boost::iterator_traversal<Iterator>::type trav_tag;
455      test_iterator_traversal(iterator, trav_tag);
456    }
457
458
459    template<typename Iterator>
460    void test_mutable_iterator(Iterator iterator, std::output_iterator_tag tag)
461    {
462      test_incrementable_iterator(iterator);
463    }
464
465
466    template<typename Iterator>
467    void test_mutable_iterator(Iterator iterator, std::input_iterator_tag tag)
468    {
469      test_single_pass_iterator(iterator);
470    }
471
472
473    template<typename Iterator>
474    void test_mutable_iterator(Iterator iterator, std::forward_iterator_tag tag)
475    {
476      test_lvalue_iterator(iterator);
477      test_iterator(iterator);
478    }
479
480
481    template<typename Iterator>
482    void test_const_iterator(Iterator iterator, std::input_iterator_tag tag)
483    {
484      test_single_pass_iterator(iterator);
485      test_readable_iterator(iterator);
486    }
487
488
489    template<typename Iterator>
490    void test_const_iterator(Iterator iterator, std::forward_iterator_tag tag)
491    {
492      test_lvalue_iterator(iterator);
493      test_iterator(iterator);
494    }
495
496
497  } // end of namespace detail
498
499
500  // template implementations
501
502  template<class MATRIX1, class MATRIX2>
503  bool Suite::equal_matrix(const MATRIX1& a, const MATRIX2& b,
504                           unsigned long int N)
505  {
506    if (a.rows() != b.rows() || a.columns() != b.columns()) {
507      err() << "incorrect dimensions: "
508            << a.rows() << " x " << a.columns() << " : "
509            << b.rows() << " x " << b.columns() << "\n";
510      return false;
511    }
512    for (size_t i=0; i<a.rows(); ++i)
513      for (size_t j=0; j<a.columns(); ++j)
514        if (!equal(a(i,j), b(i,j), N)) {
515          err() << "  Matrix comparison: row: " << i << " column: " << j
516                << "\n";
517          return false;
518        }
519    return true;
520  }
521
522
523  template<typename Iterator1, typename Iterator2>
524  bool Suite::equal_range(Iterator1 first1, Iterator1 last1, Iterator2 first2,
525                          unsigned int N)
526  {
527    while (first1!=last1){
528      if (!this->equal(*first1, *first2, N) )  {
529        return false;
530      }
531      ++first1;
532      ++first2;
533    }
534    return true;
535  }
536
537
538  template<typename Iterator1, typename Iterator2>
539  bool Suite::equal_range_fix(Iterator1 first1, Iterator1 last1, 
540                              Iterator2 first2, double margin)
541  {
542    while (first1!=last1){
543      if (!this->equal_fix(*first1, *first2, margin) )   {
544        return false;
545      }
546      ++first1;
547      ++first2;
548    }
549    return true;
550  }
551
552
553  // return true if we can write to a write-protected file
554  bool run_as_root(void);
555
556  // function that can be used to avoid warning: '-Wunused-but-set-variable'
557  template<typename T>
558  void avoid_compiler_warning(T) {}
559
560  template<class T>
561  bool Suite::test_stream(const T& t) const
562  {
563    this->err() << "Checking that output stream is valid as an input stream\n";
564    std::stringstream ss;
565    this->err() << "writing to output\n";
566    ss << t;
567    this->err() << "creating a new object from output\n";
568    T t2(ss);
569    std::stringstream ss2;
570    this->err() << "writing to output\n";
571    ss2 << t2;
572    bool ok = ss2.str()==ss.str();
573    if (!ok) {
574      this->err() << "ERROR: first object gave following output:\n"
575                  << ss.str() << "\n"
576                  << "ERROR: and second object gave following output:\n"
577                  << ss2.str() << "\n";
578    }
579    return ok;
580  }
581
582  template<typename TrivialIterator>
583  void Suite::test_trivial_iterator(const TrivialIterator& iter)
584  {
585    err() << "  testing Trivial features" << std::endl;
586    typename std::iterator_traits<TrivialIterator>::value_type tmp = *iter;
587    add(tmp==*iter);
588    TrivialIterator default_constructed;
589    avoid_compiler_warning(default_constructed);
590  }
591
592  template<typename InputIterator>
593  void Suite::test_input_iterator(InputIterator& iter)
594  {
595    BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>));
596    test_trivial_iterator(iter);
597    err() << "  testing Input features" << std::endl;
598    // just to check compilation
599    if (false) {
600      ++iter;
601      iter++;
602    }
603  }
604
605  template<typename OutputIterator>
606  void Suite::test_output_iterator(OutputIterator& iter)
607  {
608    err() << "  testing Output features" << std::endl;
609    // OutputIterator should be default constructible and assignable
610    OutputIterator oi;
611    oi = iter;
612    ++oi;
613  }
614
615  template<typename ForwardIterator>
616  void Suite::test_forward_iterator(ForwardIterator iter)
617  {
618    BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIterator>));
619    test_output_iterator(iter);
620    test_input_iterator(iter);
621    err() << "  testing Forward features" << std::endl;
622
623    typename std::iterator_traits<ForwardIterator>::value_type tmp = *iter;
624    // testing multiple traversing is possible and does not change the data
625    ForwardIterator iter1 = iter;
626    ++iter1;
627    add(iter!=iter1);
628    ForwardIterator iter2 = iter;
629    ++iter2;
630    add(tmp==*iter);
631  }
632
633  template<typename BidirectionalIterator>
634  void Suite::test_bidirectional_iterator(BidirectionalIterator iter)
635  {
636    BOOST_CONCEPT_ASSERT((boost::BidirectionalIterator<BidirectionalIterator>));
637    test_forward_iterator(iter);
638    bool ok_cached = ok();
639    err() << "  testing Bidirectional features" << std::endl;
640    const BidirectionalIterator i = iter;
641    BidirectionalIterator tmp = iter++;
642    if (!add(tmp==i)) {
643      err() << "iter++ does not return iter\n";
644    }
645    if (!add(++tmp==iter)) {
646      err() << "++iter failed\n";
647    }
648    if (!add(--tmp==i)) {
649      err() << "--iter failed\n";
650    }
651    tmp = iter--;
652    if (!add(--tmp==iter))
653      err() << "iter-- failed" << std::endl;
654    if (ok_cached && !ok())
655      err() << "failed" << std::endl;
656  }
657
658  template<typename RandomAccessIterator>
659  void Suite::test_random_access_iterator(RandomAccessIterator iter)
660  {
661    BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator>));
662    test_bidirectional_iterator(iter);
663    err() << "  testing RandomAccess features" << std::endl;
664    bool ok_cached = ok();
665    RandomAccessIterator iter2 = iter;
666    iter2 += 1;
667    iter2 -= 1;
668    RandomAccessIterator& iter3 = (iter2 += 1);
669    RandomAccessIterator& iter4 = (iter3 -= 1);
670    if (!add(iter2 == iter4))
671      err() << "operator-(int) failed" << std::endl;
672    add(++iter2 == iter3);
673
674    RandomAccessIterator iter5 = iter + 0;
675    RandomAccessIterator iter6 = 0 + iter;
676    add(iter6 == iter5);
677
678    RandomAccessIterator iter7 = iter - 0;
679    add(iter7 == iter);
680    add(iter7 - iter == 0);
681    add(! (iter7<iter));
682
683    typename RandomAccessIterator::value_type tmp = iter[0];
684    typename RandomAccessIterator::value_type tmp2 = *iter;
685    tmp = tmp; // avoid compiler warning
686    if (!add(tmp == tmp2))
687      err() << "operator[] failed" << std::endl;
688    if (!add(iter[0] == *iter))
689      err() << "operator[] failed" << std::endl;
690    if (ok_cached && !ok())
691      err() << "failed" << std::endl;
692  }
693
694  template<typename Container2D>
695  void Suite::test_concept_container2d(const Container2D& c)
696  {
697    typedef typename Container2D::value_type value_type;
698    typedef typename Container2D::const_reference const_reference;
699    typedef typename Container2D::const_iterator const_iterator;
700    typedef typename Container2D::const_column_iterator const_column_iterator;
701    typedef typename Container2D::const_row_iterator const_row_iterator;
702    const_iterator ci = c.begin();
703    const_column_iterator cci = c.begin_column(0);
704    const_row_iterator cri = c.begin_row(0);
705    ci = c.end();
706    cci = c.end_column(0);
707    cri = c.end_row(0);
708    size_t cols = c.columns();
709    size_t rows = c.rows();
710    // just to avoid compiler warning
711    avoid_compiler_warning(cols);
712    avoid_compiler_warning(rows);
713    const_reference x = c(0,0);
714    value_type y;
715    y = x;
716    avoid_compiler_warning(y);
717  }
718
719  template<typename MutableContainer2D>
720  void Suite::test_concept_mutable_container2d(MutableContainer2D& mc)
721  {
722    test_concept_container2d(mc);
723    typedef typename MutableContainer2D::reference reference;
724    typedef typename MutableContainer2D::iterator iterator;
725    typedef typename MutableContainer2D::column_iterator column_iterator;
726    typedef typename MutableContainer2D::row_iterator row_iterator;
727    iterator i = mc.begin();
728    column_iterator ci = mc.begin_column(0);
729    row_iterator ri = mc.begin_row(0);
730    *i = *ci;
731    *ci = *i;
732    *ri = *i;
733    i = mc.end();
734    ci = mc.end_column(0);
735    ri = mc.end_row(0);
736    reference x = mc(0,0);
737    x = *mc.begin();
738  }
739
740
741  template<typename Iterator>
742  void test_const_iterator(Iterator iterator)
743  {
744    typename boost::iterator_category<Iterator>::type tag;
745    detail::test_const_iterator(iterator, tag);
746  }
747
748
749  template<typename Iterator>
750  void test_mutable_iterator(Iterator iterator)
751  {
752    typename boost::iterator_category<Iterator>::type tag;
753    detail::test_mutable_iterator(iterator, tag);
754    test_writable_iterator(iterator);
755  }
756
757
758  // For convenience to create data iterator. This class typedefs four
759  // classes that can be conveniently constructed in tests
760  // (const/mutable and weighted/unweighted. Traversal
761  // is expected to be one of:
762  //// boost::incrementable_traversal_tag (problematic with unweighted)
763  // boost::single_pass_traversal_tag (problematic with unweighted)
764  // boost::forward_traversal_tag
765  // boost::bidirectional_traversal_tag
766  // boost::random_access_traversal_tag
767  template<typename Traversal>
768  struct DataIterator
769  {
770    typedef boost::iterator_archetype<
771      double,
772      boost::iterator_archetypes::readable_iterator_t,
773      Traversal
774      > unweighted_const_iterator;
775
776    typedef boost::iterator_archetype<
777      double,
778      boost::iterator_archetypes::readable_writable_iterator_t,
779      Traversal
780      > unweighted_iterator;
781
782
783    typedef utility::WeightedIteratorArchetype<
784      boost::iterator_archetypes::readable_iterator_t, Traversal
785      >
786    weighted_const_iterator;
787
788    typedef utility::WeightedIteratorArchetype<
789      boost::iterator_archetypes::readable_writable_iterator_t,
790      Traversal
791      >
792    weighted_iterator;
793  };
794}}}
795
796#endif
Note: See TracBrowser for help on using the repository browser.