aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Common/Object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Common/Object.h')
-rw-r--r--src/libjin/Common/Object.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/libjin/Common/Object.h b/src/libjin/Common/Object.h
new file mode 100644
index 0000000..9ac1b5a
--- /dev/null
+++ b/src/libjin/Common/Object.h
@@ -0,0 +1,49 @@
+#ifndef __JIN_COMMON_OBJECT_H
+#define __JIN_COMMON_OBJECT_H
+
+namespace jin
+{
+
+ class Object
+ {
+ private:
+
+ // The reference count.
+ int count;
+
+ public:
+
+ /**
+ * Constructor. Sets reference count to one.
+ **/
+ Object();
+
+ /**
+ * Destructor.
+ **/
+ virtual ~Object() = 0;
+
+ /**
+ * Gets the reference count of this Object.
+ * @returns The reference count.
+ **/
+ int getReferenceCount() const;
+
+ /**
+ * Retains the Object, i.e. increases the
+ * reference count by one.
+ **/
+ void retain();
+
+ /**
+ * Releases one reference to the Object, i.e. decrements the
+ * reference count by one, and potentially deletes the Object
+ * if there are no more references.
+ **/
+ void release();
+
+ }; // Object
+
+}
+
+#endif \ No newline at end of file