summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct9
-rw-r--r--gtk2_ardour/SConscript1
-rw-r--r--libs/pbd/SConscript1
-rw-r--r--libs/pbd/id.cc46
-rw-r--r--libs/pbd/pbd/id.h22
5 files changed, 31 insertions, 48 deletions
diff --git a/SConstruct b/SConstruct
index 95664ec1ff..3fff60f04b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -454,15 +454,6 @@ conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new')
libraries['flac'] = conf.Finish ()
#
-# Check for UUID stuff
-
-libraries['uuid'] = LibraryInfo ()
-
-conf = Configure (libraries['uuid'])
-conf.CheckLib ('uuid', 'uuid_generate')
-libraries['uuid'] = conf.Finish ()
-
-#
# Check for liblo
if env['LIBLO']:
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript
index 8d66b9298c..68e07ebd22 100644
--- a/gtk2_ardour/SConscript
+++ b/gtk2_ardour/SConscript
@@ -42,7 +42,6 @@ gtkardour.Merge ([
libraries['gdkmm2'],
libraries['sigc2'],
libraries['gtk2'],
- libraries['uuid'],
libraries['xml'],
libraries['xslt'],
libraries['soundtouch'],
diff --git a/libs/pbd/SConscript b/libs/pbd/SConscript
index ba8d6ef91e..36fb02885f 100644
--- a/libs/pbd/SConscript
+++ b/libs/pbd/SConscript
@@ -50,7 +50,6 @@ if conf.CheckCHeader('execinfo.h'):
pbd = conf.Finish()
pbd.Merge ([ libraries['sigc2'],
- libraries['uuid'],
libraries['xml'],
libraries['glibmm2'],
libraries['glib2'] ])
diff --git a/libs/pbd/id.cc b/libs/pbd/id.cc
index 57ddb5b128..f483ff911c 100644
--- a/libs/pbd/id.cc
+++ b/libs/pbd/id.cc
@@ -1,17 +1,24 @@
#include <ostream>
#include <iostream>
+#include <stdio.h>
-#include <string.h>
-#include <uuid/uuid.h>
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+#include <inttypes.h>
#include <pbd/id.h>
using namespace std;
using namespace PBD;
+Glib::Mutex ID::counter_lock;
+uint64_t ID::_counter = 0;
+
ID::ID ()
{
- uuid_generate (id);
+ Glib::Mutex::Lock lm (counter_lock);
+ id = _counter++;
}
ID::ID (string str)
@@ -22,33 +29,14 @@ ID::ID (string str)
int
ID::string_assign (string str)
{
- /* first check for old-style all-numeric ID's */
-
- if (strcspn (str.c_str(), "0123456789") == 0) {
- /* all chars are numeric. just render the existing ID into the space in
- which we would otherwise store a UUID.
- */
-
- memset (id, ' ', sizeof (id));
- snprintf ((char*) id, sizeof (id), str.c_str());
-
- } else {
-
- /* OK, its UUID, probably */
-
- if (uuid_parse (str.c_str(), id)) {
- /* XXX error */
- return -1;
- }
- }
-
- return 0;
+ return sscanf (str.c_str(), "%" PRIu64, &id) != 0;
}
void
ID::print (char* buf) const
{
- uuid_unparse (id, buf);
+ /* XXX sizeof buf is unknown. bad API design */
+ snprintf (buf, 16, "%" PRIu64, id);
}
ID&
@@ -58,16 +46,10 @@ ID::operator= (string str)
return *this;
}
-bool
-ID::operator== (const ID& other) const
-{
- return memcmp (id, other.id, sizeof (id)) == 0;
-}
-
ostream&
operator<< (ostream& ostr, const ID& id)
{
- char buf[37];
+ char buf[32];
id.print (buf);
ostr << buf;
return ostr;
diff --git a/libs/pbd/pbd/id.h b/libs/pbd/pbd/id.h
index 95ac00bed0..e7e796fdc8 100644
--- a/libs/pbd/pbd/id.h
+++ b/libs/pbd/pbd/id.h
@@ -1,9 +1,11 @@
#ifndef __pbd_id_h__
#define __pbd_id_h__
-#include <uuid/uuid.h>
+#include <stdint.h>
#include <string>
+#include <glibmm/thread.h>
+
namespace PBD {
class ID {
@@ -11,21 +13,31 @@ class ID {
ID ();
ID (std::string);
- bool operator== (const ID& other) const;
+ bool operator== (const ID& other) const {
+ return id == other.id;
+ }
+
bool operator!= (const ID& other) const {
- return !operator== (other);
+ return id != other.id;
}
+
ID& operator= (std::string);
bool operator< (const ID& other) const {
- return memcmp (id, other.id, sizeof (id)) < 0;
+ return id < other.id;
}
void print (char* buf) const;
+ static uint64_t counter() { return _counter; }
+ static void init_counter (uint64_t val) { _counter = val; }
+
private:
- uuid_t id;
+ uint64_t id;
int string_assign (std::string);
+
+ static Glib::Mutex counter_lock;
+ static uint64_t _counter;
};
}