summaryrefslogtreecommitdiff
path: root/src/dae/daeRefCountedObj.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dae/daeRefCountedObj.cpp')
-rwxr-xr-xsrc/dae/daeRefCountedObj.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/dae/daeRefCountedObj.cpp b/src/dae/daeRefCountedObj.cpp
new file mode 100755
index 0000000..9caf184
--- /dev/null
+++ b/src/dae/daeRefCountedObj.cpp
@@ -0,0 +1,32 @@
+/*
+* Copyright 2006 Sony Computer Entertainment Inc.
+*
+* Licensed under the MIT Open Source License, for details please see license.txt or the website
+* http://www.opensource.org/licenses/mit-license.php
+*
+*/
+
+#include <dae/daeRefCountedObj.h>
+
+daeRefCountedObj::daeRefCountedObj() : _refCount(0) { }
+
+daeRefCountedObj::~daeRefCountedObj() { }
+
+void daeRefCountedObj::release() const {
+ if (--_refCount <= 0)
+ delete this;
+}
+
+void daeRefCountedObj::ref() const {
+ _refCount++;
+}
+
+void checkedRelease(const daeRefCountedObj* obj) {
+ if (obj)
+ obj->release();
+}
+
+void checkedRef(const daeRefCountedObj* obj) {
+ if (obj)
+ obj->ref();
+}