Replace void* with struct mxs_router

Using an empty struct instead of void* to represent the opaque
filter and filter session types, means that C++ filter types
simply can derive from them. That brings conceptual clarity and
also means that the C++ instances can be returned from the module
callbacks without casts. When provided as argument they can be
downcast using static_cast instead of reinterpret_cast.

In a subsequent change, the prototypes of MXS_ROUTER_OBJECT will
be updated and routers modified accordingly.
This commit is contained in:
Johan Wikman 2017-02-27 09:44:02 +02:00
parent 6406f6b4e1
commit d7f7c01f47

View File

@ -34,7 +34,21 @@ MXS_BEGIN_DECLS
* from the @c createInstance function of a router module and subsequently
* passing it back to the API functions of the router.
*/
typedef void *MXS_ROUTER;
typedef struct mxs_router
{
} MXS_ROUTER;
/**
* MXS_ROUTER_SESSION is an opaque type representing the session related
* data of a particular router instance.
*
* MaxScale itself does not do anything with it, except for receiving it
* from the @c newSession function of a router module and subsequently
* passing it back to the API functions of the router.
*/
typedef struct mxs_router_session
{
} MXS_ROUTER_SESSION;
typedef enum error_action
{