summaryrefslogtreecommitdiff
path: root/src/include/unique_id.h
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2009-11-03 00:31:47 +0000
committerMorgan Deters <mdeters@gmail.com>2009-11-03 00:31:47 +0000
commita101d3298691265ee4cf72bed1ca59cd60318839 (patch)
treef445dfe10bc6d3cf983609afc1217e3d1be2ddeb /src/include/unique_id.h
parent6b9eec8b8b03e6c67c73aa931001949f06fea5fb (diff)
commit of project structure including autotools support
Diffstat (limited to 'src/include/unique_id.h')
-rw-r--r--src/include/unique_id.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/include/unique_id.h b/src/include/unique_id.h
new file mode 100644
index 000000000..55fa24e51
--- /dev/null
+++ b/src/include/unique_id.h
@@ -0,0 +1,33 @@
+/********************* -*- C++ -*- */
+/** unique_id.h
+ ** This file is part of the CVC4 prototype.
+ **
+ ** The Analysis of Computer Systems Group (ACSys)
+ ** Courant Institute of Mathematical Sciences
+ ** New York University
+ **/
+
+#ifndef __CVC4_UNIQUE_ID_H
+#define __CVC4_UNIQUE_ID_H
+
+namespace CVC4 {
+
+// NOTE that UniqueID is intended for startup registration; it
+// shouldn't be used in multi-threaded contexts.
+
+template <class T>
+class UniqueID {
+ static unsigned s_topID;
+ const unsigned d_thisID;
+
+public:
+ UniqueID() : d_thisID( s_topID++ ) { }
+ operator unsigned() const { return d_thisID; }
+};
+
+template <class T>
+unsigned UniqueID<T>::s_topID = 0;
+
+} /* CVC4 namespace */
+
+#endif /* __CVC4_UNIQUE_ID_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback