From e20a52c8adfac1a481b88d77088441a3f3dc9a04 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Thu, 31 Jul 2014 08:20:35 +0100 Subject: [PATCH] add a macro to make a retcall on the parent class --- include/tr/class.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/tr/class.h b/include/tr/class.h index b23e1b6..647d2ab 100644 --- a/include/tr/class.h +++ b/include/tr/class.h @@ -262,6 +262,22 @@ iface->method(object, ##__VA_ARGS__); \ } while(0) +/* + * Like retcall but this calls the implementation of the direct parent + * class of this object. + * + * \see TR_RETCALL + */ +#define TR_PARENTRETCALL(object,_iface,method,ret,...) \ + do { \ + struct i_##_iface * iface; \ + TR_class_ptr pc_class = TR_GET_CLASS((object)); \ + assert(TR_HAS_PARENT(pc_class)); \ + _TR_CALL(pc_class->parent, _iface, method, ##__VA_ARGS__); \ + ret = iface->method(object, ##__VA_ARGS__); \ + } while(0) + + /** * Definition of the metadata structures and symbols used to * manage classe.