|
Server 0.0.1
HTTP/REST server implementation
|
00001 00027 #ifndef __CLASS_INTERFACE_H__ 00028 #define __CLASS_INTERFACE_H__ 00029 00030 #include <sys/types.h> 00031 00032 #define MAX_IFACE 32 // ATTENTION: every iface_impl will use MAX_IFACE * sizeof(void*) 00033 00034 #define IFACE(name) ((const struct i_##name const*)&i_##name##_impl) 00035 #define INIT_IFACE(name,...) \ 00036 static const struct i_##name i_##name##_impl = {&i_##name,__VA_ARGS__} 00037 00038 #define NUMARGS(...) (sizeof((const void*[]){__VA_ARGS__})/sizeof(void*)) 00039 #define INIT_IFACE_IMPL(...) {NUMARGS(__VA_ARGS__), 0, {__VA_ARGS__}} 00040 00041 00042 struct interface { 00043 const char * name; 00044 const size_t nmethods; 00045 }; 00046 typedef const struct interface * iface_ptr; 00047 00048 struct iface_impl { 00049 const size_t nimpl; // number of interface implementations 00050 char simpl; // implementations sorted?? 00051 const void * impl[MAX_IFACE]; // implementations 00052 }; 00053 typedef struct iface_impl * iface_impl_ptr; 00054 00055 extern iface_ptr interfaceGet(iface_impl_ptr, const iface_ptr); 00056 00057 #endif // __CLASS_INTERFACE_H__ 00058 00059 // vim: set ts=4 sw=4: