X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fid.cc;h=b96863b0fa7e13cec60a82f052e5260256c6f2ac;hb=df46ab2c02d39d9c09cb95d0d2d4268c47168eee;hp=642243a36aeeee8758dc15ea5822d50615f4585d;hpb=2e8f80e37a7d20deb3f138cd72c26f8c6de9d1ab;p=ardour.git diff --git a/libs/pbd/id.cc b/libs/pbd/id.cc index 642243a36a..b96863b0fa 100644 --- a/libs/pbd/id.cc +++ b/libs/pbd/id.cc @@ -26,7 +26,7 @@ #endif #include -#include +#include "pbd/id.h" #include 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) {