attempt to be compliant with gcc 4.6 (assuming that its more compliant with standards...
[ardour.git] / libs / pbd / id.cc
index 642243a36aeeee8758dc15ea5822d50615f4585d..b96863b0fa7e13cec60a82f052e5260256c6f2ac 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 #include <inttypes.h>
 
-#include <pbd/id.h>
+#include "pbd/id.h"
 #include <string>
 
 using namespace std;
@@ -38,7 +38,8 @@ uint64_t ID::_counter = 0;
 void
 ID::init ()
 {
-       counter_lock = new Glib::Mutex;
+       if (!counter_lock)
+               counter_lock = new Glib::Mutex;
 }
 
 ID::ID ()
@@ -47,6 +48,11 @@ ID::ID ()
        _id = _counter++;
 }
 
+ID::ID (const ID& other)
+{
+       _id = other._id;
+}
+
 ID::ID (string str)
 {
        string_assign (str);
@@ -71,6 +77,12 @@ string ID::to_s() const
     return string(buf);
 }
 
+bool
+ID::operator== (const string& str) const
+{
+       return to_s() == str;
+}
+
 ID&
 ID::operator= (string str)
 {
@@ -78,6 +90,15 @@ ID::operator= (string str)
        return *this;
 }
 
+ID&
+ID::operator= (const ID& other)
+{
+       if (&other != this) {
+               _id = other._id;
+       }
+       return *this;
+}
+
 ostream&
 operator<< (ostream& ostr, const ID& _id)
 {