ObjectBox C and C++ API 4.3.0
 
Loading...
Searching...
No Matches
obx::CustomMsgServerDelegate< SERVER, CONNECTION > Class Template Reference

A helper class that delegates C style function pointers to C++ class method invocations via user data. Also, it provides makeFunctions() and registerProtocol(). More...

#include <objectbox-sync.hpp>

Static Public Member Functions

static std::shared_ptr< SERVER > * sharedPtrPtr (void *serverUserData)
 
static std::shared_ptr< SERVER > sharedPtr (void *serverUserData)
 
static CONNECTION & refConnection (void *connectionUserData)
 
static void * delegateCreate (uint64_t serverId, const char *url, const char *certPath, void *configUserData)
 
static obx_err delegateStart (void *serverUserData, uint64_t *outPort)
 
static void delegateStop (void *serverUserData)
 
static void delegateShutdown (void *serverUserData)
 
static bool delegateClientConnSendAsync (OBX_bytes_lazy *cBytes, void *, void *connectionUserData)
 
static void delegateClientConnClose (void *, void *connectionUserData)
 
static void delegateClientConnShutdown (void *connectionUserData)
 
static OBX_custom_msg_server_functions makeFunctions ()
 Create a OBX_custom_msg_server_functions struct according to the defined template delegates.
 
static void registerProtocol (const char *protocol, void *configUserData=nullptr)
 Must be called to register a protocol for your custom messaging server. Call before starting a server.
 

Detailed Description

template<typename SERVER, typename CONNECTION>
class obx::CustomMsgServerDelegate< SERVER, CONNECTION >

A helper class that delegates C style function pointers to C++ class method invocations via user data. Also, it provides makeFunctions() and registerProtocol().

Member Function Documentation

◆ delegateClientConnClose()

template<typename SERVER , typename CONNECTION >
static void obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateClientConnClose ( void *  ,
void *  connectionUserData 
)
inlinestatic

◆ delegateClientConnSendAsync()

template<typename SERVER , typename CONNECTION >
static bool obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateClientConnSendAsync ( OBX_bytes_lazy cBytes,
void *  ,
void *  connectionUserData 
)
inlinestatic

◆ delegateClientConnShutdown()

template<typename SERVER , typename CONNECTION >
static void obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateClientConnShutdown ( void *  connectionUserData)
inlinestatic

◆ delegateCreate()

template<typename SERVER , typename CONNECTION >
static void * obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateCreate ( uint64_t  serverId,
const char *  url,
const char *  certPath,
void *  configUserData 
)
inlinestatic

◆ delegateShutdown()

template<typename SERVER , typename CONNECTION >
static void obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateShutdown ( void *  serverUserData)
inlinestatic

◆ delegateStart()

template<typename SERVER , typename CONNECTION >
static obx_err obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateStart ( void *  serverUserData,
uint64_t *  outPort 
)
inlinestatic

◆ delegateStop()

template<typename SERVER , typename CONNECTION >
static void obx::CustomMsgServerDelegate< SERVER, CONNECTION >::delegateStop ( void *  serverUserData)
inlinestatic

◆ makeFunctions()

template<typename SERVER , typename CONNECTION >
static OBX_custom_msg_server_functions obx::CustomMsgServerDelegate< SERVER, CONNECTION >::makeFunctions ( )
inlinestatic

Create a OBX_custom_msg_server_functions struct according to the defined template delegates.

◆ refConnection()

template<typename SERVER , typename CONNECTION >
static CONNECTION & obx::CustomMsgServerDelegate< SERVER, CONNECTION >::refConnection ( void *  connectionUserData)
inlinestatic

◆ registerProtocol()

template<typename SERVER , typename CONNECTION >
static void obx::CustomMsgServerDelegate< SERVER, CONNECTION >::registerProtocol ( const char *  protocol,
void *  configUserData = nullptr 
)
inlinestatic

Must be called to register a protocol for your custom messaging server. Call before starting a server.

Parameters
protocolthe communication protocol to use, e.g. "tcp"

◆ sharedPtr()

template<typename SERVER , typename CONNECTION >
static std::shared_ptr< SERVER > obx::CustomMsgServerDelegate< SERVER, CONNECTION >::sharedPtr ( void *  serverUserData)
inlinestatic

◆ sharedPtrPtr()

template<typename SERVER , typename CONNECTION >
static std::shared_ptr< SERVER > * obx::CustomMsgServerDelegate< SERVER, CONNECTION >::sharedPtrPtr ( void *  serverUserData)
inlinestatic