Commit 9b95fe57 authored by Jonathan Jenkins's avatar Jonathan Jenkins

bye-bye callback stub

parent a4cc1dfe
......@@ -96,8 +96,6 @@ src_libcodes_base_a_SOURCES = \
src/modelconfig/configstoreadapter.c \
codes/txt_configfile.h \
src/modelconfig/txt_configfile.c \
src/util/codes-callbacks.h \
src/util/codes-callbacks.c \
src/util/codes_mapping.c \
src/util/lp-type-lookup.c \
src/util/configuration.c \
......
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#include "util/codes-callbacks.h"
int codes_callback_create(uint64_t srclp, uint64_t event, uint64_t reqid,
codes_callback_t * cb)
{
if(cb == NULL)
return -1;
cb->srclp = srclp;
cb->event = event;
cb->reqid = reqid;
return 0;
}
int codes_callback_destroy(codes_callback_t * cb)
{
if(cb == NULL)
return -1;
cb->srclp = 0;
cb->event = 0;
cb->reqid = 0;
return 0;
}
int codes_callback_invoke(codes_callback_t * cb, tw_lp * lp)
{
tw_event * e = NULL;
if(cb == NULL)
return -1;
/* generate callback event */
tw_event_new(cb->srclp, CODES_CALLBACK_TIME, lp);
/* get the event msg */
tw_event_data(e);
/* send the event */
tw_event_send(e);
return 0;
}
int codes_callback_copy(codes_callback_t * dest, codes_callback_t * src)
{
if(dest == NULL)
return -1;
if(src == NULL)
return - 1;
dest->srclp = src->srclp;
dest->event = src->event;
dest->reqid = src->reqid;
return 0;
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
/*
* Copyright (C) 2013 University of Chicago.
* See COPYRIGHT notice in top-level directory.
*
*/
#ifndef CODES_CALLBACKS_H
#define CODES_CALLBACKS_H
#include <ross.h>
#include <stdint.h>
#include <stdlib.h>
#define CODES_CALLBACK_TIME 1
typedef struct
{
uint64_t srclp;
uint64_t event;
uint64_t reqid;
} codes_callback_t;
/* callback function prototypes */
int codes_callback_create(uint64_t srclp, uint64_t event, uint64_t reqid,
codes_callback_t * cb);
int codes_callback_destroy(codes_callback_t * cb);
int codes_callback_invoke(codes_callback_t * cb, tw_lp * lp);
int codes_callback_copy(codes_callback_t * dest, codes_callback_t * src);
#endif
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment