Add Get/ReleaseReference methods to all pool classes.
Johnny C. Lam [11-26-13 - 14:05]
Add Get/ReleaseReference methods to all pool classes.
This allows for using them interchangeably from an API standpoint.
git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1209 d5049fe3-3747-40f7-a4b5-f36d6801af5f
diff --git a/OvalePool.lua b/OvalePool.lua
index c33adda..10fd20c 100644
--- a/OvalePool.lua
+++ b/OvalePool.lua
@@ -62,6 +62,14 @@ function OvalePool:Release(item)
self.unused = self.unused + 1
end
+function OvalePool:GetReference(item)
+ return item
+end
+
+function OvalePool:ReleaseReference(item)
+ -- no-op
+end
+
function OvalePool:Clean(item)
-- virtual function; override as needed.
end
diff --git a/OvalePoolGC.lua b/OvalePoolGC.lua
index 7bb90aa..ae7f5fe 100644
--- a/OvalePoolGC.lua
+++ b/OvalePoolGC.lua
@@ -44,6 +44,14 @@ function OvalePoolGC:Release(item)
self:Clean(item)
end
+function OvalePoolGC:GetReference(item)
+ return item
+end
+
+function OvalePoolGC:ReleaseReference(item)
+ -- no-op
+end
+
function OvalePoolGC:Clean(item)
-- virtual function; override as needed.
end
diff --git a/OvalePoolRefCount.lua b/OvalePoolRefCount.lua
index f9a7122..cd271ef 100644
--- a/OvalePoolRefCount.lua
+++ b/OvalePoolRefCount.lua
@@ -108,7 +108,15 @@ function OvalePoolRefCount:Get()
end
function OvalePoolRefCount:Release(item)
- item:ReleaseReference()
+ return item:ReleaseReference()
+end
+
+function OvalePoolRefCount:GetReference(item)
+ return item:GetReference()
+end
+
+function OvalePoolRefCount:ReleaseReference(item)
+ return item:ReleaseReference()
end
function OvalePoolRefCount:Clean(item)