diff options
author | Hans Fugal <hans@fugal.net> | 2006-08-04 02:18:45 +0000 |
---|---|---|
committer | Hans Fugal <hans@fugal.net> | 2006-08-04 02:18:45 +0000 |
commit | 79986643c0c904f6574bb5323e2233a43a9e622e (patch) | |
tree | 859323dbb096ac1658359881e7d11415b6588caa /libs/pbd/pbd/id.h | |
parent | b0b723445816bc968a6a183c6619fccc61e82859 (diff) |
r269@gandalf: fugalh | 2006-08-03 20:18:05 -0600
Trunk merge conflicts resolved
git-svn-id: svn://localhost/ardour2/branches/undo@756 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/id.h')
-rw-r--r-- | libs/pbd/pbd/id.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libs/pbd/pbd/id.h b/libs/pbd/pbd/id.h new file mode 100644 index 0000000000..9a3f10478d --- /dev/null +++ b/libs/pbd/pbd/id.h @@ -0,0 +1,47 @@ +#ifndef __pbd_id_h__ +#define __pbd_id_h__ + +#include <stdint.h> +#include <string> + +#include <glibmm/thread.h> + +namespace PBD { + +class ID { + public: + ID (); + ID (std::string); + + bool operator== (const ID& other) const { + return id == other.id; + } + + bool operator!= (const ID& other) const { + return id != other.id; + } + + ID& operator= (std::string); + + bool operator< (const ID& other) const { + return id < other.id; + } + + void print (char* buf) const; + + static uint64_t counter() { return _counter; } + static void init_counter (uint64_t val) { _counter = val; } + static void init (); + + private: + uint64_t id; + int string_assign (std::string); + + static Glib::Mutex* counter_lock; + static uint64_t _counter; +}; + +} +std::ostream& operator<< (std::ostream& ostr, const PBD::ID&); + +#endif /* __pbd_id_h__ */ |