Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

UUID.h

Go to the documentation of this file.
00001 /***************************************************************** lm-cpr beg
00002  *
00003  * AI Loom - A cross platform artificial intelligence framework
00004  * AI Loom is (c) Copyright 2003 Josh Brown
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  *
00021  * -----------------------------------------------------------------
00022  * File:          $RCSfile: UUID.h,v $
00023  * Date modified: $Date: 2003/09/30 04:10:23 $
00024  * Version:       $Revision: 1.2 $
00025  * -----------------------------------------------------------------
00026  *
00027  ************************************************************** lm-cpr-end */
00028 #ifndef LM_UUID_H
00029 #define LM_UUID_H
00030 
00031 #include <iostream>
00032 #include <string>
00033 #include "Types.h"
00034 
00035 namespace lm
00036 {
00047    class UUID
00048    {
00049    public:
00051       static const UUID NullUUID;
00052 
00053    public:
00057       UUID();
00058 
00063       UUID(const std::string& uuid);
00064 
00068       UUID(const UUID& uuid);
00069 
00073       UUID& operator=(const UUID& uuid);
00074 
00078       static UUID generate();
00079 
00080    public:
00084       bool isNull() const;
00085 
00089       std::string str() const;
00090 
00091    public:
00095       bool operator==(const UUID& uuid) const;
00096 
00100       bool operator!=(const UUID& uuid) const;
00101 
00105       bool operator<(const UUID& uuid) const;
00106 
00107    private:
00111       void makeFromString(const std::string& uuid);
00112 
00113    private:
00118       union germ_uuid_t
00119       {
00121          struct standard_
00122          {
00123             u32 m0;
00124             u16 m1;
00125             u16 m2;
00126             u8  m3;
00127             u8  m4;
00128             u8  m5[6];
00129          } standard;
00130 
00132          struct packed_
00133          {
00134             u32 p0;
00135             u32 p1;
00136             u32 p2;
00137             u32 p3;
00138          } packed;
00139       };
00140 
00141       germ_uuid_t mUuid;
00142    };
00143 
00147    std::ostream& operator<<(std::ostream& out, const UUID& uuid);
00148 }
00149 
00150 #endif

Generated on Wed Oct 22 21:33:21 2003 for AI Loom by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002