lxaSetSalienceCallback

<< lxaGetLastWarnings | Back to Salience 6 C API Index | lxaSetSalienceOptionWithString >>

Summary

Sets a callback function that Salience can use to return messages during processing.

Syntax

int lxaSetSalienceCallback(SalienceSession* pSession, 
                           SalienceCallback oCallback, 
                           void* pParam);

Parameters

pSession Pointer to a SalienceSession structure previously returned by a call to lxaOpenSalienceSession
oCallback A pointer to the callback function that you want to use. See below for the definition of this callback function
pParam A pointer to a piece of data that you want to be passed into the callback function

Returns

This method returns an integer return code.

Comments

The format of the callback function is defined as
typedef int (*SalienceCallback)(void*,int,const char*);
so a real example might be:
int mycallback(void* pParam,int nCode,const char* acMessage) {
	printf(acMessage);
	printf("\n");
	return 0;
}
pParam will be set to what ever you set the pParam member of the lxaSetSalienceCallback call to be (useful for passing around a class). nCode and acMessage will both be set by the application to be the relevant error / message code and associated text string.

Example

    char* acTagFile = "c:/sometags.dat";
    SalienceSession* pSession;
    ... //Set up the parameters as well as the license here
    if (lxaOpenSalienceSession(oLicense,acDataPath,&pSession,&acError) == LXA_OK)
    {
        lxaSetSalienceCallback(pSession,&mycallback,NULL);
        lxaSetTagDefinitions(pSession,acTagFile);
        ...
        lxaCloseSalienceSession(pSession);
    }

<< lxaGetLastWarnings | Back to Salience 6 C API Index | lxaSetSalienceOptionWithString >>