Add oplist for i-shared oplist

This commit is contained in:
Patrick Pelissier committed 2017-03-06 22:34:11 +01:00
1 parent a185d08734
commit ea9d624050
1 file changed
+19 -9
+19 -9
View File
@@ -32,14 +32,12 @@
#include "m-core.h" #include "m-core.h"
#define ISHARED_PTR_OPLIST(name) ( \ /* Define the oplist of a intrusive shared pointer.
INIT(M_INIT_DEFAULT), \ USAGE: ISHARED_OPLIST(name [, oplist_of_the_type]) */
CLEAR(M_C3(ishared_, name, _clear)), \ #define ISHARED_PTR_OPLIST(...) \
SET(M_C3(ishared_, name, _set) M_IPTR), \ M_IF_NARGS_EQ1(__VA_ARGS__) \
INIT_SET(M_C3(ishared_, name, _init_set2) M_IPTR), \ (ISHAREDI_PTR_OPLIST(__VA_ARGS__, M_DEFAULT_OPLIST ), \
TYPE(M_C3(ishared_,name,_t)), \ ISHAREDI_PTR_OPLIST(__VA_ARGS__ ))
SUBTYPE(M_C3(ishared_type_,name,_t)), \
)
/* Interface to add to a structure to allow intrusive support. /* Interface to add to a structure to allow intrusive support.
name: name of the intrusive shared pointer. name: name of the intrusive shared pointer.
@@ -47,14 +45,26 @@
#define ISHARED_PTR_INTERFACE(name, type) \ #define ISHARED_PTR_INTERFACE(name, type) \
int M_C(name, _cpt) int M_C(name, _cpt)
/* Define the intrusive shared pointer type and its static inline functions.
USAGE: ISHARED_PTR_DEF(name[, oplist]) */
#define ISHARED_PTR_DEF(name, ...) \ #define ISHARED_PTR_DEF(name, ...) \
M_IF_NARGS_EQ1(__VA_ARGS__) \ M_IF_NARGS_EQ1(__VA_ARGS__) \
(ISHAREDI_PTR_DEF2(name, __VA_ARGS__, M_DEFAULT_OPLIST ), \ (ISHAREDI_PTR_DEF2(name, __VA_ARGS__, M_DEFAULT_OPLIST ), \
ISHAREDI_PTR_DEF2(name, __VA_ARGS__ )) ISHAREDI_PTR_DEF2(name, __VA_ARGS__ ))
/********************************** INTERNAL ************************************/ /********************************** INTERNAL ************************************/
#define ISHAREDI_PTR_OPLIST(name, oplist) ( \
INIT(M_INIT_DEFAULT), \
CLEAR(M_C3(ishared_, name, _clear)), \
SET(M_C3(ishared_, name, _set) M_IPTR), \
INIT_SET(M_C3(ishared_, name, _init_set2) M_IPTR), \
TYPE(M_C3(ishared_,name,_t)), \
OPLIST(oplist), \
SUBTYPE(M_C3(ishared_type_,name,_t)), \
)
#define ISHAREDI_PTR_DEF2(name, type, oplist) \ #define ISHAREDI_PTR_DEF2(name, type, oplist) \
\ \
typedef type *M_C3(ishared_,name,_t); \ typedef type *M_C3(ishared_,name,_t); \