00001 /*-------------------------------------------------------------------------- 00002 00003 This is part of the Distributed component of the Karoo project. 00004 00005 (C) 2006,2007,2008 Brian Modra <epailty@googlemail.com> 00006 00007 This library is free software; you can redistribute them and/or modify 00008 it under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation; either version 2.1 of the License, 00010 or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 See the GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with these libraries; if not, write to the Free Software Foundation, 00019 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 00021 --------------------------------------------------------------------------*/ 00022 #ifndef uuid_h 00023 #define uuid_h 00024 00025 #ifndef _REENTRANT 00026 #define _REENTRANT 00027 #endif 00028 00029 #include "util.h" 00030 #include <sys/time.h> 00031 #include <stdint.h> 00032 00033 namespace karoo { 00034 00035 extern void initialiseUUID(); 00036 00041 class uuid 00042 { 00043 private: 00044 uint8_t bytes[16]; 00045 mutable char* str; 00046 00047 public: 00051 uuid(); 00055 uuid(uint8_t* bytes); 00062 uuid(const text& str); 00067 uuid(struct timeval tv); 00072 uuid(const uuid& ref); 00073 ~uuid(); 00074 00075 uuid operator=(const uuid& ref); 00076 00081 const char* toString() const; 00082 00086 const uint8_t* getBytes() const { return bytes; } 00087 }; 00088 00089 } 00090 00091 #endif
1.5.8