Transformer SDK For C  8.0.2.290852-a608fcd3
pipeline.h
Go to the documentation of this file.
1 /*
2  * Pipeline Transformer Module
3  *
4  * Copyright CAPLIN Systems Ltd 2000-2013
5  *
6  * $Author$
7  * $DateTime$
8  * $Change$
9  * $Id$
10  *
11  * Public API into the pipeline module
12  */
13 
14 #ifndef PIPELINE_H
15 #define PIPELINE_H
16 
17 
18 #include "transformer.h"
19 
20 #ifndef WIN32
21 #ifndef MODULEAPI
22 #define MODULEAPI
23 #endif
24 #else /* WIN32 */
25 #ifndef MODULEAPI
26 #define MODULEAPI _declspec(dllimport)
27 #endif
28 #endif /* WIN32 */
29 
30 
31 #define EMBED_LUA /* We only support lua at the moment */
32 
39 typedef struct _pipeline pipeline_t;
40 typedef struct pipeline_argument_s pipeline_argument_t;
41 
50 struct _pipeline {
51  void (*recv_update)(pipeline_t *pipeline, int feed, ds_data_t *dsdata, time_t tim, int update_from_memory_file);
52  void (*recv_nodata)(pipeline_t *pipeline, int feed, const char *subject, int flags);
53  void (*recv_status)(pipeline_t *pipeline, int feed, const char *subject, int status, int code, char *status_message);
54  int (*handle_request)(pipeline_t *pipeline, int feed, const char *subject);
55  int (*handle_discard)(pipeline_t *pipeline, int feed, const char *subject);
56  void (*recv_udp_signal)(pipeline_t *pipeline, const char *msg);
57  int (*exec_function)(pipeline_t *pipe, const char *func, int argc, char *argv[]); /* Execute an arbitrary function */
58  int (*exec_with_args)(pipeline_t *pipe, const char *func, int num_args, pipeline_argument_t *args);
59  int (*exec_with_args_ret)(pipeline_t *pipe, const char *func, int num_args, pipeline_argument_t *args, pipeline_argument_t *ret_args);
60 };
61 
65 typedef struct {
66  char *initialise;
67  char *update;
68  char *nodata;
69  char *status;
70  char *request;
71  char *discard;
72  char *udpsig;
74 
81 typedef enum {
93 
94 
95 struct pipeline_argument_s {
97  int size;
98  union {
99  int num;
100  double fnum;
101  const char *str;
102  ds_data_t *dsdata;
103  pipeline_argument_t *values;
104  } value;
105 };
106 
107 
108 
110 #ifdef EMBED_LUA
111 #define NATIVE_FUNC(funcname,paramname) pipeline_return_type_t (funcname)(void *(paramname))
112 typedef int pipeline_return_type_t;
113 typedef pipeline_return_type_t (*pipeline_cb)(void *state);
114 #endif
115 
116 
124 typedef struct {
125  const char *lua_name;
126  const char *js_name;
127  int (*func)(void *state);
129 
153 typedef struct {
154  char *name;
155  int value;
156  const char *string;
158 
173 typedef struct {
174  int version;
175  int patch;
176  /* Functions for user extensions */
177  int (*pipeline_register_function)(char *name, pipeline_cb callback);
189  int (*pipeline_getarg)(void *state, int argnum, pipeline_datatype_t type, void *dest);
209  int (*pipeline_setret)(void *state, pipeline_datatype_t type, void *retval);
220  pipeline_return_type_t (*pipeline_return)(void *state);
226  /* Functions to control the generation and execution of a pipeline */
227  pipeline_t *(*pipeline_generate)(char *file, pipeline_eventnames_t *eventnames);
238  int (*pipeline_initialise)(pipeline_t *pipe);
249  int (*pipeline_release)(pipeline_t *pipeline);
258  /* Functions to store and retrieve data items from the object's database */
259  int (*pipeline_database_insert)(const char *symbol, const char *key, pipeline_datatype_t type, void *dataptr);
270  int (*pipeline_database_retrieve)(const char *symbol, const char *key, pipeline_datatype_t *type, void **dataptr);
284  int (*pipeline_database_delete)(const char *symbol);
293  int (*pipeline_register_function_closure)(char *name, pipeline_cb callback, void *closure);
306  void *(*pipeline_get_closure)(void *state);
312  int (*pipeline_setret_array)(void *state, int num, char **array);
323  int (*pipeline_setret_map)(void *state, int num, char **map_values);
343  int (*pipeline_getarg_from_map)(void *state, int argnum, const char *key, pipeline_datatype_t type, void *dest);
359  int (*pipeline_getarg_map_keys)(void *state, int argnum, char ***dest);
371  pipeline_t *(*pipeline_generate_with_log)(char *file, ds_log_t *logfile, pipeline_eventnames_t *eventnames);
382  int (*pipeline_get_num_args)(void *state);
390  int (*pipeline_register_library)(const char *libname, const pipeline_module_func_t *funcs, const pipeline_module_const_t *constants);
403  int (*pipeline_call_func)(void *state, int argnum, pipeline_argument_t *args, int num_args);
405 
406 
407 
408 
409 
410 #endif /* PIPELINE_H */
411 
Pipeline execution functions.
Definition: pipeline.h:50
void(* recv_nodata)(pipeline_t *pipeline, int feed, const char *subject, int flags)
Definition: pipeline.h:52
Interface returned to other modules which require integration with the pipeline.
Definition: pipeline.h:173
List of library functions to be registered.
Definition: pipeline.h:124
Definition: pipeline.h:90
char * initialise
Definition: pipeline.h:66
Definition: pipeline.h:85
int version
Definition: pipeline.h:174
char * nodata
Definition: pipeline.h:68
char * request
Definition: pipeline.h:70
void(* recv_update)(pipeline_t *pipeline, int feed, ds_data_t *dsdata, time_t tim, int update_from_memory_file)
Definition: pipeline.h:51
Definition: pipeline.h:86
void(* recv_udp_signal)(pipeline_t *pipeline, const char *msg)
Definition: pipeline.h:56
int(* handle_discard)(pipeline_t *pipeline, int feed, const char *subject)
Definition: pipeline.h:55
char * discard
Definition: pipeline.h:71
Definition: pipeline.h:88
Definition: pipeline.h:91
char * status
Definition: pipeline.h:69
List of library constants to be registered.
Definition: pipeline.h:153
const char * string
Definition: pipeline.h:156
int patch
Definition: pipeline.h:175
int(* handle_request)(pipeline_t *pipeline, int feed, const char *subject)
Definition: pipeline.h:54
Definition: pipeline.h:82
struct _ds_log ds_log_t
The log file object.
Definition: datasrc.h:174
pipeline_datatype_t
Argument types.
Definition: pipeline.h:81
Names of the event handlers within the pipeline.
Definition: pipeline.h:65
char * update
Definition: pipeline.h:67
const char * js_name
Definition: pipeline.h:126
Definition: pipeline.h:87
A data update object.
Definition: datasrc.h:2477
int value
Definition: pipeline.h:155
Definition: pipeline.h:83
Definition: pipeline.h:89
Definition: pipeline.h:84
char * name
Definition: pipeline.h:154
const char * lua_name
Definition: pipeline.h:125
char * udpsig
Definition: pipeline.h:72
void(* recv_status)(pipeline_t *pipeline, int feed, const char *subject, int status, int code, char *status_message)
Definition: pipeline.h:53

Generated on Wed Jul 31 2024 18:00:14 for Transformer SDK For C