include/wipal/wifi/frame/filter/microseconds_stamper.hh

00001 /*
00002  * WiPal - A library and a set of tools to manipulate wireless traces.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
00021  */
00022 #ifndef WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HH_
00023 # define WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HH_
00024 
00025 # include <wipal/tool/microseconds_stamp.hh>
00026 # include <wipal/tool/valued_iterator.hh>
00027 # include <wipal/wifi/mactime_tracker.hh>
00028 # include <wipal/tool/iterable.hh>
00029 
00030 # include "microseconds_stamper_fwd.hh"
00031 
00032 /*--------------.
00033 | Virtual types |
00034 `--------------*/
00035 
00036 namespace tool
00037 {
00038 
00039   template <class I, class HT, class B1, class B2>
00040   struct types< wifi::frame::filter::internals::
00041                 microseconds_stamper_iterator<I, HT, B1, B2> >
00042   {
00043     typedef wifi::frame::filter::microseconds_stamper<I, HT, B1> iterable_type;
00044     typedef tool::microseconds_stamp<typename I::value_type>     value_type;
00045   };
00046 
00047   template <class I, class HT, class B>
00048   struct types< wifi::frame::filter::microseconds_stamper<I, HT, B> >
00049   {
00050     typedef wifi::frame::filter::internals::
00051       microseconds_stamper_iterator<I, HT, B, bottom>
00052       iterator;
00053   };
00054 
00055 } // End of namespace tool.
00056 
00057 /*-------------.
00058 | Declarations |
00059 `-------------*/
00060 
00061 namespace wifi
00062 {
00063   namespace frame
00064   {
00065     namespace filter
00066     {
00067 
00068       namespace internals
00069       {
00070 
00071         template <class InputIterator,
00072                   class HeaderType,
00073                   class B,
00074                   class Bottom = tool::bottom>
00075         struct microseconds_stamper_iterator:
00076           tt_inherit(public tool::valued_iterator,
00077                      microseconds_stamper_iterator<InputIterator,
00078                                                    HeaderType, B, Bottom>)
00079         {
00081 
00082           typedef tt_get_exact(Bottom,
00083                                microseconds_stamper_iterator<InputIterator,
00084                                                              HeaderType,
00085                                                              B, Bottom>)
00086                                                         exact_type;
00087           typedef tool::valued_iterator<exact_type>     super_type;
00088           typedef tt_type(value_type, exact_type)       value_type;
00089           typedef tt_type(iterable_type, exact_type)    iterable_type;
00091 
00093           microseconds_stamper_iterator(const iterable_type& i, bool end);
00094 
00096 
00097           bool  equal(const microseconds_stamper_iterator& rhs) const;
00098           void  increment();
00100 
00101         private:
00102           const iterable_type*  iterable_;
00103           InputIterator         next_;
00104           mactime_tracker<>     tracker_;
00105         };
00106 
00107       } // End of namespace internals.
00108 
00109       template <class InputIterator,
00110                 class HeaderType,
00111                 class Bottom = tool::bottom>
00112       struct microseconds_stamper:
00113         tt_inherit(public tool::iterable, microseconds_stamper<InputIterator,
00114                                                                HeaderType,
00115                                                                Bottom>)
00116       {
00118         microseconds_stamper(const InputIterator&       first,
00119                              const InputIterator&       last,
00120                              tool::endian::endianness   phy_end);
00121 
00122       private:
00123         InputIterator                   first_;
00124         InputIterator                   last_;
00125         tool::endian::endianness        phy_end_;
00126 
00127         friend
00128           class internals::microseconds_stamper_iterator<InputIterator,
00129                                                          HeaderType,
00130                                                          Bottom, tool::bottom>;
00131       };
00132 
00133     } // End of namespace wifi::frame::filter.
00134 
00135   } // End of namespace wifi::frame.
00136 
00137 } // End of namespace wifi.
00138 
00139 # include "microseconds_stamper.hxx"
00140 
00141 #endif // ! WIFI_FRAME_FILTER_MICROSECONDS_STAMPER_HH_

Generated on Tue Jan 15 19:32:31 2008 for wipal by  doxygen 1.5.4