00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FILTER_TIMETRACKER_HH_
00023 # define FILTER_TIMETRACKER_HH_
00024
00025 # include <wipal/tool/microseconds_stamp.hh>
00026 # include <wipal/tool/valued_iterator.hh>
00027 # include <wipal/phy/timetracker.hh>
00028 # include <wipal/tool/iterable.hh>
00029
00030 # include "timetracker_fwd.hh"
00031
00032 namespace wpl
00033 {
00034
00035
00036
00037
00038
00039 namespace tool
00040 {
00041
00042 template <class I, class HT, class B1, class B2>
00043 struct types< filter::internals::timetracker_iterator<I, HT, B1, B2> >
00044 {
00045 typedef filter::timetracker<I, HT, B1> iterable_type;
00046 typedef microseconds_stamp<typename I::value_type> value_type;
00047 };
00048
00049 template <class I, class HT, class B>
00050 struct types< filter::timetracker<I, HT, B> >
00051 {
00052 typedef
00053 filter::internals::timetracker_iterator<I, HT, B, bottom>
00054 iterator;
00055 };
00056
00057 }
00058
00059
00060
00061
00062
00063 namespace filter
00064 {
00065
00066 namespace internals
00067 {
00068
00069 template <class InputIterator,
00070 class HeaderType,
00071 class B,
00072 class Bottom = tool::bottom>
00073 struct timetracker_iterator:
00074 WP_INHERIT(public tool::valued_iterator,
00075 timetracker_iterator<InputIterator, HeaderType, B, Bottom>)
00076 {
00078
00079 typedef WP_GET_EXACT(Bottom, timetracker_iterator<InputIterator,
00080 HeaderType, B,
00081 Bottom>)
00082 exact_type;
00083 typedef tool::valued_iterator<exact_type> super_type;
00084 typedef WP_TYPE(value_type, exact_type) value_type;
00085 typedef WP_TYPE(iterable_type, exact_type) iterable_type;
00087
00089 timetracker_iterator(const iterable_type& i, bool end);
00090
00092
00093 bool equal(const timetracker_iterator& rhs) const;
00094 void increment();
00096
00097 private:
00098 const iterable_type* iterable_;
00099 InputIterator next_;
00100 phy::timetracker<> tracker_;
00101 };
00102
00103 }
00104
00105 template <class InputIterator,
00106 class HeaderType,
00107 class Bottom = tool::bottom>
00108 struct timetracker:
00109 WP_INHERIT(public tool::iterable, timetracker<InputIterator,
00110 HeaderType,
00111 Bottom>)
00112 {
00114 timetracker(const InputIterator& first,
00115 const InputIterator& last,
00116 tool::end::endianness phy_end = tool::end::guess,
00117 bool pcap_tstamps = false);
00118
00119 private:
00120 InputIterator first_;
00121 InputIterator last_;
00122 tool::end::endianness phy_end_;
00123 bool pcap_tstamps_;
00124
00125 friend
00126 class internals::timetracker_iterator<InputIterator, HeaderType,
00127 Bottom, tool::bottom>;
00128 };
00129
00130 }
00131
00132 }
00133
00134 # include "timetracker.hxx"
00135
00136 #endif // ! FILTER_TIMETRACKER_HH_