00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HXX_
00023 # define WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HXX_
00024
00025 # include "microseconds_stamper.hh"
00026
00027 namespace wifi
00028 {
00029 namespace frame
00030 {
00031 namespace filter
00032 {
00033
00034 namespace internals
00035 {
00036
00037 template <class I, class HT, class B1, class B2>
00038 microseconds_stamper_iterator<I, HT, B1, B2>::
00039 microseconds_stamper_iterator(const iterable_type& i, bool end):
00040 iterable_ (&i),
00041 next_ (end ? i.last_ : i.first_),
00042 tracker_ (i.pcap_tstamps_)
00043 {
00044 if (not end)
00045 increment();
00046 }
00047
00048 template <class I, class HT, class B1, class B2>
00049 bool
00050 microseconds_stamper_iterator<I, HT, B1, B2>::
00051 equal(const microseconds_stamper_iterator& rhs) const
00052 {
00053 if (not rhs.value())
00054 return not this->value();
00055
00056 const bool r (next_ == rhs.next_);
00057
00058 assert(not r or
00059 tracker_.microseconds() == rhs.tracker_.microseconds());
00060
00061 return r;
00062 }
00063
00064 template <class I, class HT, class B1, class B2>
00065 void
00066 microseconds_stamper_iterator<I, HT, B1, B2>::increment()
00067 {
00068 if (next_ == iterable_->last_)
00069 {
00070 this->value() = boost::none_t ();
00071 return;
00072 }
00073
00074 tracker_.tick<HT>(*next_, iterable_->phy_end_);
00075 this->value() = value_type (tracker_.microseconds(), *next_);
00076 ++next_;
00077 }
00078
00079 }
00080
00081 template <class I, class HT, class B>
00082 microseconds_stamper<I, HT, B>::
00083 microseconds_stamper(const I& first,
00084 const I& last,
00085 tool::endian::endianness phy_end,
00086 bool pcap_tstamps):
00087 first_ (first),
00088 last_ (last),
00089 phy_end_ (phy_end),
00090 pcap_tstamps_ (pcap_tstamps)
00091 {
00092 }
00093
00094 }
00095
00096 }
00097
00098 }
00099
00100 #endif // ! WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HXX_