00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PCAP_FRAME_ITERATOR_HH_
00023 # define PCAP_FRAME_ITERATOR_HH_
00024
00025 # include <istream>
00026
00027 # include <wipal/pcap/frame_descriptor.hh>
00028 # include <wipal/pcap/descriptor.hh>
00029 # include <wipal/tool/valued_iterator.hh>
00030
00031
00032
00033
00034
00035
00036 namespace pcapxx
00037 {
00038
00039 template <class>
00040 struct descriptor;
00041
00043 namespace internals
00044 {
00045
00046 template <class, class>
00047 struct frame_iterator;
00048
00049 }
00050
00051 }
00052
00053
00054
00055
00056
00057
00058 namespace tool
00059 {
00060
00062 template <class D, class B>
00063 struct types< pcapxx::internals::frame_iterator<D, B> >
00064 {
00065 typedef pcapxx::frame_descriptor<D> value_type;
00066 typedef D iterable_type;
00067 };
00068
00069 }
00070
00071
00072
00073
00074
00075 namespace pcapxx
00076 {
00077 namespace internals
00078 {
00079
00081 template <class Descriptor, class Bottom = tool::bottom>
00082 struct frame_iterator:
00083 public tool::valued_iterator<WP_GET_EXACT(Bottom,
00084 frame_iterator<Descriptor,
00085 Bottom>)>
00086 {
00088
00089 typedef WP_GET_EXACT(Bottom, frame_iterator<Descriptor,
00090 Bottom>) exact_type;
00091 typedef tool::valued_iterator<exact_type> super_type;
00092 typedef WP_TYPE(iterable_type, exact_type) iterable_type;
00093 typedef WP_TYPE(value_type, exact_type) value_type;
00095
00097 frame_iterator(const iterable_type& desc, bool end);
00098
00100 frame_iterator(const iterable_type& desc,
00101 const std::streampos& pos,
00102 unsigned count);
00103
00105 frame_iterator(const frame_iterator&);
00106
00108 frame_iterator& operator = (const frame_iterator&);
00109
00111
00112 bool equal(const frame_iterator& rhs) const;
00113 void increment();
00115
00116 private:
00117
00119 std::istream& stream();
00120
00121
00122
00123
00124
00126 const iterable_type* desc_;
00127
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 std::auto_ptr<std::istream> input_;
00146
00147 std::streampos pos_;
00148 unsigned count_;
00149
00151 };
00152
00153 }
00154
00155 }
00156
00157 # include "frame_iterator.hxx"
00158
00159 #endif // ! PCAP_FRAME_ITERATOR_HH_