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_STATS_EPOCH_TRACKER_HH_
00023 # define WIFI_FRAME_STATS_EPOCH_TRACKER_HH_
00024
00025 # include <vector>
00026
00027 # include <boost/optional.hpp>
00028
00029 # include <wipal/tool/microseconds.hh>
00030
00031 namespace wifi
00032 {
00033
00034 namespace frame
00035 {
00036
00037 namespace stats
00038 {
00039
00040 template <class T, unsigned EpochLength>
00041 struct epoch_tracker
00042 {
00043 epoch_tracker();
00044
00045 void restart();
00046 bool update(const tool::microseconds& timestamp);
00047 const std::vector<T>& epochs() const;
00048 std::vector<T>& epochs();
00049 const T& current() const;
00050 T& current();
00051
00052 private:
00053 std::vector<T> epochs_;
00054 boost::optional<tool::microseconds> epoch_start_;
00055 unsigned epoch_idx_;
00056 };
00057
00058 }
00059
00060 }
00061
00062 }
00063
00064 # include "epoch_tracker.hxx"
00065
00066 #endif // ! WIFI_FRAME_STATS_EPOCH_TRACKER_HH_