summaryrefslogtreecommitdiff
path: root/src/core/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/object.h')
-rw-r--r--src/core/object.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/object.h b/src/core/object.h
new file mode 100644
index 0000000..1ec161f
--- /dev/null
+++ b/src/core/object.h
@@ -0,0 +1,45 @@
+#ifndef __REFCOUNTED_H__
+#define __REFCOUNTED_H__
+
+#include <list>
+
+namespace Coal
+{
+
+class Object
+{
+ public:
+ enum Type
+ {
+ T_CommandQueue,
+ T_Event,
+ T_Context,
+ T_Kernel,
+ T_MemObject,
+ T_Program,
+ T_Sampler
+ };
+
+ Object(Type type, Object *parent = 0);
+ virtual ~Object();
+
+ void reference();
+ bool dereference();
+ unsigned int references() const;
+ void setReleaseParent(bool release);
+
+ Object *parent() const;
+ Type type() const;
+ bool isA(Type type) const;
+
+ private:
+ unsigned int p_references;
+ Object *p_parent;
+ Type p_type;
+ std::list<Object *>::iterator p_it;
+ bool p_release_parent;
+};
+
+}
+
+#endif \ No newline at end of file