remove UUIDs as implemention of PBD::ID, use static counter (not finished - counter...
[ardour.git] / libs / pbd / pbd / id.h
1 #ifndef __pbd_id_h__
2 #define __pbd_id_h__
3
4 #include <stdint.h>
5 #include <string>
6
7 #include <glibmm/thread.h>
8
9 namespace PBD {
10
11 class ID {
12   public:
13         ID ();
14         ID (std::string);
15         
16         bool operator== (const ID& other) const {
17                 return id == other.id; 
18         }
19
20         bool operator!= (const ID& other) const {
21                 return id != other.id;
22         }
23
24         ID& operator= (std::string); 
25
26         bool operator< (const ID& other) const {
27                 return id < other.id;
28         }
29
30         void print (char* buf) const;
31         
32         static uint64_t counter() { return _counter; }
33         static void init_counter (uint64_t val) { _counter = val; }
34
35   private:
36         uint64_t id;
37         int string_assign (std::string);
38
39         static Glib::Mutex counter_lock;
40         static uint64_t _counter;
41 };
42
43 }
44 std::ostream& operator<< (std::ostream& ostr, const PBD::ID&);
45
46 #endif /* __pbd_id_h__ */