extend PBD::ID API to allow construction and operator== using uint64_t
[ardour.git] / libs / pbd / id.cc
index d50782434931ea37fd38fbf2d9ffb05157c60f58..bc119b13dcb88e2db6583cdf37488bff410db9ef 100644 (file)
@@ -34,8 +34,9 @@ uint64_t ID::_counter = 0;
 void
 ID::init ()
 {
-       if (!counter_lock)
+       if (!counter_lock) {
                counter_lock = new Glib::Threads::Mutex;
+       }
 }
 
 ID::ID ()
@@ -50,14 +51,21 @@ ID::ID (const ID& other)
 
 ID::ID (string str)
 {
+       /* danger, will robinson: could result in non-unique ID */
        string_assign (str);
 }
 
+ID::ID (uint64_t n)
+{
+       /* danger, will robinson: could result in non-unique ID */
+       _id = n;
+}
+
 void
 ID::reset ()
 {
        Glib::Threads::Mutex::Lock lm (*counter_lock);
-       _id = _counter++;
+       _id = ++_counter;
 }
 
 bool