include/wipal/wifi/timestamp.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_TIMESTAMP_HH_
00023 # define WIFI_TIMESTAMP_HH_
00024 
00025 # include <boost/array.hpp>
00026 
00027 extern "C"
00028 {
00029 # include <inttypes.h>
00030 }
00031 
00032 # include <ostream>
00033 
00034 # include <wipal/tool/hash.hh>
00035 
00036 namespace wifi
00037 {
00038 
00040   struct timestamp
00041   {
00042     enum { size = 8 };
00043 
00045     timestamp();
00046 
00048     timestamp(uint32_t hi, uint32_t lo);
00049 
00051 
00052     bool                operator == (const timestamp&) const;
00053     bool                operator != (const timestamp&) const;
00054     bool                operator < (const timestamp&) const;
00056 
00058     std::ostream&       print(std::ostream&) const;
00059 
00061     size_t              hash() const;
00062 
00063   private:
00064     typedef boost::array<uint8_t, size> digits_t;
00065 
00066     digits_t            digits_;
00067   };
00068 
00070   std::ostream&
00071   operator << (std::ostream&, const timestamp&);
00072 
00073 } // End of namespace wifi.
00074 
00075 HASH_NAMESPACE_BEGIN
00076 
00077   template <>
00078   struct hash<wifi::timestamp>
00079   {
00080     size_t      operator () (const wifi::timestamp&) const;
00081   };
00082 
00083 HASH_NAMESPACE_END
00084 
00085 # include "timestamp.hxx"
00086 
00087 #endif // ! WIFI_TIMESTAMP_HH_

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