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>
00047 struct frame_iterator;
00048
00049 }
00050
00051 }
00052
00053
00054
00055
00056
00057
00058 namespace tool
00059 {
00060
00062 template <class B>
00063 struct types< pcapxx::internals::frame_iterator<B> >
00064 {
00065 typedef pcapxx::frame_descriptor value_type;
00066 typedef pcapxx::descriptor<bottom> iterable_type;
00067 };
00068
00069 }
00070
00071
00072
00073
00074
00075 namespace pcapxx
00076 {
00077 namespace internals
00078 {
00079
00081 template <class Bottom = tool::bottom>
00082 struct frame_iterator:
00083 wp_inherit(public tool::valued_iterator, frame_iterator<Bottom>)
00084 {
00086
00087 typedef wp_get_exact(Bottom, frame_iterator<Bottom>) exact_type;
00088 typedef tool::valued_iterator<exact_type> super_type;
00089 typedef wp_type(iterable_type, exact_type) iterable_type;
00090 typedef wp_type(value_type, exact_type) value_type;
00092
00094 frame_iterator(const iterable_type& desc, bool end);
00095
00097 frame_iterator(const iterable_type& desc,
00098 const std::streampos& pos,
00099 unsigned count);
00100
00102 frame_iterator(const frame_iterator&);
00103
00105 frame_iterator& operator = (const frame_iterator&);
00106
00108
00109 bool equal(const frame_iterator& rhs) const;
00110 void increment();
00112
00113 private:
00114
00116 std::istream& stream();
00117
00118
00119
00120
00121
00123 const iterable_type* desc_;
00124
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142 std::auto_ptr<std::istream> input_;
00143
00144 std::streampos pos_;
00145 unsigned count_;
00146
00148 };
00149
00150 }
00151
00152 }
00153
00154 # include "frame_iterator.hxx"
00155
00156 #endif // ! PCAP_FRAME_ITERATOR_HH_