00001 #ifndef FILTER_H
00002 #define FILTER_H
00003
00004
00005 #include "constants.h"
00006
00007 #define VOID_3
00008
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 #define EOW -2
00015 #define ERROR -3
00016
00017 typedef int RecoverCallback_t( int taskId, int *deps, int depSize, char *metadata, int metaSize );
00018
00019 #ifndef _PORT_HANDLERS_
00020 #define _PORT_HANDLERS_
00021 typedef int InputPortHandler, OutputPortHandler;
00022 #endif
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 typedef int initialize_t(void *work, int worksize);
00033 typedef int process_t(void *work, int worksize);
00034 typedef int finalize_t();
00035
00036 initialize_t initFilter;
00037 process_t processFilter;
00038 finalize_t finalizeFilter;
00039
00040
00041 InputPortHandler dsGetInputPortByName(const char *name);
00042 OutputPortHandler dsGetOutputPortByName(const char *name);
00043 int dsCloseOutputPort(OutputPortHandler oph);
00044
00045
00046 int dsProbe(InputPortHandler ip);
00047
00048 int dsReadBuffer(InputPortHandler ip, void *buf, int szBuf);
00049
00050 int dsReadNonBlockingBuffer(InputPortHandler iph, void *buf, int szBuf);
00051
00052 int dsWriteBuffer(OutputPortHandler op, void *buf, unsigned int bufSz);
00053
00054
00055
00056
00057
00058 int dsGetNumWriters(InputPortHandler iph);
00059 int dsGetNumReaders(OutputPortHandler oph);
00060
00061
00062 int dsInitPack(int initSize);
00063
00064
00065 int dsPackData(void *data, int size);
00066
00067 int dsWritePackedBuffer(OutputPortHandler oph);
00068
00069
00070 int dsInitReceive(InputPortHandler iph);
00071
00072 int dsUnpackData(void *buf, int size);
00073
00074
00075 char *dsGetFilterName();
00076
00077 int dsGetFilterId();
00078
00079
00080 int dsGetNumInputPorts();
00081
00082 char **dsGetInputPortNames();
00083
00084 int dsGetNumOutputPorts();
00085
00086 char **dsGetOutputPortNames();
00087
00088
00089 int dsGetNumUpStreamsRunning();
00090
00091
00092 int dsGetMachineMemory();
00093
00094
00095
00096
00097 int dsGetLocalInstances();
00098
00099
00100 int dsGetMyRank();
00101
00102 int dsGetTotalInstances();
00103
00104 int dsExit(char *mesg);
00105
00106
00107 void dsUseTasks();
00108
00109 int dsCreateTask(int taskId, int *deps, int depSize, char *metadata, int metaSize);
00110
00111 int dsEndTask(int taskId);
00112
00113 int dsGetCurrentTask();
00114 int dsSetCurrentTask(int taskId);
00115 int *dsGetTaskDeps(int taskId, int *depsSz);
00116 int dsGetRunningTasks( int * numTasks, int ** taskList );
00117 int *dsGetFinishedTasks(int *numTasks);
00118
00119 int dsRegisterRecoverCallback( RecoverCallback_t * callback );
00120
00121
00122 int dsPutData(char *id, void *val, int valSize);
00123 int dsRemoveData(char *id);
00124 void *dsGetData(int taskId, char *id, int *valSz);
00125
00126
00127 void dsInstSetStates(char **states, int numStates);
00128 void dsInstSwitchState(int stateId);
00129 void dsInstEnterState(int stateId);
00130 void dsInstLeaveState();
00131
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135
00136 #endif