aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/polymorphism.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-28 22:56:20 -0800
committerChris Robinson <[email protected]>2018-12-28 22:56:20 -0800
commit3d92e8c4df4ebaffbe44507f787f2382e3982c96 (patch)
treefe8f068a902d6b8f5f225120505529d1f6fe31cd /Alc/polymorphism.h
parent67b874328d60062558eeb5068a3f79dab2b6f7e3 (diff)
Convert the backends to use proper inheritence
Diffstat (limited to 'Alc/polymorphism.h')
-rw-r--r--Alc/polymorphism.h90
1 files changed, 0 insertions, 90 deletions
diff --git a/Alc/polymorphism.h b/Alc/polymorphism.h
deleted file mode 100644
index 211d5db3..00000000
--- a/Alc/polymorphism.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef POLYMORPHISM_H
-#define POLYMORPHISM_H
-
-/* Defines method forwards, which call the given parent's (T2's) implementation. */
-#define DECLARE_FORWARD(T1, T2, rettype, func) \
-rettype T1##_##func(T1 *obj) \
-{ return T2##_##func(static_cast<T2*>(obj)); }
-
-#define DECLARE_FORWARD1(T1, T2, rettype, func, argtype1) \
-rettype T1##_##func(T1 *obj, argtype1 a) \
-{ return T2##_##func(static_cast<T2*>(obj), a); }
-
-#define DECLARE_FORWARD2(T1, T2, rettype, func, argtype1, argtype2) \
-rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \
-{ return T2##_##func(static_cast<T2*>(obj), a, b); }
-
-#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \
-rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \
-{ return T2##_##func(static_cast<T2*>(obj), a, b, c); }
-
-/* Defines method thunks, functions that call to the child's method. */
-#define DECLARE_THUNK(T1, T2, rettype, func) \
-static rettype T1##_##T2##_##func(T2 *obj) \
-{ return T1##_##func(static_cast<T1*>(obj)); }
-
-#define DECLARE_THUNK1(T1, T2, rettype, func, argtype1) \
-static rettype T1##_##T2##_##func(T2 *obj, argtype1 a) \
-{ return T1##_##func(static_cast<T1*>(obj), a); }
-
-#define DECLARE_THUNK2(T1, T2, rettype, func, argtype1, argtype2) \
-static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \
-{ return T1##_##func(static_cast<T1*>(obj), a, b); }
-
-#define DECLARE_THUNK3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \
-static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \
-{ return T1##_##func(static_cast<T1*>(obj), a, b, c); }
-
-#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \
-static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \
-{ return T1##_##func(static_cast<T1*>(obj), a, b, c, d); }
-
-/* Defines the default functions used to (de)allocate a polymorphic object. */
-#define DECLARE_DEFAULT_ALLOCATORS(T) \
-static void* T##_New(size_t size) { return al_calloc(16, size); } \
-static void T##_Delete(void *ptr) { al_free(ptr); }
-
-
-/* Helper to extract an argument list for virtual method calls. */
-#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__))
-
-/* Call a "virtual" method on an object, with arguments. */
-#define V(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS
-/* Call a "virtual" method on an object, with no arguments. */
-#define V0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS
-
-
-/* Helper to extract an argument list for NEW_OBJ calls. */
-#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \
- } \
-} while(0)
-
-/* Allocate and construct an object, with arguments. */
-#define NEW_OBJ(_res, T) do { \
- _res = (T*)T##_New(sizeof(T)); \
- if(_res) \
- { \
- T##_Construct(_res, EXTRACT_NEW_ARGS
-/* Allocate and construct an object, with no arguments. */
-#define NEW_OBJ0(_res, T) do { \
- _res = (T*)T##_New(sizeof(T)); \
- if(_res) \
- { \
- T##_Construct(_res EXTRACT_NEW_ARGS
-
-/* Destructs and deallocate an object. */
-#define DELETE_OBJ(obj) do { \
- if((obj) != NULL) \
- { \
- V0((obj),Destruct)(); \
- V0((obj),Delete)(); \
- } \
-} while(0)
-
-
-/* Helper to get a type's vtable thunk for a child type. */
-#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable))
-/* Helper to set an object's vtable thunk for a child type. Used when constructing an object. */
-#define SET_VTABLE2(T1, T2, obj) (static_cast<T2*>(obj)->vtbl = GET_VTABLE2(T1, T2))
-
-#endif /* POLYMORPHISM_H */