[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "retry_deux" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon May 7 18:33:39 CDT 2012


branch "retry_deux" has been updated
       via  3568870f0cd6ef05b817a378575a091495e7d002 (commit)
      from  adc2491f9e90e8d81d61eea9329416fc8df34e21 (commit)

Summary of changes:
 src/Operations/OperationContext.cpp |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 3568870f0cd6ef05b817a378575a091495e7d002
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon May 7 18:33:50 2012 -0500

    Use boost for uuid generation.

diff --git a/src/Operations/OperationContext.cpp b/src/Operations/OperationContext.cpp
index b338425..dbb369b 100755
--- a/src/Operations/OperationContext.cpp
+++ b/src/Operations/OperationContext.cpp
@@ -13,7 +13,11 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
-#include <IceUtil/UUID.h>
+#include <boost/thread.hpp>
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_generators.hpp>
+#include <boost/uuid/uuid_io.hpp>
+
 #include <AsteriskSCF/System/OperationsIf.h>
 #include <AsteriskSCF/Operations/OperationContext.h>
 
@@ -24,14 +28,28 @@ namespace AsteriskSCF
 namespace Operations
 {
 
-    
+boost::thread_specific_ptr<boost::uuids::random_generator> uuidGenerator;
+
+std::string getUuid()
+{
+    boost::uuids::random_generator *gen = uuidGenerator.get();
+    if (gen == 0) 
+    {
+        gen = new boost::uuids::random_generator;
+        uuidGenerator.reset(gen);
+    }
+    boost::uuids::uuid u = (*gen)();
+
+    return boost::uuids::to_string(u);
+}
+
 /**
  * Create a new OperationContext with a new transaction id. 
  */
 OperationContextPtr createContext()
 {
     AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
-    newContext->id = IceUtil::generateUUID();
+    newContext->id = getUuid();
 
     // To make it easy to identify the "source" operation id, we set the transaction id to the 
     // same value as the original OperationContext id. 
@@ -46,7 +64,7 @@ OperationContextPtr createContext()
 OperationContextPtr createContext(const OperationContextPtr& operationContext)
 {
     AsteriskSCF::System::V1::OperationContextPtr newContext(new AsteriskSCF::System::V1::OperationContext);
-    newContext->id = IceUtil::generateUUID();
+    newContext->id = getUuid();
     newContext->transactionId = operationContext->transactionId;
     return newContext;
 }

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list