User`s guide
Developing LUC Applications [5]
9. Stop the service by calling stopService. This releases any nearby memory
that was allocated by the endpoint, closes all previously opened Fast I/O data
streams, and deactivates the object.
10. Delete the object. This invokes the virtual destructor for the derived object. If
an endpoint object is deleted before calling stopService, the destructor
automatically stops the service and deactivates the object.
Example 11. LUC client code example
user_application_defs.h // sample header
// function index definitions
// note that the values do not have to be contiguous
#define FUNC_QUERY1 1
#define FUNC_QUERY3 3
#define FUNC_QUERY8 8
// service type definitions
#define QUERY_MANAGER 1
#define QUERY_ENGINE 2
#define UPDATE_MANAGER 3
#define UPDATE_ENGINE 4
user_application.cpp //sample client code
#include <luc/luc_exported.h>
#include <user_app_definitions.h>
const int INBUF_SIZE = (1 * 1024 * 1024); // 1 MB input data
const int OUTBUF_SIZE = (2 * 1024 * 1024); // 2 MB output data
void client(luc_endpoint_id_t serverID)
{
LucEndpoint *clientEndpoint;
luc_error_t result;
char *outbuf = malloc(OUTBUF_SIZE);
char *inbuf = malloc(INBUF_SIZE);
size_t outDataLen = OUTBUF_SIZE;
clientEndpoint = luc_allocate_endpoint(LUC_CLIENT_ONLY);
result = clientEndpoint->startService();
if (result != LUC_ERR_OK)
{
// process LUC error
delete clientEndpoint;
return;
}
S–2479–20 55