diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-21 14:31:56 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-21 14:31:56 +0000 |
commit | 45136c665690534d934d0c0c188dbb18a0131b96 (patch) | |
tree | 50e774280a622de5dfc8b98707f0be6324aeb974 /obj-types.h | |
parent | 04622f7d2210cbb8036502afadf5bcdcb0394d28 (diff) | |
download | rsyslog-45136c665690534d934d0c0c188dbb18a0131b96.tar.gz rsyslog-45136c665690534d934d0c0c188dbb18a0131b96.tar.bz2 rsyslog-45136c665690534d934d0c0c188dbb18a0131b96.zip |
some more interface changes
Diffstat (limited to 'obj-types.h')
-rw-r--r-- | obj-types.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/obj-types.h b/obj-types.h index 3046e96f..ee82c49f 100644 --- a/obj-types.h +++ b/obj-types.h @@ -138,6 +138,8 @@ typedef struct obj { /* the dummy struct that each derived class can be casted t } #define PROTOTYPEpropSetMeth(obj, prop, dataType)\ rsRetVal obj##Set##prop(obj##_t *pThis, dataType pVal) +#define INTERFACEpropSetMeth(obj, prop, dataType)\ + rsRetVal (*Set##prop)(obj##_t *pThis, dataType) /* class initializer */ #define PROTOTYPEObjClassInit(objName) rsRetVal objName##ClassInit(void) #define BEGINObjClassInit(objName, objVers) \ @@ -288,6 +290,7 @@ finalize_it: \ #define ENDobjQueryInterface(obj) \ RETiRet; \ } + /* the base data type for interfaces * This MUST be in sync with the ifBEGIN macro */ @@ -297,6 +300,15 @@ typedef struct interface_s { } interface_t; +/* the following macros should be used to define interfaces inside the + * header files. + */ +#define BEGINinterface(obj) \ + typedef struct obj##_if_s {\ + ifBEGIN; /* This MUST always be the first interface member */ +#define ENDinterface(obj) \ + } obj##_if_t; + /* the following macro is used to get access to an object (not an instance, * just the class itself!). It must be called before any of the object's * methods can be accessed. @@ -316,6 +328,12 @@ typedef struct interface_s { #define DEFobjCurrIf(obj) \ static obj##_if_t obj = { .ifVersion = obj##CURR_IF_VERSION }; +/* define the prototypes for a class - when we use interfaces, we just have few + * functions that actually need to be non-static. + */ +#define PROTOTYPEObj(obj) \ + PROTOTYPEObjClassInit(obj); \ + PROTOTYPEObjQueryInterface(obj) \ /* ------------------------------ end object loader system ------------------------------ */ |