[Saga-devel] saga SVN commit 3388: /trunk/

hkaiser at cct.lsu.edu hkaiser at cct.lsu.edu
Sat Jan 24 21:58:01 CST 2009


User: hkaiser
Date: 2009/01/24 09:58 PM

Added:
 /trunk/external/boost/uuid/
 /trunk/external/boost/uuid/boost/
 /trunk/external/boost/uuid/boost/uuid/
  seed_rng.hpp, sha1.hpp, uuid.hpp, uuid.ipp, uuid_serialize.hpp
 /trunk/external/boost/uuid/libs/
 /trunk/external/boost/uuid/libs/uuid/
  index.html, uuid.html
 /trunk/external/boost/uuid/libs/uuid/test/
  Jamfile.v2, compile_uuid_header.cpp, test_serialization.cpp, test_sha1.cpp, test_uuid.cpp, test_wserialization.cpp

Removed:
 /trunk/saga/impl/engine/uuid/

Modified:
 /trunk/project/VS.NET/saga_engine/
  saga_engine.vcproj
 /trunk/saga/impl/engine/
  Makefile, uuid.hpp

Log:
 Replaced UUID generator with new boost::uuids package.
 Make-system needs (partial) adjustment, still.

File Changes:

Directory: /trunk/saga/impl/engine/
===================================

File [modified]: Makefile
Delta lines: +0 -6
===================================================================
--- trunk/saga/impl/engine/Makefile	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/saga/impl/engine/Makefile	2009-01-25 03:57:51 UTC (rev 3388)
@@ -29,12 +29,6 @@
 SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/safe_getenv.o
 SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/runtime.o
 SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/ini/ini.o
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid.o
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid_mac.o    
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid_md5.o    
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid_prng.o   
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid_str.o    
-SAGA_TMP_LIB_OBJ += $(SAGA_ROOT)/saga/impl/engine/uuid/saga_uuid_ui64.o   
 
 # remove ini_test (contains main() )
 SAGA_LIB_OBJ     += $(filter-out $(SAGA_ROOT)/impl/engine/ini/ini_test.o,$(SAGA_TMP_LIB_OBJ))

File [modified]: uuid.hpp
Delta lines: +44 -162
===================================================================
--- trunk/saga/impl/engine/uuid.hpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/saga/impl/engine/uuid.hpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -10,10 +10,11 @@
 #include <iosfwd>
 
 #include <boost/thread.hpp>
+#include <boost/uuid/uuid.hpp>
 
 #include <saga/saga/util.hpp>
 #include <saga/saga/exception.hpp>
-#include <saga/impl/engine/uuid/saga_uuid.h>
+// #include <saga/impl/engine/uuid/saga_uuid.h>
 #include <saga/impl/exception.hpp>
 
 // FIXME: impl should only get pulled in cpp -- move implementation of methods
@@ -26,7 +27,7 @@
 class uuid 
 {
   private:
-    mutable saga_uuid_t* uuid_;
+    mutable boost::uuids::uuid uuid_;
 
 // protect access to uuid_create_... functions
   protected:
@@ -35,9 +36,15 @@
         static boost::mutex mutex;
         return mutex;
     }
+    static boost::uuids::uuid_generator& uuid_generator_instance()
+    {
+        static boost::uuids::uuid_generator gen;
+        return gen;
+    }
     static void mutex_init()
     {
         mutex_instance();
+        uuid_generator_instance();
     }
     static void initialize_mutex()
     {
@@ -46,216 +53,91 @@
     }
 
   public:
-    uuid (void) : uuid_(NULL)
+    uuid (void) 
     {
-//       create ();
     }
 
-    uuid (char const * uuid_str) : uuid_(NULL)
+    uuid (char const * uuid_str)  
     {
-      create (uuid_str);
+        create (uuid_str);
     }
 
     ~uuid()
     {
-      saga_uuid_destroy (uuid_);
     }
-    
+
     void ensure_is_initialized() const
     {
-      if (!uuid_)
-        create();
-        
-      if (!uuid_)
-      {
-        SAGA_THROW_NO_OBJECT("Could not create UUID for this object", 
-          saga::NoSuccess);
-      }
+        if (uuid_.is_null())
+            create();
+
+        if (uuid_.is_null())
+        {
+            SAGA_THROW_NO_OBJECT("Could not create UUID for this object", 
+              saga::NoSuccess);
+        }
     }
-    
+
     std::string string (void) const
     {
-      ensure_is_initialized();
-      
-      char             buffer[SAGA_UUID_LEN_STR + 1];
-      void           * str     = buffer;
-      size_t           len     = sizeof (buffer);
-
-      saga_uuid_rc_t   uuid_rc = saga_uuid_export (uuid_, 
-                                                   SAGA_UUID_FMT_STR, 
-                                                   & str,
-                                                   &len);
-      if ( SAGA_UUID_RC_OK != uuid_rc ) 
-      {
-        SAGA_OSSTREAM strm;
-
-        strm << "saga::uuid: couldn't export UUID to string, error was " 
-             << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW(SAGA_OSSTREAM_GETSTRING (strm), saga::NoSuccess);
-      }
-
-      return std::string(buffer);
+        ensure_is_initialized();
+        return boost::lexical_cast<std::string>(uuid_);
     }
 
     // create new uuid from scratch
     void create (void) const
     {
-      initialize_mutex();
-      boost::mutex::scoped_lock lock(mutex_instance());
-
-      saga_uuid_rc_t   uuid_rc  = SAGA_UUID_RC_OK;
-
-      // clean up first
-      if (uuid_)
-      {
-        saga_uuid_destroy (uuid_);
-        uuid_ = NULL;
-      }
-      
-      // create the new one
-      if ( SAGA_UUID_RC_OK != (uuid_rc = saga_uuid_create (&uuid_)) ||
-           SAGA_UUID_RC_OK != (uuid_rc = saga_uuid_make   ( uuid_, 
-                                                            SAGA_UUID_MAKE_SYSTEM)) )
-      {
-        saga_uuid_destroy (uuid_);
-        uuid_ = NULL;
-        
-        SAGA_OSSTREAM strm;
-
-        strm << "saga::uuid: couldn't create new UUID, error was " 
-             << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW(SAGA_OSSTREAM_GETSTRING (strm), saga::NoSuccess);
-      }
+        initialize_mutex();
+        boost::mutex::scoped_lock lock(mutex_instance());
+        uuid_ = uuid_generator_instance()();
     }
 
     // create new uuid from string
-    void create (char const * str, 
-                 size_t       len = 0) const
+    void create (char const* str, size_t len = 0) const
     {
-      initialize_mutex();
-      boost::mutex::scoped_lock lock(mutex_instance());
-
-      saga_uuid_rc_t   uuid_rc  = SAGA_UUID_RC_OK;
-
-      if ( 0 == len )
-      {
-        len = strlen (str);
-      }
-
-      // clean up first
-      if (uuid_)
-      {
-        saga_uuid_destroy (uuid_);
-        uuid_ = NULL;
-      }
-      
-      // create the new one
-      if ( SAGA_UUID_RC_OK != (uuid_rc = saga_uuid_create (&uuid_)) ||
-           SAGA_UUID_RC_OK != (uuid_rc = saga_uuid_import ( uuid_, 
-                                                            SAGA_UUID_FMT_STR, 
-                                                            str, len)) )
-      {
-        saga_uuid_destroy (uuid_);
-        uuid_ = NULL;
-
-        SAGA_OSSTREAM strm;
-
-        strm << "saga::uuid: couldn't create UUID from uuid, error was " 
-          << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW(SAGA_OSSTREAM_GETSTRING (strm), saga::NoSuccess);
-      }
+        initialize_mutex();
+        boost::mutex::scoped_lock lock(mutex_instance());
+        uuid_ = boost::uuids::uuid(str);
     }
 
     // comparison operators
     friend bool operator== (uuid const & lhs, uuid const & rhs)
     {
-      lhs.ensure_is_initialized();
-      rhs.ensure_is_initialized();
+        lhs.ensure_is_initialized();
+        rhs.ensure_is_initialized();
 
-      int            result  = 0;
-      saga_uuid_rc_t uuid_rc = saga_uuid_compare (lhs.uuid_, 
-                                                  rhs.uuid_,  &result);
-      
-      if ( SAGA_UUID_RC_OK != uuid_rc ) 
-      {
-        SAGA_OSSTREAM strm;
-      
-        strm << "saga::uuid: couldn't compare two UUIDs, error was " 
-             << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW_VERBATIM(saga::object(), SAGA_OSSTREAM_GETSTRING (strm), 
-            saga::NoSuccess);
-      }
-
-      return (0 == result) ? true : false;
+        return lhs.uuid_ == rhs.uuid_;
     }
 
     friend bool operator!= (uuid const & lhs, uuid const & rhs)
     {
-      return ( ! (lhs == rhs) );
+        return !(lhs == rhs);
     }
 
     friend bool operator< (uuid const & lhs, uuid const & rhs)
     {
-      lhs.ensure_is_initialized();
-      rhs.ensure_is_initialized();
+        lhs.ensure_is_initialized();
+        rhs.ensure_is_initialized();
 
-      int            result  = 0;
-      saga_uuid_rc_t uuid_rc = saga_uuid_compare (lhs.uuid_, 
-                                                  rhs.uuid_, &result);
-      if ( SAGA_UUID_RC_OK != uuid_rc ) 
-      {
-        SAGA_OSSTREAM strm;
-       
-        strm << "saga::uuid: couldn't compare two UUIDs, error was " 
-             << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW_VERBATIM(saga::object(), SAGA_OSSTREAM_GETSTRING (strm), 
-            saga::NoSuccess);
-      }
-
-      return (result < 0) ? true : false;
+        return lhs.uuid_ < rhs.uuid_;
     }
     
     friend bool operator> (uuid const & lhs, uuid const & rhs)
     {
-      lhs.ensure_is_initialized();
-      rhs.ensure_is_initialized();
+        lhs.ensure_is_initialized();
+        rhs.ensure_is_initialized();
 
-      int            result  = 0;
-      saga_uuid_rc_t uuid_rc = saga_uuid_compare (lhs.uuid_, 
-                                                  rhs.uuid_, &result);
-      if ( SAGA_UUID_RC_OK != uuid_rc ) 
-      {
-        SAGA_OSSTREAM strm;
-       
-        strm << "saga::uuid: couldn't compare two UUIDs, error was " 
-             << saga_uuid_error (uuid_rc);
-
-        // NoSuccess
-        SAGA_THROW_VERBATIM(saga::object(), SAGA_OSSTREAM_GETSTRING (strm), 
-            saga::NoSuccess);
-      }
-
-      return (result > 0) ? true : false;
+        return lhs.uuid_ > rhs.uuid_;
     }
 
     friend bool operator<= (uuid const & lhs, uuid const & rhs)
     {
-      return ( ! (lhs > rhs) );
+      return !(lhs > rhs);
     }
 
     friend bool operator>= (uuid const & lhs, uuid const & rhs)
     {
-      return ( ! (lhs < rhs) );
+      return !(lhs < rhs);
     }
 
     // streaming operators
@@ -278,7 +160,7 @@
 //     }
 };
 
-uuid const null_uuid = uuid("00000000-0000-0000-0000-000000000000");
+uuid const null_uuid = uuid();
 
 ///////////////////////////////////////////////////////////////////////////////
 } }   // namespace saga::impl

Directory: /trunk/project/VS.NET/saga_engine/
=============================================

File [modified]: saga_engine.vcproj
Delta lines: +1 -194
===================================================================
--- trunk/project/VS.NET/saga_engine/saga_engine.vcproj	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/project/VS.NET/saga_engine/saga_engine.vcproj	2009-01-25 03:57:51 UTC (rev 3388)
@@ -65,7 +65,7 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="/DLL"
+				AdditionalOptions="/DLL "
 				AdditionalDependencies="Ws2_32.lib Netapi32.lib Rpcrt4.lib"
 				OutputFile="$(OutDir)\$(ProjectName)d.dll"
 				LinkIncremental="2"
@@ -1288,46 +1288,6 @@
 							>
 						</File>
 					</Filter>
-					<Filter
-						Name="Uuid"
-						>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_ac.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_bm.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_mac.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_md5.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_prng.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_str.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_ui64.h"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_vers.h"
-							>
-						</File>
-					</Filter>
 				</Filter>
 			</Filter>
 		</Filter>
@@ -2199,159 +2159,6 @@
 							>
 						</File>
 					</Filter>
-					<Filter
-						Name="Uuid"
-						>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid.cpp"
-							>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug Lib|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_mac.cpp"
-							>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug Lib|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-								/>
-							</FileConfiguration>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_md5.cpp"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_prng.cpp"
-							>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-									DisableSpecificWarnings="4311,4312"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-									DisableSpecificWarnings="4311,4312"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-									DisableSpecificWarnings="4311,4312"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-									DisableSpecificWarnings="4311,4312"
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug Lib|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\..\external\u2nt\include"
-									DisableSpecificWarnings="4311,4312"
-								/>
-							</FileConfiguration>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_str.cpp"
-							>
-						</File>
-						<File
-							RelativePath="..\..\..\saga\impl\engine\uuid\saga_uuid_ui64.cpp"
-							>
-						</File>
-					</Filter>
 				</Filter>
 			</Filter>
 		</Filter>

Directory: /trunk/external/boost/uuid/libs/uuid/test/
=====================================================

File [added]: Jamfile.v2
Delta lines: +37 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/Jamfile.v2	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/Jamfile.v2	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,37 @@
+# Copyright 2007 Andy Tompkins.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+import testing ;
+
+project
+    : requirements 
+      <include>../../..
+    ;
+
+test-suite "uuid"
+    : # make sure uuid.hpp is self-contained
+      [ compile compile_uuid_header.cpp ]
+
+      # I want to look for issues when multiple translation units include uuid.hpp
+      # for example missing inline on non-template functions
+      #[ link test_uuid.cpp compile_uuid_header.cpp : : multiple_translation_units ]
+
+      # main test - added compile_uuid_header.cpp in lue of above test
+      [ unit-test test_uuid : test_uuid.cpp compile_uuid_header.cpp ]
+
+      # test serializing uuids
+      [ unit-test test_serialization
+        : test_serialization.cpp ../../serialization/build//boost_serialization
+      ]
+      [ unit-test test_wserialization
+        : test_wserialization.cpp
+          ../../serialization/build//boost_serialization
+          ../../serialization/build//boost_wserialization
+        : <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
+      ]
+
+      # test sha1 hash function
+      [ unit-test test_sha1 : test_sha1.cpp ]
+    ;



Property changes on: trunk/external/boost/uuid/libs/uuid/test/Jamfile.v2
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: compile_uuid_header.cpp
Delta lines: +15 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/compile_uuid_header.cpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/compile_uuid_header.cpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,15 @@
+//  (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+//  distribute this software is granted provided this copyright notice appears
+//  in all copies. This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//  libs/uuid/test/compile_uuid_header.cpp  -------------------------------//
+
+// Purpose to make sure that a translation unit consisting of just the contents 
+// of the header file will compile successfully.
+
+#include <boost/uuid/uuid.hpp>



Property changes on: trunk/external/boost/uuid/libs/uuid/test/compile_uuid_header.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: test_serialization.cpp
Delta lines: +71 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/test_serialization.cpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/test_serialization.cpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,71 @@
+//  (C) Copyright Andy Tompkins 2007. Permission to copy, use, modify, sell and
+//  distribute this software is granted provided this copyright notice appears
+//  in all copies. This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to test serializing uuids with narrow archives
+
+#include <boost/test/included/test_exec_monitor.hpp>
+#include <boost/test/test_tools.hpp>
+#include <sstream>
+#include <iostream>
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_serialize.hpp>
+
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include <boost/archive/xml_oarchive.hpp>
+#include <boost/archive/xml_iarchive.hpp>
+
+#include <boost/archive/binary_oarchive.hpp>
+#include <boost/archive/binary_iarchive.hpp>
+
+template <class OArchiveType, class IArchiveType, class OStringStreamType, class IStringStreamType>
+void test_archive()
+{
+    using namespace std;
+    using namespace boost::uuids;
+    
+    OStringStreamType o_stream;
+    
+    uuid u1("12345678-90ab-cdef-1234-567890abcdef");
+
+    uuid u2;
+    
+    // save
+    {
+        OArchiveType oa(o_stream);
+        
+        oa << BOOST_SERIALIZATION_NVP(u1);
+    }
+    
+    //cout << "stream:" << o_stream.str() << "\n\n";
+    
+    // load
+    {
+        IStringStreamType i_stream(o_stream.str());
+        IArchiveType ia(i_stream);
+        
+        ia >> BOOST_SERIALIZATION_NVP(u2);
+    }
+    
+    BOOST_CHECK_EQUAL(u1, u2);
+}
+
+int test_main( int /* argc */, char* /* argv */[] )
+{
+    using namespace std;
+    using namespace boost::archive;
+    
+    test_archive<text_oarchive, text_iarchive, ostringstream, istringstream>();
+    test_archive<xml_oarchive, xml_iarchive, ostringstream, istringstream>();
+    test_archive<binary_oarchive, binary_iarchive, ostringstream, istringstream>();
+
+    return 0;
+}



Property changes on: trunk/external/boost/uuid/libs/uuid/test/test_serialization.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: test_sha1.cpp
Delta lines: +239 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/test_sha1.cpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/test_sha1.cpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,239 @@
+//  (C) Copyright Andy Tompkins 2007. Permission to copy, use, modify, sell and
+//  distribute this software is granted provided this copyright notice appears
+//  in all copies. This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//  libs/uuid/test/test_sha1.cpp  -------------------------------//
+
+#include <boost/uuid/sha1.hpp>
+#include <algorithm>
+#include <cstring>
+#include <cstddef>
+
+#define BOOST_TEST_MAIN
+#include <boost/test/included/unit_test.hpp>
+
+#define BOOST_AUTO_TEST_MAIN
+#include <boost/test/auto_unit_test.hpp>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+  using ::strlen;
+  using ::size_t
+} //namespace std
+#endif
+
+void test_sha1(char const*const message, unsigned int length, const unsigned int (&correct_digest)[5])
+{
+    boost::uuids::detail::sha1 sha;
+    sha.process_bytes(message, length);
+
+    unsigned int digest[5];
+    sha.get_digest(digest);
+
+    BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, correct_digest, correct_digest+5);
+}
+
+BOOST_AUTO_TEST_CASE(test_quick)
+{
+    struct test_case
+    {
+        char const* message;
+        unsigned int digest[5];
+    };
+    test_case cases[] =
+    { { "",
+        { 0xda39a3ee, 0x5e6b4b0d, 0x3255bfef, 0x95601890, 0xafd80709 } }
+    , { "The quick brown fox jumps over the lazy dog",
+        { 0x2fd4e1c6, 0x7a2d28fc, 0xed849ee1, 0xbb76e739, 0x1b93eb12 } }
+    , { "The quick brown fox jumps over the lazy cog",
+        { 0xde9f2c7f, 0xd25e1b3a, 0xfad3e85a, 0x0bd17d9b, 0x100db4b3 } }
+    };
+
+    for (int i=0; i!=sizeof(cases)/sizeof(cases[0]); ++i) {
+        test_case const& tc = cases[i];
+        test_sha1(tc.message, std::strlen(tc.message), tc.digest);
+    }
+}
+
+//SHA Test Vector for Hashing Byte-Oriented Messages
+//http://csrc.nist.gov/cryptval/shs.htm
+//http://csrc.nist.gov/cryptval/shs/shabytetestvectors.zip
+//values from SHA1ShortMsg.txt
+BOOST_AUTO_TEST_CASE(test_short_messages)
+{
+    struct test_case
+    {
+        char const* message;
+        unsigned int digest[5];
+    };
+    test_case cases[] =
+    { { "", 
+         { 0xda39a3ee, 0x5e6b4b0d, 0x3255bfef, 0x95601890, 0xafd80709 } }
+    , { "a8", 
+         { 0x99f2aa95, 0xe36f95c2, 0xacb0eaf2, 0x3998f030, 0x638f3f15 } }
+    , { "3000", 
+         { 0xf944dcd6, 0x35f9801f, 0x7ac90a40, 0x7fbc4799, 0x64dec024 } }
+    , { "42749e", 
+         { 0xa444319e, 0x9b6cc1e8, 0x464c511e, 0xc0969c37, 0xd6bb2619 } }
+    , { "9fc3fe08", 
+         { 0x16a0ff84, 0xfcc156fd, 0x5d3ca3a7, 0x44f20a23, 0x2d172253 } }
+    , { "b5c1c6f1af", 
+         { 0xfec9deeb, 0xfcdedaf6, 0x6dda525e, 0x1be43597, 0xa73a1f93 } }
+    , { "e47571e5022e", 
+         { 0x8ce05118, 0x1f0ed5e9, 0xd0c498f6, 0xbc4caf44, 0x8d20deb5 } }
+    , { "3e1b28839fb758", 
+         { 0x67da5383, 0x7d89e03b, 0xf652ef09, 0xc369a341, 0x5937cfd3 } }
+    , { "a81350cbb224cb90", 
+         { 0x305e4ff9, 0x888ad855, 0xa78573cd, 0xdf4c5640, 0xcce7e946 } }
+    , { "c243d167923dec3ce1", 
+         { 0x5902b77b, 0x3265f023, 0xf9bbc396, 0xba1a93fa, 0x3509bde7 } }
+    , { "50ac18c59d6a37a29bf4", 
+         { 0xfcade5f5, 0xd156bf6f, 0x9af97bdf, 0xa9c19bcc, 0xfb4ff6ab } }
+    , { "98e2b611ad3b1cccf634f6", 
+         { 0x1d20fbe0, 0x0533c10e, 0x3cbd6b27, 0x088a5de0, 0xc632c4b5 } }
+    , { "73fe9afb68e1e8712e5d4eec", 
+         { 0x7e1b7e0f, 0x7a8f3455, 0xa9c03e95, 0x80fd63ae, 0x205a2d93 } }
+    , { "9e701ed7d412a9226a2a130e66", 
+         { 0x706f0677, 0x146307b2, 0x0bb0e8d6, 0x311e3299, 0x66884d13 } }
+    , { "6d3ee90413b0a7cbf69e5e6144ca", 
+         { 0xa7241a70, 0x3aaf0d53, 0xfe142f86, 0xbf2e8492, 0x51fa8dff } }
+    , { "fae24d56514efcb530fd4802f5e71f", 
+         { 0x400f5354, 0x6916d33a, 0xd01a5e6d, 0xf66822df, 0xbdc4e9e6 } }
+    , { "c5a22dd6eda3fe2bdc4ddb3ce6b35fd1", 
+         { 0xfac8ab93, 0xc1ae6c16, 0xf0311872, 0xb984f729, 0xdc928ccd } }
+    , { "d98cded2adabf08fda356445c781802d95", 
+         { 0xfba6d750, 0xc18da58f, 0x6e2aab10, 0x112b9a5e, 0xf3301b3b } }
+    , { "bcc6d7087a84f00103ccb32e5f5487a751a2", 
+         { 0x29d27c2d, 0x44c205c8, 0x107f0351, 0xb05753ac, 0x708226b6 } }
+    , { "36ecacb1055434190dbbc556c48bafcb0feb0d", 
+         { 0xb971bfc1, 0xebd6f359, 0xe8d74cb7, 0xecfe7f89, 0x8d0ba845 } }
+    , { "5ff9edb69e8f6bbd498eb4537580b7fba7ad31d0", 
+         { 0x96d08c43, 0x0094b9fc, 0xc164ad2f, 0xb6f72d0a, 0x24268f68 } }
+    , { "c95b441d8270822a46a798fae5defcf7b26abace36", 
+         { 0xa287ea75, 0x2a593d52, 0x09e28788, 0x1a09c49f, 0xa3f0beb1 } }
+    , { "83104c1d8a55b28f906f1b72cb53f68cbb097b44f860", 
+         { 0xa06c7137, 0x79cbd885, 0x19ed4a58, 0x5ac0cb8a, 0x5e9d612b } }
+    , { "755175528d55c39c56493d697b790f099a5ce741f7754b", 
+         { 0xbff7d52c, 0x13a36881, 0x32a1d407, 0xb1ab40f5, 0xb5ace298 } }
+    , { "088fc38128bbdb9fd7d65228b3184b3faac6c8715f07272f", 
+         { 0xc7566b91, 0xd7b6f56b, 0xdfcaa978, 0x1a7b6841, 0xaacb17e9 } }
+    , { "a4a586eb9245a6c87e3adf1009ac8a49f46c07e14185016895", 
+         { 0xffa30c0b, 0x5c550ea4, 0xb1e34f8a, 0x60ec9295, 0xa1e06ac1 } }
+    , { "8e7c555270c006092c2a3189e2a526b873e2e269f0fb28245256", 
+         { 0x29e66ed2, 0x3e914351, 0xe872aa76, 0x1df6e4f1, 0xa07f4b81 } }
+    , { "a5f3bfa6bb0ba3b59f6b9cbdef8a558ec565e8aa3121f405e7f2f0", 
+         { 0xb28cf5e5, 0xb806a014, 0x91d41f69, 0xbd924876, 0x5c5dc292 } }
+    , { "589054f0d2bd3c2c85b466bfd8ce18e6ec3e0b87d944cd093ba36469", 
+         { 0x60224fb7, 0x2c460696, 0x52cd78bc, 0xd08029ef, 0x64da62f3 } }
+    , { "a0abb12083b5bbc78128601bf1cbdbc0fdf4b862b24d899953d8da0ff3", 
+         { 0xb72c4a86, 0xf72608f2, 0x4c05f3b9, 0x088ef92f, 0xba431df7 } }
+    , { "82143f4cea6fadbf998e128a8811dc75301cf1db4f079501ea568da68eeb", 
+         { 0x73779ad5, 0xd6b71b9b, 0x8328ef72, 0x20ff12eb, 0x167076ac } }
+    , { "9f1231dd6df1ff7bc0b0d4f989d048672683ce35d956d2f57913046267e6f3", 
+         { 0xa09671d4, 0x452d7cf5, 0x0015c914, 0xa1e31973, 0xd20cc1a0 } }
+    , { "041c512b5eed791f80d3282f3a28df263bb1df95e1239a7650e5670fc2187919", 
+         { 0xe88cdcd2, 0x33d99184, 0xa6fd260b, 0x8fca1b7f, 0x7687aee0 } }
+    , { "17e81f6ae8c2e5579d69dafa6e070e7111461552d314b691e7a3e7a4feb3fae418", 
+         { 0x010def22, 0x850deb11, 0x68d525e8, 0xc84c2811, 0x6cb8a269 } }
+    , { "d15976b23a1d712ad28fad04d805f572026b54dd64961fda94d5355a0cc98620cf77", 
+         { 0xaeaa40ba, 0x1717ed54, 0x39b1e6ea, 0x901b294b, 0xa500f9ad } }
+    , { "09fce4d434f6bd32a44e04b848ff50ec9f642a8a85b37a264dc73f130f22838443328f", 
+         { 0xc6433791, 0x238795e3, 0x4f080a5f, 0x1f1723f0, 0x65463ca0 } }
+    , { "f17af27d776ec82a257d8d46d2b46b639462c56984cc1be9c1222eadb8b26594a25c709d", 
+         { 0xe21e22b8, 0x9c1bb944, 0xa32932e6, 0xb2a2f20d, 0x491982c3 } }
+    , { "b13ce635d6f8758143ffb114f2f601cb20b6276951416a2f94fbf4ad081779d79f4f195b22", 
+         { 0x575323a9, 0x661f5d28, 0x387964d2, 0xba6ab92c, 0x17d05a8a } }
+    , { "5498793f60916ff1c918dde572cdea76da8629ba4ead6d065de3dfb48de94d234cc1c5002910", 
+         { 0xfeb44494, 0xaf72f245, 0xbfe68e86, 0xc4d7986d, 0x57c11db7 } }
+    , { "498a1e0b39fa49582ae688cd715c86fbaf8a81b8b11b4d1594c49c902d197c8ba8a621fd6e3be5", 
+         { 0xcff2290b, 0x3648ba28, 0x31b98dde, 0x436a72f9, 0xebf51eee } }
+    , { "3a36ae71521f9af628b3e34dcb0d4513f84c78ee49f10416a98857150b8b15cb5c83afb4b570376e", 
+         { 0x9b4efe9d, 0x27b96590, 0x5b0c3dab, 0x67b8d7c9, 0xebacd56c } }
+    , { "dcc76b40ae0ea3ba253e92ac50fcde791662c5b6c948538cffc2d95e9de99cac34dfca38910db2678f", 
+         { 0xafedb0ff, 0x156205bc, 0xd831cbdb, 0xda43db8b, 0x0588c113 } }
+    , { "5b5ec6ec4fd3ad9c4906f65c747fd4233c11a1736b6b228b92e90cddabb0c7c2fcf9716d3fad261dff33", 
+         { 0x8deb1e85, 0x8f88293a, 0x5e5e4d52, 0x1a34b2a4, 0xefa70fc4 } }
+    , { "df48a37b29b1d6de4e94717d60cdb4293fcf170bba388bddf7a9035a15d433f20fd697c3e4c8b8c5f590ab", 
+         { 0x95cbdac0, 0xf74afa69, 0xcebd0e5c, 0x7defbc6f, 0xaf0cbeaf } }
+    , { "1f179b3b82250a65e1b0aee949e218e2f45c7a8dbfd6ba08de05c55acfc226b48c68d7f7057e5675cd96fcfc", 
+         { 0xf0307bcb, 0x92842e5a, 0xe0cd4f4f, 0x14f3df7f, 0x877fbef2 } }
+    , { "ee3d72da3a44d971578972a8e6780ce64941267e0f7d0179b214fa97855e1790e888e09fbe3a70412176cb3b54", 
+         { 0x7b13bb0d, 0xbf14964b, 0xd63b133a, 0xc85e2210, 0x0542ef55 } }
+    , { "d4d4c7843d312b30f610b3682254c8be96d5f6684503f8fbfbcd15774fc1b084d3741afb8d24aaa8ab9c104f7258", 
+         { 0xc314d2b6, 0xcf439be6, 0x78d2a74e, 0x890d96cf, 0xac1c02ed } }
+    , { "32c094944f5936a190a0877fb9178a7bf60ceae36fd530671c5b38c5dbd5e6a6c0d615c2ac8ad04b213cc589541cf6", 
+         { 0x4d0be361, 0xe410b47a, 0x9d67d8ce, 0x0bb6a8e0, 0x1c53c078 } }
+    , { "e5d3180c14bf27a5409fa12b104a8fd7e9639609bfde6ee82bbf9648be2546d29688a65e2e3f3da47a45ac14343c9c02", 
+         { 0xe5353431, 0xffae097f, 0x675cbf49, 0x8869f6fb, 0xb6e1c9f2 } }
+    , { "e7b6e4b69f724327e41e1188a37f4fe38b1dba19cbf5a7311d6e32f1038e97ab506ee05aebebc1eed09fc0e357109818b9", 
+         { 0xb8720a70, 0x68a085c0, 0x18ab1896, 0x1de2765a, 0xa6cd9ac4 } }
+    , { "bc880cb83b8ac68ef2fedc2da95e7677ce2aa18b0e2d8b322701f67af7d5e7a0d96e9e33326ccb7747cfff0852b961bfd475", 
+         { 0xb0732181, 0x568543ba, 0x85f2b6da, 0x602b4b06, 0x5d9931aa } }
+    , { "235ea9c2ba7af25400f2e98a47a291b0bccdaad63faa2475721fda5510cc7dad814bce8dabb611790a6abe56030b798b75c944", 
+         { 0x9c22674c, 0xf3222c3b, 0xa9216726, 0x94aafee4, 0xce67b96b } }
+    , { "07e3e29fed63104b8410f323b975fd9fba53f636af8c4e68a53fb202ca35dd9ee07cb169ec5186292e44c27e5696a967f5e67709", 
+         { 0xd128335f, 0x4cecca90, 0x66cdae08, 0x958ce656, 0xff0b4cfc } }
+    , { "65d2a1dd60a517eb27bfbf530cf6a5458f9d5f4730058bd9814379547f34241822bf67e6335a6d8b5ed06abf8841884c636a25733f", 
+         { 0x0b67c57a, 0xc578de88, 0xa2ae055c, 0xaeaec8bb, 0x9b0085a0 } }
+    , { "dcc86b3bd461615bab739d8daafac231c0f462e819ad29f9f14058f3ab5b75941d4241ea2f17ebb8a458831b37a9b16dead4a76a9b0e", 
+         { 0xc766f912, 0xa89d4ccd, 0xa88e0cce, 0x6a713ef5, 0xf178b596 } }
+    , { "4627d54f0568dc126b62a8c35fb46a9ac5024400f2995e51635636e1afc4373dbb848eb32df23914230560b82477e9c3572647a7f2bb92", 
+         { 0x9aa3925a, 0x9dcb177b, 0x15ccff9b, 0x78e70cf3, 0x44858779 } }
+    , { "ba531affd4381168ef24d8b275a84d9254c7f5cc55fded53aa8024b2c5c5c8aa7146fe1d1b83d62b70467e9a2e2cb67b3361830adbab28d7", 
+         { 0x4811fa30, 0x042fc076, 0xacf37c8e, 0x2274d025, 0x307e5943 } }
+    , { "8764dcbcf89dcf4282eb644e3d568bdccb4b13508bfa7bfe0ffc05efd1390be22109969262992d377691eb4f77f3d59ea8466a74abf57b2ef4", 
+         { 0x67430184, 0x50c97307, 0x61ee2b13, 0x0df9b91c, 0x1e118150 } }
+    , { "497d9df9ddb554f3d17870b1a31986c1be277bc44feff713544217a9f579623d18b5ffae306c25a45521d2759a72c0459b58957255ab592f3be4", 
+         { 0x71ad4a19, 0xd37d92a5, 0xe6ef3694, 0xddbeb5aa, 0x61ada645 } }
+    , { "72c3c2e065aefa8d9f7a65229e818176eef05da83f835107ba90ec2e95472e73e538f783b416c04654ba8909f26a12db6e5c4e376b7615e4a25819", 
+         { 0xa7d9dc68, 0xdacefb7d, 0x61161860, 0x48cb355c, 0xc548e11d } }
+    , { "7cc9894454d0055ab5069a33984e2f712bef7e3124960d33559f5f3b81906bb66fe64da13c153ca7f5cabc89667314c32c01036d12ecaf5f9a78de98", 
+         { 0x142e429f, 0x0522ba5a, 0xbf5131fa, 0x81df82d3, 0x55b96909 } }
+    , { "74e8404d5a453c5f4d306f2cfa338ca65501c840ddab3fb82117933483afd6913c56aaf8a0a0a6b2a342fc3d9dc7599f4a850dfa15d06c61966d74ea59", 
+         { 0xef72db70, 0xdcbcab99, 0x1e963797, 0x6c6faf00, 0xd22caae9 } }
+    , { "46fe5ed326c8fe376fcc92dc9e2714e2240d3253b105adfbb256ff7a19bc40975c604ad7c0071c4fd78a7cb64786e1bece548fa4833c04065fe593f6fb10", 
+         { 0xf220a745, 0x7f4588d6, 0x39dc2140, 0x7c942e98, 0x43f8e26b } }
+    , { "836dfa2524d621cf07c3d2908835de859e549d35030433c796b81272fd8bc0348e8ddbc7705a5ad1fdf2155b6bc48884ac0cd376925f069a37849c089c8645", 
+         { 0xddd2117b, 0x6e309c23, 0x3ede85f9, 0x62a0c2fc, 0x215e5c69 } }
+    , { "7e3a4c325cb9c52b88387f93d01ae86d42098f5efa7f9457388b5e74b6d28b2438d42d8b64703324d4aa25ab6aad153ae30cd2b2af4d5e5c00a8a2d0220c6116", 
+         { 0xa3054427, 0xcdb13f16, 0x4a610b34, 0x8702724c, 0x808a0dcc } }
+    };
+
+    char const xdigits[17] = "0123456789abcdef";
+    char const*const xdigits_end = xdigits+16;
+
+    for (std::size_t i=0; i!=sizeof(cases)/sizeof(cases[0]); ++i) {
+        test_case const& tc = cases[i];
+
+        boost::uuids::detail::sha1 sha;
+        std::size_t message_length = std::strlen(tc.message);
+        BOOST_CHECK_EQUAL(message_length%2, 0u);
+
+        for (std::size_t b=0; b!=message_length; b+=2) {
+            char c = tc.message[b];
+            char const* f = std::find(xdigits, xdigits_end, c);
+            BOOST_CHECK(f != xdigits_end);
+            
+            unsigned char byte = static_cast<unsigned char>(std::distance(&xdigits[0], f));
+
+            c = tc.message[b+1];
+            f = std::find(xdigits, xdigits_end, c);
+            BOOST_CHECK(f != xdigits_end);
+
+            byte <<= 4;
+            byte |= static_cast<unsigned char>(std::distance(&xdigits[0], f));
+
+            sha.process_byte(byte);
+        }
+
+        unsigned int digest[5];
+        sha.get_digest(digest);
+
+        BOOST_CHECK_EQUAL_COLLECTIONS(digest, digest+5, tc.digest, tc.digest+5);
+    }
+}



Property changes on: trunk/external/boost/uuid/libs/uuid/test/test_sha1.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: test_uuid.cpp
Delta lines: +240 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/test_uuid.cpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/test_uuid.cpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,240 @@
+//  (C) Copyright Andy Tompkins 2007. Permission to copy, use, modify, sell and
+//  distribute this software is granted provided this copyright notice appears
+//  in all copies. This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//  libs/uuid/test/test_uuid.cpp  -------------------------------//
+
+#include <boost/uuid/uuid.hpp>
+
+#include <boost/test/included/test_exec_monitor.hpp>
+#include <boost/test/test_tools.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+#include <boost/lexical_cast.hpp>
+#include <boost/random.hpp>
+
+#include <boost/functional/hash.hpp>
+
+#include <string>
+#include <vector>
+
+int test_main(int, char*[])
+{
+    using namespace boost::uuids;
+    using boost::test_tools::output_test_stream;
+    
+    uuid u;
+
+    // test constructors
+    BOOST_CHECK_EQUAL(uuid(), uuid());
+
+    BOOST_CHECK_NO_THROW(uuid("{00000000-0000-0000-0000-000000000000}"));
+    BOOST_CHECK_NO_THROW(uuid("00000000-0000-0000-0000-000000000000"));
+    BOOST_CHECK_NO_THROW(uuid(std::string("{00000000-0000-0000-0000-000000000000}")));
+#ifndef BOOST_NO_STD_WSTRING
+    BOOST_CHECK_NO_THROW(uuid(L"{00000000-0000-0000-0000-000000000000}"));
+    BOOST_CHECK_NO_THROW(uuid(std::wstring(L"{00000000-0000-0000-0000-000000000000}")));
+#endif
+
+    uuid temp_uuid = uuid();
+
+    std::vector<long> vec;
+    vec.push_back(0x12);
+    vec.push_back(0x34);
+    vec.push_back(0x56);
+    vec.push_back(0x78);
+    vec.push_back(0x90);
+    vec.push_back(0xab);
+    vec.push_back(0xcd);
+    vec.push_back(0xef);
+    vec.push_back(0x12);
+    vec.push_back(0x34);
+    vec.push_back(0x56);
+    vec.push_back(0x78);
+    vec.push_back(0x90);
+    vec.push_back(0xab);
+    vec.push_back(0xcd);
+    vec.push_back(0xef);
+    BOOST_CHECK_NO_THROW(temp_uuid = uuid(vec.begin(), vec.end()));
+    BOOST_CHECK_EQUAL(temp_uuid, uuid("12345678-90ab-cdef-1234-567890abcdef"));
+    
+    // test assignment
+    uuid u1("{12345678-90ab-cdef-1234-567890abcdef}");
+    temp_uuid = u1;
+    BOOST_CHECK_EQUAL(temp_uuid, u1);
+    temp_uuid = uuid();
+    BOOST_CHECK_EQUAL(temp_uuid, uuid());
+
+    // test comparsion
+    BOOST_CHECK_PREDICATE(std::equal_to<uuid>(), (u1)(u1));
+    BOOST_CHECK_PREDICATE(std::not_equal_to<uuid>(), (u1)(uuid()));
+   
+    BOOST_CHECK_PREDICATE(std::less<uuid>(), (uuid())(u1));
+    BOOST_CHECK_PREDICATE(std::less_equal<uuid>(), (uuid())(u1));
+    BOOST_CHECK_PREDICATE(std::less_equal<uuid>(), (u1)(u1));
+    BOOST_CHECK_PREDICATE(std::less<uuid>(), (uuid("00000000-0000-0000-0000-000000000000")) (uuid("00000000-0000-0000-0000-000000000001")));
+    BOOST_CHECK_PREDICATE(std::less<uuid>(), (uuid("e0000000-0000-0000-0000-000000000000")) (uuid("f0000000-0000-0000-0000-000000000000")));
+    BOOST_CHECK_PREDICATE(std::less<uuid>(), (uuid("ffffffff-ffff-ffff-ffff-fffffffffffe")) (uuid("ffffffff-ffff-ffff-ffff-ffffffffffff")));
+    
+    BOOST_CHECK_PREDICATE(std::greater<uuid>(), (u1)(uuid()));
+    BOOST_CHECK_PREDICATE(std::greater_equal<uuid>(), (u1)(uuid()));
+    BOOST_CHECK_PREDICATE(std::greater_equal<uuid>(), (u1)(u1));
+
+    // test is_null()
+    BOOST_CHECK_EQUAL(u1.is_null(), false);
+    BOOST_CHECK_EQUAL(uuid().is_null(), true);
+
+    // test to_string()
+    BOOST_CHECK_EQUAL(uuid().to_string(), std::string("00000000-0000-0000-0000-000000000000"));
+    BOOST_CHECK_EQUAL(u1.to_string(), std::string("12345678-90ab-cdef-1234-567890abcdef"));
+
+    // test to_wstring()
+#ifndef BOOST_NO_STD_WSTRING
+    BOOST_CHECK(u1.to_wstring() == std::wstring(L"12345678-90ab-cdef-1234-567890abcdef"));
+#endif
+
+    // test to_basic_string()
+    BOOST_CHECK_EQUAL((u1.to_basic_string<char, std::char_traits<char>, std::allocator<char> >()),
+        std::string("12345678-90ab-cdef-1234-567890abcdef"));
+        
+    // test with lexical_cast
+    BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(uuid()), std::string("00000000-0000-0000-0000-000000000000"));
+    BOOST_CHECK_EQUAL(boost::lexical_cast<uuid>("00000000-0000-0000-0000-000000000000"), uuid());
+
+    // test size
+    BOOST_CHECK_EQUAL(u1.size(), 16U);
+
+    // test begin/end
+    vec.clear();
+    vec.resize(u1.size());
+    std::copy(u1.begin(), u1.end(), vec.begin());
+    BOOST_CHECK_EQUAL(vec.size(), 16U);
+    BOOST_CHECK_EQUAL(vec[0], 0x12);
+    BOOST_CHECK_EQUAL(vec[1], 0x34);
+    BOOST_CHECK_EQUAL(vec[2], 0x56);
+    BOOST_CHECK_EQUAL(vec[3], 0x78);
+    BOOST_CHECK_EQUAL(vec[4], 0x90);
+    BOOST_CHECK_EQUAL(vec[5], 0xab);
+    BOOST_CHECK_EQUAL(vec[6], 0xcd);
+    BOOST_CHECK_EQUAL(vec[7], 0xef);
+    BOOST_CHECK_EQUAL(vec[8], 0x12);
+    BOOST_CHECK_EQUAL(vec[9], 0x34);
+    BOOST_CHECK_EQUAL(vec[10], 0x56);
+    BOOST_CHECK_EQUAL(vec[11], 0x78);
+    BOOST_CHECK_EQUAL(vec[12], 0x90);
+    BOOST_CHECK_EQUAL(vec[13], 0xab);
+    BOOST_CHECK_EQUAL(vec[14], 0xcd);
+    BOOST_CHECK_EQUAL(vec[15], 0xef);
+
+    // test swap()
+    uuid u2("{abababab-abab-abab-abab-abababababab}");
+    BOOST_CHECK_NO_THROW(swap(u2, u1));
+    BOOST_CHECK_EQUAL(u1, uuid("{abababab-abab-abab-abab-abababababab}"));
+    BOOST_CHECK_EQUAL(u2, uuid("{12345678-90ab-cdef-1234-567890abcdef}"));
+
+    BOOST_CHECK_NO_THROW(u1.swap(u2));
+    BOOST_CHECK_EQUAL(u2, uuid("{abababab-abab-abab-abab-abababababab}"));
+    BOOST_CHECK_EQUAL(u1, uuid("{12345678-90ab-cdef-1234-567890abcdef}"));
+    
+    // test hash
+    boost::hash<uuid> uuid_hasher;
+    BOOST_CHECK_EQUAL(uuid_hasher(uuid()), 3565488559U);
+    BOOST_CHECK_EQUAL(uuid_hasher(u1), 4159045843U);
+    BOOST_CHECK_EQUAL(uuid_hasher(u2), 2713274306U);
+
+    // test insert/extract operators
+    output_test_stream output;
+    output << uuid();
+    BOOST_CHECK(!output.is_empty(false));
+    BOOST_CHECK(output.check_length(36, false));
+    BOOST_CHECK(output.is_equal("00000000-0000-0000-0000-000000000000"));
+
+    output << u1;
+    BOOST_CHECK(!output.is_empty(false));
+    BOOST_CHECK(output.check_length(36, false));
+    BOOST_CHECK(output.is_equal("12345678-90ab-cdef-1234-567890abcdef"));
+
+    output << showbraces << u1;
+    BOOST_CHECK(!output.is_empty(false));
+    BOOST_CHECK(output.check_length(38, false));
+    BOOST_CHECK(output.is_equal("{12345678-90ab-cdef-1234-567890abcdef}"));
+
+    output << noshowbraces << u1;
+    BOOST_CHECK(!output.is_empty(false));
+    BOOST_CHECK(output.check_length(36, false));
+    BOOST_CHECK(output.is_equal("12345678-90ab-cdef-1234-567890abcdef"));
+
+    std::stringstream ss;
+    ss << "{00000000-0000-0000-0000-000000000000}";
+    ss >> u1;
+    BOOST_CHECK_EQUAL(u1, uuid());
+
+    ss << "{12345678-90ab-cdef-1234-567890abcdef}";
+    ss >> u1;
+    BOOST_CHECK_EQUAL(u1, uuid("{12345678-90ab-cdef-1234-567890abcdef}"));
+
+    // test basic_uuid_generation
+    {
+        uuid_generator gen;
+
+        BOOST_CHECK(uuid() != gen());
+        temp_uuid = gen();
+        BOOST_CHECK(temp_uuid != gen());
+    }
+    {
+        basic_uuid_generator<boost::rand48> gen;
+
+        BOOST_CHECK(uuid() != gen());
+        temp_uuid = gen();
+        BOOST_CHECK(temp_uuid != gen());
+    }
+    {
+        boost::lagged_fibonacci44497 rng;
+        basic_uuid_generator<boost::lagged_fibonacci44497&> gen(rng);
+
+        BOOST_CHECK(uuid() != gen());
+        temp_uuid = gen();
+        BOOST_CHECK(temp_uuid != gen());
+    }
+    {
+        boost::scoped_ptr<boost::mt19937> rng(new boost::mt19937);
+        basic_uuid_generator<boost::mt19937*> gen(rng.get());
+
+        BOOST_CHECK(uuid() != gen());
+        temp_uuid = gen();
+        BOOST_CHECK(temp_uuid != gen());
+    }
+    //{
+    //    boost_uuid_generator<boost::random_device> gen;
+
+    //    BOOST_CHECK(uuid() != gen());
+    //    temp_uuid = gen();
+    //    BOOST_CHECK(temp_uuid != gen());
+    //}
+    
+    // test variant and version bits
+    uuid_generator gen;
+    for (int i=0; i<5; ++i) { // check a few generated uuids
+        uuid u = gen();
+        vec.resize(u.size());
+        std::copy(u.begin(), u.end(), vec.begin());
+        
+        // variant
+        BOOST_CHECK_EQUAL(vec[8] & 0xC0, 0x80);
+        
+        // version
+        BOOST_CHECK_EQUAL(vec[6] & 0xF0, 0x40);
+    }
+    
+    // test name based creation
+    uuid dns_namespace_uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8");
+    BOOST_CHECK_EQUAL(uuid::create(dns_namespace_uuid, "www.widgets.com", 15),
+         uuid("21f7f8de-8051-5b89-8680-0195ef798b6a"));
+    
+    return 0;
+}



Property changes on: trunk/external/boost/uuid/libs/uuid/test/test_uuid.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: test_wserialization.cpp
Delta lines: +71 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/test/test_wserialization.cpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/test/test_wserialization.cpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,71 @@
+//  (C) Copyright Andy Tompkins 2008. Permission to copy, use, modify, sell and
+//  distribute this software is granted provided this copyright notice appears
+//  in all copies. This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Purpose to test serializing uuids with wide stream archives
+
+#include <boost/test/included/test_exec_monitor.hpp>
+#include <boost/test/test_tools.hpp>
+#include <sstream>
+#include <iostream>
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_serialize.hpp>
+
+#include <boost/archive/text_woarchive.hpp>
+#include <boost/archive/text_wiarchive.hpp>
+
+#include <boost/archive/xml_woarchive.hpp>
+#include <boost/archive/xml_wiarchive.hpp>
+
+#include <boost/archive/binary_woarchive.hpp>
+#include <boost/archive/binary_wiarchive.hpp>
+
+template <class OArchiveType, class IArchiveType, class OStringStreamType, class IStringStreamType>
+void test_archive()
+{
+    using namespace std;
+    using namespace boost::uuids;
+    
+    OStringStreamType o_stream;
+    
+    uuid u1(L"12345678-90ab-cdef-1234-567890abcdef");
+
+    uuid u2;
+    
+    // save
+    {
+        OArchiveType oa(o_stream);
+        
+        oa << BOOST_SERIALIZATION_NVP(u1);
+    }
+    
+    //wcout << "stream:" << o_stream.str() << "\n\n";
+    
+    // load
+    {
+        IStringStreamType i_stream(o_stream.str());
+        IArchiveType ia(i_stream);
+        
+        ia >> BOOST_SERIALIZATION_NVP(u2);
+    }
+    
+    BOOST_CHECK_EQUAL(u1, u2);
+}
+
+int test_main( int /* argc */, char* /* argv */[] )
+{
+    using namespace std;
+    using namespace boost::archive;
+    
+    test_archive<text_woarchive, text_wiarchive, wostringstream, wistringstream>();
+    test_archive<xml_woarchive, xml_wiarchive, wostringstream, wistringstream>();
+    test_archive<binary_woarchive, binary_wiarchive, wostringstream, wistringstream>();
+
+    return 0;
+}



Property changes on: trunk/external/boost/uuid/libs/uuid/test/test_wserialization.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


Directory: /trunk/external/boost/uuid/boost/uuid/
=================================================

File [added]: seed_rng.hpp
Delta lines: +234 -0
===================================================================
--- trunk/external/boost/uuid/boost/uuid/seed_rng.hpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/boost/uuid/seed_rng.hpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,234 @@
+// Boost seed_rng.hpp header file  ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History
+//  09 Nov 2007 - Initial Revision
+//  25 Feb 2008 - moved to namespace boost::uuids::detail
+
+// seed_rng models a UniformRandomNumberGenerator (see Boost.Random).
+// Random number generators are hard to seed well.  This is intended to provide
+// good seed values for random number generators.
+// It creates random numbers from a sha1 hash of data from a variary of sources,
+// all of which are standard function calls.  It produces random numbers slowly.
+// Peter Dimov provided the details of sha1_random_digest_().
+// see http://archives.free.net.ph/message/20070507.175609.4c4f503a.en.html
+
+#ifndef BOOST_UUID_SEED_RNG_HPP
+#define BOOST_UUID_SEED_RNG_HPP
+
+#include <boost/config.hpp>
+#include <cstring>
+#include <limits>
+#include <memory.h>
+#include <ctime>
+#include <cstdlib>
+#include <boost/uuid/sha1.hpp>
+//#include <boost/nondet_random.hpp> //forward declare boost::random_device
+
+// can't use boost::generator_iterator since boost::random number seed(Iter&, Iter)
+// functions need a last iterator
+//#include <boost/generator_iterator.hpp>
+# include <boost/iterator/iterator_facade.hpp>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+    using ::memcpy;
+    using ::time_t;
+    using ::time;
+    using ::clock_t;
+    using ::clock;
+    using ::rand;
+    using ::FILE;
+    using ::fopen;
+    using ::fread;
+    using ::fclose;
+} //namespace std
+#endif
+
+// forward declare random number generators
+namespace boost {
+class random_device;
+} //namespace boost
+
+namespace boost {
+namespace uuids {
+namespace detail {
+
+class seed_rng
+{
+public:
+    typedef unsigned int result_type;
+    BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+    //BOOST_STATIC_CONSTANT(unsigned int, min_value = 0);
+    //BOOST_STATIC_CONSTANT(unsigned int, max_value = UINT_MAX);
+
+public:
+    seed_rng()
+        : rd_index_(5)
+    {}
+
+    result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const
+    {
+        return (std::numeric_limits<result_type>::min)();
+    }
+    result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
+    {
+        return (std::numeric_limits<result_type>::max)();
+    }
+
+    result_type operator()()
+    {
+        if (rd_index_ >= 5) {
+            //get new digest
+            sha1_random_digest_();
+
+            rd_index_ = 0;
+        }
+
+        return rd_[rd_index_++];
+    }
+
+private:
+    static unsigned int * sha1_random_digest_state_()
+    {
+        static unsigned int state[ 5 ];
+        return state;
+    }
+
+    void sha1_random_digest_()
+    {
+        boost::uuids::detail::sha1 sha;
+
+        unsigned int * ps = sha1_random_digest_state_();
+
+        unsigned int state[ 5 ];
+        std::memcpy( state, ps, sizeof( state ) ); // harmless data race
+
+        sha.process_bytes( (unsigned char const*)state, sizeof( state ) );
+        sha.process_bytes( (unsigned char const*)&ps, sizeof( ps ) );
+
+        {
+            std::time_t tm = std::time( 0 );
+            sha.process_bytes( (unsigned char const*)&tm, sizeof( tm ) );
+        }
+
+        {
+            std::clock_t ck = std::clock();
+            sha.process_bytes( (unsigned char const*)&ck, sizeof( ck ) );
+        }
+
+        {
+            unsigned int rn[] = { std::rand(), std::rand(), std::rand() };
+            sha.process_bytes( (unsigned char const*)rn, sizeof( rn ) );
+        }
+
+        {
+            unsigned char buffer[ 20 ];
+
+            if( std::FILE * f = std::fopen( "/dev/urandom", "rb" ) )
+            {
+                std::fread( buffer, 1, 20, f );
+                std::fclose( f );
+            }
+
+            // using an uninitialized buffer[] if fopen fails
+            // intentional, we rely on its contents being random
+            sha.process_bytes( buffer, sizeof( buffer ) );
+        }
+
+        {
+            unsigned int * p = new unsigned int;
+
+            sha.process_bytes( (unsigned char const*)p, sizeof( *p ) );
+            sha.process_bytes( (unsigned char const*)&p, sizeof( p ) );
+
+            delete p;
+        }
+
+        sha.process_bytes( (unsigned char const*)rd_, sizeof( rd_ ) );
+
+        unsigned int digest[ 5 ];
+        sha.get_digest( digest );
+
+        for( int i = 0; i < 5; ++i )
+        {
+            // harmless data race
+            ps[ i ] ^= digest[ i ];
+            rd_[ i ] ^= digest[ i ];
+        }
+    }
+
+private:
+    unsigned int rd_[5];
+    int rd_index_;
+};
+
+// almost a copy of boost::generator_iterator
+// but default constructor sets m_g to NULL
+template <class Generator>
+class generator_iterator
+  : public iterator_facade<
+        generator_iterator<Generator>
+      , typename Generator::result_type
+      , single_pass_traversal_tag
+      , typename Generator::result_type const&
+    >
+{
+    typedef iterator_facade<
+        generator_iterator<Generator>
+      , typename Generator::result_type
+      , single_pass_traversal_tag
+      , typename Generator::result_type const&
+    > super_t;
+    
+ public:
+    generator_iterator() : m_g(NULL) {}
+    generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
+
+    void increment()
+    {
+        m_value = (*m_g)();
+    }
+
+    const typename Generator::result_type&
+    dereference() const
+    {
+        return m_value;
+    }
+
+    bool equal(generator_iterator const& y) const
+    {
+        return this->m_g == y.m_g && this->m_value == y.m_value;
+    }
+
+ private:
+    Generator* m_g;
+    typename Generator::result_type m_value;
+};
+
+// seed() seeds a random number generator with good seed values
+
+template <typename UniformRandomNumberGenerator>
+inline void seed(UniformRandomNumberGenerator& rng)
+{
+    seed_rng seed_gen;
+    generator_iterator<seed_rng> begin(&seed_gen);
+    generator_iterator<seed_rng> end;
+    rng.seed(begin, end);
+}
+
+// random_device does not / can not be seeded
+template <>
+inline void seed<boost::random_device>(boost::random_device&) {}
+
+// random_device does not / can not be seeded
+template <>
+inline void seed<seed_rng>(seed_rng&) {}
+
+}}} //namespace boost::uuids::detail
+
+#endif



Property changes on: trunk/external/boost/uuid/boost/uuid/seed_rng.hpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: sha1.hpp
Delta lines: +209 -0
===================================================================
--- trunk/external/boost/uuid/boost/uuid/sha1.hpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/boost/uuid/sha1.hpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,209 @@
+// boost/uuid/sha1.hpp header file  ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History
+//  29 May 2007 - Initial Revision
+//  25 Feb 2008 - moved to namespace boost::uuids::detail
+
+// This is a byte oriented implementation
+// Note: this implementation does not handle message longer than
+//       2^32 bytes.
+
+#ifndef BOOST_UUID_SHA1_H
+#define BOOST_UUID_SHA1_H
+
+#include <boost/static_assert.hpp>
+#include <cstddef>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+    using ::size_t;
+} // namespace std
+#endif
+
+namespace boost {
+namespace uuids {
+namespace detail {
+
+BOOST_STATIC_ASSERT(sizeof(unsigned char)*8 == 8);
+BOOST_STATIC_ASSERT(sizeof(unsigned int)*8 == 32);
+
+inline unsigned int left_rotate(unsigned int x, std::size_t n)
+{
+    return (x<<n) ^ (x>> (32-n));
+}
+
+class sha1
+{
+public:
+    typedef unsigned int(&digest_type)[5];
+public:
+    sha1();
+
+    void reset();
+
+    void process_byte(unsigned char byte);
+    void process_block(void const* bytes_begin, void const* bytes_end);
+    void process_bytes(void const* buffer, std::size_t byte_count);
+
+    void get_digest(digest_type digest);
+
+private:
+    void process_block();
+
+private:
+    unsigned int h_[5];
+
+    unsigned char block_[64];
+
+    std::size_t block_byte_index_;
+    std::size_t byte_count_;
+};
+
+inline sha1::sha1()
+{
+    reset();
+}
+
+inline void sha1::reset()
+{
+    h_[0] = 0x67452301;
+    h_[1] = 0xEFCDAB89;
+    h_[2] = 0x98BADCFE;
+    h_[3] = 0x10325476;
+    h_[4] = 0xC3D2E1F0;
+
+    block_byte_index_ = 0;
+    byte_count_ = 0;
+}
+
+inline void sha1::process_byte(unsigned char byte)
+{
+    block_[block_byte_index_++] = byte;
+    ++byte_count_;
+    if (block_byte_index_ == 64) {
+        block_byte_index_ = 0;
+        process_block();
+    }
+}
+
+inline void sha1::process_block(void const* bytes_begin, void const* bytes_end)
+{
+    unsigned char const* begin = static_cast<unsigned char const*>(bytes_begin);
+    unsigned char const* end = static_cast<unsigned char const*>(bytes_end);
+    for(; begin != end; ++begin) {
+        process_byte(*begin);
+    }
+}
+
+inline void sha1::process_bytes(void const* buffer, std::size_t byte_count)
+{
+    unsigned char const* b = static_cast<unsigned char const*>(buffer);
+    process_block(b, b+byte_count);
+}
+
+inline void sha1::process_block()
+{
+    unsigned int w[80];
+    for (std::size_t i=0; i<16; ++i) {
+        w[i]  = (block_[i*4 + 0] << 24);
+        w[i] |= (block_[i*4 + 1] << 16);
+        w[i] |= (block_[i*4 + 2] << 8);
+        w[i] |= (block_[i*4 + 3]);
+    }
+    for (std::size_t i=16; i<80; ++i) {
+        w[i] = left_rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1);
+    }
+
+    unsigned int a = h_[0];
+    unsigned int b = h_[1];
+    unsigned int c = h_[2];
+    unsigned int d = h_[3];
+    unsigned int e = h_[4];
+
+    for (std::size_t i=0; i<80; ++i) {
+        unsigned int f;
+        unsigned int k;
+
+        if (i<20) {
+            f = (b & c) | (~b & d);
+            k = 0x5A827999;
+        } else if (i<40) {
+            f = b ^ c ^ d;
+            k = 0x6ED9EBA1;
+        } else if (i<60) {
+            f = (b & c) | (b & d) | (c & d);
+            k = 0x8F1BBCDC;
+        } else {
+            f = b ^ c ^ d;
+            k = 0xCA62C1D6;
+        }
+
+        unsigned temp = left_rotate(a, 5) + f + e + k + w[i];
+        e = d;
+        d = c;
+        c = left_rotate(b, 30);
+        b = a;
+        a = temp;
+    }
+
+    h_[0] += a;
+    h_[1] += b;
+    h_[2] += c;
+    h_[3] += d;
+    h_[4] += e;
+}
+
+inline void sha1::get_digest(digest_type digest)
+{
+    std::size_t bit_count = byte_count_*8;
+
+    // append the bit '1' to the message
+    process_byte(0x80);
+
+    // append k bits '0', where k is the minimum number >= 0
+    // such that the resulting message length is congruent to 56 (mod 64)
+    // check if there is enough space for padding and bit_count
+    if (block_byte_index_ > 56) {
+        // finish this block
+        while (block_byte_index_ != 0) {
+            process_byte(0);
+        }
+
+        // one more block
+        while (block_byte_index_ < 56) {
+            process_byte(0);
+        }
+    } else {
+        while (block_byte_index_ < 56) {
+            process_byte(0);
+        }
+    }
+
+    // append length of message (before pre-processing) 
+    // as a 64-bit big-endian integer
+    process_byte(0);
+    process_byte(0);
+    process_byte(0);
+    process_byte(0);
+    process_byte( static_cast<unsigned char>((bit_count>>24) & 0xFF));
+    process_byte( static_cast<unsigned char>((bit_count>>16) & 0xFF));
+    process_byte( static_cast<unsigned char>((bit_count>>8 ) & 0xFF));
+    process_byte( static_cast<unsigned char>((bit_count)     & 0xFF));
+
+    // get final digest
+    digest[0] = h_[0];
+    digest[1] = h_[1];
+    digest[2] = h_[2];
+    digest[3] = h_[3];
+    digest[4] = h_[4];
+}
+
+
+}}} // namespace boost::uuids::detail
+
+#endif



Property changes on: trunk/external/boost/uuid/boost/uuid/sha1.hpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: uuid.hpp
Delta lines: +419 -0
===================================================================
--- trunk/external/boost/uuid/boost/uuid/uuid.hpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/boost/uuid/uuid.hpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,419 @@
+// Boost uuid.hpp header file  ----------------------------------------------//
+
+// Copyright 2006 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History
+//  06 Feb 2006 - Initial Revision
+//  09 Nov 2006 - fixed variant and version bits for v4 guids
+//  13 Nov 2006 - added serialization
+//  17 Nov 2006 - added name-based guid creation
+//  20 Nov 2006 - add fixes for gcc (from Tim Blechmann)
+//  07 Mar 2007 - converted to header only
+//  10 May 2007 - removed need for Boost.Thread
+//              - added better seed - thanks Peter Dimov
+//              - removed null()
+//              - replaced byte_count() and output_bytes() with size() and begin() and end()
+//  11 May 2007 - fixed guid(ByteInputIterator first, ByteInputIterator last)
+//              - optimized operator>>
+//  14 May 2007 - converted from guid to uuid
+//  29 May 2007 - uses new implementation of sha1
+//  01 Jun 2007 - removed using namespace directives
+//  09 Nov 2007 - moved implementation to uuid.ipp file
+//  12 Nov 2007 - moved serialize code to uuid_serialize.hpp file
+//  25 Feb 2008 - moved to namespace boost::uuids
+
+#ifndef BOOST_UUID_HPP
+#define BOOST_UUID_HPP
+
+#include <boost/config.hpp>
+#include <boost/operators.hpp>
+#include <boost/array.hpp>
+#include <boost/io/ios_state.hpp>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/uuid/seed_rng.hpp>
+#include <boost/random/detail/ptr_helper.hpp>
+#include <iosfwd>
+#include <limits>
+#include <sstream>
+#include <string>
+#include <algorithm>
+#include <locale>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+    using ::size_t
+} //namespace std
+#endif
+
+namespace boost {
+namespace uuids {
+
+class uuid : boost::totally_ordered<uuid>
+{
+    typedef array<uint8_t, 16> data_type;
+
+public:
+    typedef data_type::value_type value_type;
+    typedef data_type::const_iterator const_iterator;
+    typedef data_type::difference_type difference_type;
+    typedef data_type::size_type size_type;
+
+public:
+    uuid() /* throw() */
+    {
+        for (data_type::iterator i=data_.begin(); i!=data_.end(); ++i) {
+            *i = 0;
+        }
+    }
+
+    explicit uuid(char const*const str)
+    {
+        if (str == NULL) throw_invalid_argument("invalid uuid string");
+
+        construct(std::string(str));
+    }
+
+#ifndef BOOST_NO_STD_WSTRING
+    explicit uuid(wchar_t const*const str)
+    {
+        if (str == NULL) throw_invalid_argument("invalid uuid string");
+
+        construct(std::wstring(str));
+    }
+#endif
+
+    template <typename ch, typename char_traits, typename alloc>
+        explicit uuid(std::basic_string<ch, char_traits, alloc> const& str)
+    {
+        construct(str);
+    }
+
+    template <typename ByteInputIterator>
+        uuid(ByteInputIterator first, ByteInputIterator last)
+    {
+        data_type::iterator i_data = data_.begin();
+        size_type i;
+        for (i=0; i<16 && first != last; ++i) {
+            *i_data++ = numeric_cast<uint8_t>(*first++);
+        }
+        if (i != 16) {
+            throw_invalid_argument("invalid input iterator pair, must span 16 bytes");
+        }
+    }
+
+    uuid(uuid const& rhs) /* throw() */
+        : data_(rhs.data_)
+    {}
+
+    ~uuid() /* throw() */
+    {}
+
+    uuid& operator=(uuid const& rhs) /* throw() */
+    {
+        data_ = rhs.data_;
+        return *this;
+    }
+
+    bool operator==(uuid const& rhs) const /* throw() */
+    {
+        return (data_ == rhs.data_);
+    }
+
+    bool operator<(uuid const& rhs) const /* throw() */
+    {
+        return (data_ < rhs.data_);
+    }
+
+    bool is_null() const /* throw() */
+    {
+        for (data_type::const_iterator i=data_.begin(); i!=data_.end(); ++i) {
+            if (*i != 0) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    std::string to_string() const
+    {
+        return to_basic_string<std::string::value_type, std::string::traits_type, std::string::allocator_type>();
+    }
+
+#ifndef BOOST_NO_STD_WSTRING
+    std::wstring to_wstring() const
+    {
+        return to_basic_string<std::wstring::value_type, std::wstring::traits_type, std::wstring::allocator_type>();
+    }
+#endif
+
+    template <typename ch, typename char_traits, typename alloc>
+        std::basic_string<ch, char_traits, alloc> to_basic_string() const
+    {
+        std::basic_string<ch, char_traits, alloc> s;
+        std::basic_stringstream<ch, char_traits, alloc> ss;
+        if (!(ss << *this) || !(ss >> s)) {
+            throw_runtime_error("failed to convert uuid to string");
+        }
+        return s;
+    }
+
+    size_type size() const { return data_.size(); } /* throw() */
+    const_iterator begin() const { return data_.begin(); } /* throw() */
+    const_iterator end() const { return data_.end(); } /* throw() */
+
+    void swap(uuid &rhs) /* throw() */
+    {
+        std::swap(data_, rhs.data_);
+    }
+
+public:
+    static uuid create(uuid const& namespace_uuid, char const* name, int name_length)
+    {
+        return create_name_based(namespace_uuid, name, name_length);
+    }
+
+private:
+    template <typename ch, typename char_traits, typename alloc>
+        void construct(std::basic_string<ch, char_traits, alloc> const& str)
+    {
+        std::basic_stringstream<ch, char_traits, alloc> ss;
+        if (!(ss << str) || !(ss >> *this)) {
+            throw_invalid_argument("invalid uuid string");
+        }
+    }
+
+    void throw_invalid_argument(char const*const message) const;
+    void throw_runtime_error(char const*const message) const;
+
+private:
+    // name based
+    static inline uuid create_name_based(uuid const& namespace_uuid, char const* name, int name_length);
+
+    friend bool get_showbraces(std::ios_base&);
+    friend void set_showbraces(std::ios_base&, bool);
+    static int get_showbraces_index()
+    {
+        static int index = std::ios_base::xalloc();
+        return index;
+    }
+
+private:
+    data_type data_;
+};
+
+inline void swap(uuid &x, uuid &y)
+{
+    x.swap(y);
+}
+
+inline bool get_showbraces(std::ios_base & iosbase) {
+    return (iosbase.iword(uuid::get_showbraces_index()) != 0);
+}
+
+inline void set_showbraces(std::ios_base & iosbase, bool showbraces) {
+    iosbase.iword(uuid::get_showbraces_index()) = showbraces;
+}
+
+inline std::ios_base& showbraces(std::ios_base& iosbase)
+{
+    set_showbraces(iosbase, true);
+    return iosbase;
+}
+inline std::ios_base& noshowbraces(std::ios_base& iosbase)
+{
+    set_showbraces(iosbase, false);
+    return iosbase;
+}
+
+template <typename UniformRandomNumberGenerator>
+class basic_uuid_generator
+{
+private:
+    typedef boost::uniform_int<unsigned long> distribution_type;
+    typedef random::detail::ptr_helper<UniformRandomNumberGenerator> helper_type;
+    
+    typedef boost::variate_generator<typename helper_type::reference_type, distribution_type> v_gen_type;
+
+public:
+    typedef uuid result_type;
+
+    explicit basic_uuid_generator(UniformRandomNumberGenerator rng)
+        : _rng(rng)
+        , _v_gen(helper_type::ref(_rng),
+                 distribution_type(
+                     (std::numeric_limits<unsigned long>::min)(),
+                     (std::numeric_limits<unsigned long>::max)())
+                 )
+    {
+        // don't seed generators that are passed in
+        //detail::seed<helper_type::value_type>(helper_type::ref(_rng));
+    }
+
+    basic_uuid_generator()
+        : _v_gen(helper_type::ref(_rng),
+                 distribution_type(
+                     (std::numeric_limits<unsigned long>::min)(),
+                     (std::numeric_limits<unsigned long>::max)())
+                 )
+    {
+        // seed generator with good values
+        detail::seed<typename helper_type::value_type>(helper_type::ref(_rng));
+    }
+
+    uuid operator()()
+    {
+        BOOST_STATIC_ASSERT(16 % sizeof(unsigned long) == 0);
+        unsigned char data[16];
+
+        for (std::size_t i=0; i<16; i+=sizeof(unsigned long))
+        {
+            *reinterpret_cast<unsigned long*>(&data[i]) = _v_gen();
+        }
+
+        // set variant
+        // should be 0b10xxxxxx
+        data[8] &= 0xBF;
+        data[8] |= 0x80;
+
+        // set version
+        // should be 0b0100xxxx
+        data[6] &= 0x4F; //0b01001111
+        data[6] |= 0x40; //0b01000000
+
+        return uuid(data, data+16);
+    }
+
+private:
+    // note these must be in this order so that _rng is created before _v_gen
+    UniformRandomNumberGenerator _rng;
+    v_gen_type _v_gen;
+};
+
+typedef basic_uuid_generator<mt19937> uuid_generator;
+
+// This is equivalent to boost::hash_range(u.begin(), u.end());
+inline std::size_t hash_value(uuid const& u)
+{
+    std::size_t seed = 0;
+    for(uuid::const_iterator i=u.begin(); i != u.end(); ++i)
+    {
+        seed ^= static_cast<std::size_t>(*i) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+    }
+
+    return seed;
+}
+
+template <typename ch, typename char_traits>
+    std::basic_ostream<ch, char_traits>& operator<<(std::basic_ostream<ch, char_traits> &os, uuid const& u)
+{
+    io::ios_flags_saver flags_saver(os);
+    io::ios_width_saver width_saver(os);
+    io::basic_ios_fill_saver<ch, char_traits> fill_saver(os);
+
+    const typename std::basic_ostream<ch, char_traits>::sentry ok(os);
+    if (ok) {
+        bool showbraces = get_showbraces(os);
+        if (showbraces) {
+            os << os.widen('{');
+        }
+        os << std::hex;
+        os.fill(os.widen('0'));
+
+        std::size_t i=0;
+        for (uuid::const_iterator i_data = u.begin(); i_data!=u.end(); ++i_data, ++i) {
+            os.width(2);
+            os << static_cast<unsigned int>(*i_data);
+            if (i == 3 || i == 5 || i == 7 || i == 9) {
+                os << os.widen('-');
+            }
+        }
+        if (showbraces) {
+            os << os.widen('}');
+        }
+    }
+    return os;
+}
+
+template <typename ch, typename char_traits>
+    std::basic_istream<ch, char_traits>& operator>>(std::basic_istream<ch, char_traits> &is, uuid &u)
+{
+    const typename std::basic_istream<ch, char_traits>::sentry ok(is);
+    if (ok) {
+        unsigned char data[16];
+
+        typedef std::ctype<ch> ctype_t;
+        ctype_t const& ctype = std::use_facet<ctype_t>(is.getloc());
+
+        ch xdigits[16];
+        {
+            char szdigits[17] = "0123456789ABCDEF";
+            ctype.widen(szdigits, szdigits+16, xdigits);
+        }
+        ch*const xdigits_end = xdigits+16;
+
+        ch c;
+        c = is.peek();
+        bool bHaveBraces = false;
+        if (c == is.widen('{')) {
+            bHaveBraces = true;
+            is >> c; // read brace
+        }
+
+        for (std::size_t i=0; i<u.size() && is; ++i) {
+            is >> c;
+            c = ctype.toupper(c);
+
+            ch* f = std::find(xdigits, xdigits_end, c);
+            if (f == xdigits_end) {
+                is.setstate(std::ios_base::failbit);
+                break;
+            }
+
+            unsigned char byte = static_cast<unsigned char>(std::distance(&xdigits[0], f));
+
+            is >> c;
+            c = ctype.toupper(c);
+            f = std::find(xdigits, xdigits_end, c);
+            if (f == xdigits_end) {
+                is.setstate(std::ios_base::failbit);
+                break;
+            }
+
+            byte <<= 4;
+            byte |= static_cast<unsigned char>(std::distance(&xdigits[0], f));
+
+            data[i] = byte;
+
+            if (is) {
+                if (i == 3 || i == 5 || i == 7 || i == 9) {
+                    is >> c;
+                    if (c != is.widen('-')) is.setstate(std::ios_base::failbit);
+                }
+            }
+        }
+
+        if (bHaveBraces && is) {
+            is >> c;
+            if (c != is.widen('}')) is.setstate(std::ios_base::failbit);
+        }
+        if (is) {
+            u = uuid(data, data+16);
+        }
+    }
+    return is;
+}
+
+}} //namespace boost::uuids
+
+#include <boost/uuid/uuid.ipp>
+
+#endif // BOOST_UUID_HPP



Property changes on: trunk/external/boost/uuid/boost/uuid/uuid.hpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: uuid.ipp
Delta lines: +61 -0
===================================================================
--- trunk/external/boost/uuid/boost/uuid/uuid.ipp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/boost/uuid/uuid.ipp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,61 @@
+// Boost uuid.ipp header file  ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History
+//  08 Nov 2007 - Initial Revision
+//  25 Feb 2008 - Moved to namespace boost::uuids
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/sha1.hpp>
+#include <boost/generator_iterator.hpp>
+#include <boost/throw_exception.hpp>
+#include <stdexcept>
+
+namespace boost {
+namespace uuids {
+
+inline uuid uuid::create_name_based(uuid const& namespace_uuid, char const* name, int name_length)
+{
+    detail::sha1 sha;
+    sha.process_bytes(namespace_uuid.data_.data(), namespace_uuid.data_.static_size);
+    sha.process_bytes(name, name_length);
+    unsigned int digest[5];
+
+    sha.get_digest(digest);
+
+    unsigned char data[16];
+    for (int i=0; i<4; ++i) {
+        data[i*4+0] = ((digest[i] >> 24) & 0xFF);
+        data[i*4+1] = ((digest[i] >> 16) & 0xFF);
+        data[i*4+2] = ((digest[i] >> 8) & 0xFF);
+        data[i*4+3] = ((digest[i] >> 0) & 0xFF);
+    }
+
+    // set variant
+    // should be 0b10xxxxxx
+    data[8] &= 0xBF;
+    data[8] |= 0x80;
+
+    // set version
+    // should be 0b0101xxxx
+    data[6] &= 0x5F; //0b01011111
+    data[6] |= 0x50; //0b01010000
+
+    return uuid(data, data+16);
+}
+
+inline void uuid::throw_invalid_argument(char const*const message) const
+{
+    boost::throw_exception(std::invalid_argument(message));
+}
+
+inline void uuid::throw_runtime_error(char const*const message) const
+{
+    boost::throw_exception(std::runtime_error(message));
+}
+
+}} //namespace boost::uuids



Property changes on: trunk/external/boost/uuid/boost/uuid/uuid.ipp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: uuid_serialize.hpp
Delta lines: +53 -0
===================================================================
--- trunk/external/boost/uuid/boost/uuid/uuid_serialize.hpp	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/boost/uuid/uuid_serialize.hpp	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,53 @@
+// Boost uuid_serialize.hpp header file  ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Revision History
+//  12 Nov 2007 - Initial Revision
+//  25 Feb 2008 - moved to namespace boost::uuids::detail
+
+#ifndef BOOST_UUID_SERIALIZE_HPP
+#define BOOST_UUID_SERIALIZE_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/serialization/level.hpp>
+//#include <boost/serialization/tracking.hpp>
+//#include <boost/serialization/split_free.hpp>
+//#include <boost/serialization/nvp.hpp>
+//#include <boost/serialization/access.hpp>
+
+BOOST_CLASS_IMPLEMENTATION(boost::uuids::uuid, boost::serialization::primitive_type)
+
+//BOOST_SERIALIZATION_SPLIT_FREE(boost::uuids::uuid)
+
+//namespace boost {
+//namespace serialization {
+
+//template <class Archive>
+//inline void save(Archive& ar, boost::uuids::uuid const& u, const unsigned int /*file_version*/)
+//{
+//  uuid::const_iterator end = u.end();
+//  for (uuid::const_iterator begin = u.begin(); begin!=end; ++begin) {
+//      //ar & boost::serialization::make_nvp("item", (*begin));
+//      ar & (*begin);
+//  }
+//}
+
+//template <class Archive>
+//inline void load(Archive& ar, boost::uuids::uuid& u, const unsigned int /*file_version*/)
+//{
+//  boost::uuids::uuid::value_type data[16];
+//  for (int i=0; i<16; ++i) {
+//      //ar & boost::serialization::make_nvp("item", data[i]);
+//      ar & data[i];
+//  }
+//  u = boost::uuids::uuid(&data[0], &data[0]+16);
+//}
+
+//} // namespace serialization
+//} // namespace boost
+
+#endif // BOOST_UUID_SERIALIZE_HPP



Property changes on: trunk/external/boost/uuid/boost/uuid/uuid_serialize.hpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


Directory: /trunk/external/boost/uuid/libs/uuid/
================================================

File [added]: index.html
Delta lines: +43 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/index.html	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/index.html	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,43 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Boost Uuid Library</title>
+</head>
+
+<body bgcolor="#FFFFFF" text="#000000">
+
+<table border="1" bgcolor="#007F7F" cellpadding="2">
+  <tr>
+    <td bgcolor="#FFFFFF"><img src="../../boost.png" alt="boost.png (6897 bytes)" WIDTH="277" HEIGHT="86"></td>
+    <td><a href="../../index.htm"><font face="Arial" color="#FFFFFF"><big>Home </big></font></a></td>
+    <td><a href="../libraries.htm"><font face="Arial" color="#FFFFFF"><big>Libraries </big></font></a></td>
+    <td><a href="../../people/people.htm"><font face="Arial" color="#FFFFFF"><big>People </big></font></a></td>
+    <td><a href="../../more/faq.htm"><font face="Arial" color="#FFFFFF"><big>FAQ </big></font></a></td>
+    <td><a href="../../more/index.htm"><font face="Arial" color="#FFFFFF"><big>More </big></font></a></td>
+  </tr>
+</table>
+
+<h1>Uuid library</h1>
+
+<p>The header uuid.hpp provides an implementation of Universally Unique Identifiers.
+</p>
+
+<p>This implementation is intended for general use.</p>
+
+<ul>
+  <li><a href="uuid.html">Documentation</a> (HTML).</li>
+  <li>Header <a href="../../boost/uuid.hpp">uuid.hpp</a>.</li>
+  <li>See the <a href="uuid.html">documentation</a> for links to sample programs.</li>
+  <li>Submitted by Andy Tompkins</a>.</li>
+</ul>
+
+<p>Revised&nbsp; May 14, 2007</p>
+
+<hr>
+<p>© Copyright Andy Tompkins, 2006</p>
+<p> Distributed under the Boost Software 
+License, Version 1.0. (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
+www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
+</html>



Property changes on: trunk/external/boost/uuid/libs/uuid/index.html
___________________________________________________________________
Name: svn:mime-type
   + text/html
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native


File [added]: uuid.html
Delta lines: +346 -0
===================================================================
--- trunk/external/boost/uuid/libs/uuid/uuid.html	2009-01-25 02:08:34 UTC (rev 3387)
+++ trunk/external/boost/uuid/libs/uuid/uuid.html	2009-01-25 03:57:51 UTC (rev 3388)
@@ -0,0 +1,346 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<title>Uuid Library</title>
+</head>
+<body>
+<h1><img src="../../boost.png" alt="boost.png (6897 bytes)"
+     align="center" WIDTH="277" HEIGHT="86">
+Uuid</h1>
+
+<h2><a name="Contents">Contents</h2>
+
+<ol>
+    <li><a href="#Class uuid synopsis">Class uuid synopsis</a></li>
+    <li><a href="#Rationale">Rationale</a></li>
+    <li><a href="#Interface">Interface</a></li>
+    <ul>
+    <li><a href="#Constructors">Constructors</a></li>
+    <li><a href="#Operators">Operators</a></li>
+    <li><a href="#Input and Output">Input and Output</a></li>
+    <li><a href="#Representation">Representation</a></li>
+    <li><a href="#Nullness">Nullness</a></li>
+    <li><a href="#ByteExtraction">Byte Extraction</a></li>
+    <li><a href="#Hash">Hash Function</a></li>
+    <li><a href="#StreamManipulators">Stream Manipulators</a></li>
+    <li><a href="#Creation">Creation</a></li>
+    </ul>
+    <li><a href="#Serialization">Serialization</a></li>
+    <li><a href="#Exceptions">Exceptions</a></li>
+    <li><a href="#Design notes">Design notes</a></li>
+    <li><a href="#References">References</a></li>
+    <li><a href="#History and Acknowledgements">History and Acknowledgements</a></li>
+</ol>
+
+<h2><a name="Class uuid synopsis">Class uuid synopsis</h2>
+<pre>
+#include &lt;boost/uuid.hpp&gt;
+
+namespace boost {
+namespace uuids {
+
+class uuid {
+public:
+    typedef uint8_t value_type;
+    typedef <i>unspecified</i> const_iterator;
+    typedef <i>unspecified</i> difference_type;
+    typedef <i>unspecified</i> size_type;
+
+    // Constructors 
+    uuid();
+    explicit uuid(char const*const str);
+    explicit uuid(wchar_t const*const str);
+    template &lt;typename ch, typename char_traits, typename alloc&gt
+        explicit uuid(std::basic_string&lt;ch, char_traits, alloc&gt const& str);
+    template &lt;typename ByteInputIterator&gt
+        uuid(ByteInputIterator first, ByteInputIterator last);
+        
+    // Normal copy constructors and assignment operators and destructor
+    uuid(uuid const& rhs);
+    uuid& operator=(uuid const& rhs);
+    ~uuid();
+    
+    // Representation
+    std::string to_string() const;
+    std::wstring to_wstring() const;
+    template &lt;typename ch, typename char_traits, typename alloc&gt
+        std::basic_string&lt;ch, char_traits, alloc&gt to_basic_string() const;
+ 
+    // Nullness
+    bool is_null() const;
+    
+    // Byte Extractioin
+    size_type size() const;
+    const_iterator begin() const;
+    const_iterator end() const;
+        
+    // In addition to the following operators, all of the "obvious" derived 
+    // operators are available - see <a href=../utility/operators.htm>operators.hpp</a>
+    
+    // Comparison operators
+    bool operator==(uuid const& rhs) const;
+    bool operator&lt(uuid const& rhs) const;
+
+    // Swap function
+    void swap(uuid &rhs);
+
+    // Static functions
+    static uuid create(uuid const& namespace_uuid, char const* name, int name_length);
+};
+
+// functor to generate random number based uuids
+tempate &lt;typename UniformRandomNumberGenerator&gt
+class basic_uuid_generator
+{
+public:
+    typedef uuid result_type;
+
+    basic_uuid_generator();
+    explicit basic_uuid_generator(UniformRandomNumberGenerator rng);
+
+    uuid operator()();
+};
+
+typedef basic_uuid_generator&lt;mt19937&gt uuid_generator;
+
+// Swap function
+void swap(uuid &x, uuid &y);
+
+// Stream manipulators
+bool get_showbraces(std::ios_base & iosbase);
+void set_showbraces(std::ios_base & iosbase, bool showbraces);
+    
+std::ios_base& showbraces(std::ios_base& iosbase);
+std::ios_base& noshowbraces(std::ios_base& iosbase);
+
+// Hash function
+std::size_t hash_value(uuid const& u);
+
+// Stream functions
+template &lt;typename ch, typename char_traits&gt
+    std::basic_ostream&lt;ch, char_traits&gt&
+    operator&lt&lt(std::basic_ostream&lt;ch, char_traits&gt &os, uuid const& u);
+    
+template &lt;typename ch, typename char_traits&gt
+    std::basic_istream&lt;ch, char_traits&gt& 
+    operator&gt&gt(std::basic_istream&lt;ch, char_traits&gt &is, uuid &u);
+
+}} // namespace boost::uuids
+</pre>
+
+<h2><a name="Rationale">Rationale</h2>
+
+A UUID, or Universally unique identifier, is indended to uniquely identify 
+information in a distributed environment without significant central 
+coordination.  It can be used to tag objects with very short lifetimes, or 
+to reliably identify very persistent objects across a network.
+<p>
+UUIDs have many applications.  Some examples follow:  Databases may use UUIDs 
+to identify rows or records in order to ensure that they are unique across 
+different databases, or for publication/subscription services.  Network messages 
+may be identified with a UUID to ensure that different parts of a message are put 
+back together again.  Distributed computing may use UUIDs to identify a remote 
+procedure call.  Transactions and classes involved in serialization may be 
+identified by UUIDs.  Microsoft's component object model (COM) uses UUIDs to 
+distinguish different software component interfaces.  UUIDs are inserted into 
+documents from Microsoft Office programs.  UUIDs identify audio or 
+video streams in the Advanced Systems Format (ASF).  UUIDs are also a basis 
+for OIDs (object identifiers), and URNs (uniform resource name).
+
+<p>
+An attractive feature of UUIDs when compared to alternatives is their relative 
+small size, of 128-bits, or 16-bytes.  Another is that the creation of UUIDs 
+does not require a centralized authority.
+
+<h2><a name="Interface">Interface</h2>
+
+<h3><a name="Constructors">Constructors</h3>
+<b>Uuid</b>s can be constructed from strings and byte arrays.  There is also a
+default constructor, which initializes the <b>uuid</b> to a null value.
+
+<p>This implies that the following statements are valid:
+
+<pre>
+    std::string s1("01234567-89ab-cdef-0123-456789abcdef");
+    char* s2 = "{01234567-89ab-cdef-0123-456789abcdef}";
+
+    std::vector&lt;char&gt; a;
+    ...
+    assert(a.size() >= 16);
+    
+    boost::uuids::uuid u1;
+    boost::uuids::uuid u2(s1);
+    boost::uuids::uuid u3(s2);
+    boost::uuids::uuid u4(a.begin(), a.end());
+</pre>
+
+<p>The single-argument constructors are declared as explicit so that 
+there is no implicit conversion from strings to <b>uuid</b>s.
+
+<p>If the text given to a constructor is not a valid representation, the 
+exception <tt>std::invalid_argument</tt> is thrown.  The exception 
+<tt>std::invalid_argument</tt> is also thrown if the iterators given to
+the constructor do not span at least 16 elements.
+
+<h3><a name="Operators">Operators</h3>
+All of the standard numeric operators are defined for the <b>uuid</b>
+class. These include:
+<br>
+
+<pre>
+    ==   !=
+    &lt;    &gt;
+    &lt;=   &gt;=
+</pre>
+
+<h3><a name="Input and Output">Input and Output</h3>
+Input and output operators <tt>&lt;&lt;</tt> and <tt>&gt;&gt;</tt>
+are provided. The external representation of a <b>uuid</b> is a string of 
+hexidecimal digits of the following forms:
+<br>
+hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh
+<br>
+{hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh}
+
+<h3><a name="Representation">Representation</h3>
+These are simple convenience functions for <tt>operator&lt&lt</tt>.  
+The exception <tt>std::runtime_error</tt> is thrown if an error 
+occurs.
+
+<pre>
+boost::uuids::uuid u;
+std::string s = u.to_string();
+</pre>
+is equivalent to
+<pre>
+boost::uuids::uuid u;
+std::string s;
+std::stringstream ss;
+ss << u;
+ss >> s;
+</pre>
+
+<h3><a name="Nullness">Nullness</h3>
+The function, <tt>boost::uuids::uuid::is_null()</tt> returns true if and 
+only if the <b>uuid</b> is equal to {00000000-0000-0000-0000-000000000000} 
+and returns false otherwise.  
+Note that <tt>boost::uuids::uuid().is_null() == true</tt>.
+
+<h3><a name="ByteExtraction">Byte Extraction</h3>
+These functions are useful to get at the 16 bytes of a <b>uuid</b>.  Typical use is as follows:
+
+<pre>
+boost::uuids::uuid u;
+std::vector&lt;char&gt; v(u.size());
+std::copy(u.begin(), u.end(), v.begin());
+</pre>
+
+<p>Note: <tt>boost::uuids::uuid::size()</tt> always returnes 16.
+
+<h3><a name="Hash">Hash Function</h3>
+This function allows <b>uuid</b>s to be used with 
+<a href="http://www.boost.org/doc/html/hash.html"><b>boost::hash</b></a>
+
+<pre>
+boost::hash&lt;boost::uuids::uuid&gt; uuid_hasher;
+std::size_t uuid_hash_value = uuid_hasher(boost::uuids::uuid());
+</pre>
+
+<h3><a name="StreamManipulators">Stream Manipulators</h3>
+
+These functions manipulate the flag to delimit the <b>uuid</b> with braces.  The default 
+is not to delimit the <b>uuid</b> with braces, (<tt>boost::uuids::noshowbraces</tt>).
+
+<pre>
+boost::uuids::uuid u;
+std::cout << boost::uuids::showbraces << u;
+// output "{00000000-0000-0000-0000-000000000000}"
+</pre>
+
+<h3><a name="Creation">Creation</h3>
+Two types of <b>uuid</b>s can be created, random number based, and 
+name based.
+
+<p>Random number based <b>uuid</b>s are created with a generator function object, 
+<tt>boost::uuids::basic_uuid_generator</tt>.  It uses a random number generator 
+(one that conforms to the <a href="http://www.boost.org/libs/random/random-concepts.html#uniform-rng">UniformRandomNumberGenerator</a>
+concept to produce the random numbers it needs to create the <b>uuid</b>.
+
+
+<pre>
+boost::uuids::uuid_generator gen1;
+boost::uuids::uuid u1 = gen1();
+
+boost::uuids::basic_uuid_generator&lt;boost::mt19937&gt; gen2;
+boost::uuids::uuid u2 = gen2();
+
+boost::random::mt19937 rng;
+boost::uuids::basic_uuid_generator&lt;boost::mt19937&gt; gen3;
+boost::uuids::uuid u3 = gen3();
+</pre>
+
+<p>Name based <b>uuid</b>s are created with the function, 
+<tt>boost::uuids::uuid::create(uuid const& namespace_uuid, char const* name, int name_length)</tt>.
+
+<pre>
+boost::uuids::uuid dns_namespace_uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8");
+boost::uuids::uuid u = boost::uuids::uuid::create(dns_namespace_uuid, "www.widgets.com", 15);
+assert(u == boost::uuids::uuid("21f7f8de-8051-5b89-8680-0195ef798b6a"));
+</pre>
+
+<h2><a name="Serialization">Serialization</h2>
+Serialization is accomplished with the <a href="http://www.boost.org/libs/serialization/doc/index.html">
+Boost Serialization</a> library.  A <b>uuid</b> is serialized as a 
+<a href="http://www.boost.org/libs/serialization/doc/serialization.html#primitiveoperators">
+primitive type</a>, thus only the <b>uuid</b> value will be saved to/loaded from an archive.
+<p>
+Include <a href="../../boost/uuid/uuid_serialize.hpp"><tt>boost/uuid/uuid_serialize.hpp</tt></a> to enable serialization for <b>uuid</b>s.
+
+<h2><a name="Exceptions">Exceptions</h2>
+All exceptions are thrown with <a href="http://www.boost.org/libs/utility/throw_exception.html"><tt>boost::throw_exception</tt></a>.  
+Constructors will throw an exception if the input is not valid.  An exception may be thrown 
+from the stream operators if an error occurs and the stream is set up to throw 
+exceptions.  All other functions never throw exceptions.
+
+<h2><a name="Design notes">Design notes</h2>
+The document,<a href=http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf>
+http://www.itu.int/ITU-T/studygroups/com17/oid/X.667-E.pdf</a>, was used to design 
+and implement the <b>boost::uuids::uuid</b> class.
+
+<p>The <tt>boost::uuids::uuid_generator::operator()</tt> function returns a
+random-number-based <b>uuid</b>.  The default random number generator
+is <a href="http://www.boost.org/libs/random/random-generators.html#mersenne_twister"><tt>boost::mt19937</tt></a> 
+from the <a href="http://www.boost.org/libs/random/">Boost Random</a> library.
+  It is seeded with a SHA-1 hash of a number of different values including
+<tt>std::time(0)</tt>, <tt>std::clock()</tt>, uninitialized data, value return from 
+<tt>new unsigned int</tt>, etc..
+
+<p>The <tt>boost::uuids::uuid::create(uuid const& namespace_uuid, char const* name, int name_length)</tt>
+function returns a name-based <b>uuid</b>.  It uses the SHA-1 hash function to
+compute the <b>uuid</b>.
+
+<p>All functions are re-entrant.  Classes are as thread-safe as an int.  That is an 
+instance can not be shared between threads without proper synchronization.
+
+<h2><a name="References">References</h2>
+<ul>
+<li>The uuid header: <a href="../../boost/uuid/uuid.hpp">uuid.hpp</a>
+<li>The test code: <a href="./test/test_uuid.cpp">test_uuid.cpp</a>, 
+<a href="./test/test_serialization.cpp">test_serialization.cpp</a>,
+<a href="./test/test_sha1.cpp">test_sha1.cpp</a>
+</ul>
+
+<h2><a name="History and Acknowledgements">History and Acknowledgements</h2>
+
+A number of people on the <a href="http://www.boost.org/">boost.org</a> 
+mailing list provided useful comments.
+
+<p>Revised&nbsp; October 12, 2008</p>
+
+<hr>
+<p>© Copyright Andy Tompkins, 2006</p>
+<p> Distributed under the Boost Software 
+License, Version 1.0. (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
+www.boost.org/LICENSE_1_0.txt</a>)</p>
+</body>
+</html>



Property changes on: trunk/external/boost/uuid/libs/uuid/uuid.html
___________________________________________________________________
Name: svn:mime-type
   + text/html
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native




More information about the saga-devel mailing list