- Parse a text representation of anEV_AttrValue
#include <$OV_HEADER/ecs/EV/value.h>int32 EV_parseFormattedValue (const char *buf, EV_AttrValue **AV );
This function parses a string into an EV_AttrValue structure that it allocates space for, and returns a pointer to it.
const char *buf
EV_AttrValue **AV
EV_deleteValue when it is no longer required (usually after a call to ANNO_sendResponse).
Build an annotation server response and send it to the engine.
recvFn( ANNO_ConnectionId conId, ANNO_RequestId reqId, EV_AttrValue *requestList)
{ time_t now; struct tm* tm = NULL; char* time_stamp = NULL; real64 salary; /* returned from the `database query' */ EV_AttrValue* responseList = NULL; char responseString[ MAX_BUF_SIZE ]; ... now = time(0); tm = gmtime(&now); time_stamp = (char*)malloc(23); sprintf(time_stamp, "%04d%02d%02d%02d%02d%02d.%06dZ", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, 0);
/* now make up and send the annotation response */ sprintf(responseString, "[ %s, %f ]", time_stamp, salary);
if((rv = EV_parseFormattedValue(responseString, &responseList)) < ECS_SUCCESS)
{ /* ** There were errors in converting the response string ** into an EV_AttrValue */ fprintf(stderr, "ERROR. Could not parse response.");
/* send null response so request is cleaned up */ ANNO_sendResponse(conId, reqId, NULL); rv = ECS_ERROR;
}
/* if everything went OK, or there are just warnings, ** send the response */
if(rv >= ECS_SUCCESS)
{ rv = ANNO_sendResponse(conId, reqId, responseList); }
if(responseList) { EV_deleteValue(responseList); }
...
ECS_SUCCESS
ECS_ERROR