FilterData.h

Go to the documentation of this file.
00001 /* This object contains all the data a Filter needs to run
00002  * Added by Matheus: September, 13, 2004
00003  */
00004 
00005 #ifndef __FILTERDATA_H
00006 #define __FILTERDATA_H
00007 
00008 #include "FilterDev.h"
00009 #include <Task/Task.h>
00010 #include "Ports.h"
00011 #include "constants.h"
00012 #ifdef VOID_INST
00013 #include "Instrumentation.h"
00014 #endif
00015 #ifdef VOID_TRACER
00016 #include <Tracer/tracer.h>
00017 #include "tracingdefs.h"
00018 #endif
00019 
00020 /// the information about the library of the filter
00021 typedef struct _LibData_ {
00022         char name[MAX_LNAME_LENGTH+1]; ///< the library name, usually lib"filtername".so
00023         void *libHandler; ///<  "handler"  for  the dynamic  library
00024         initialize_t *init; ///< init pointer 
00025         process_t        *process; ///< process pointer
00026         finalize_t *finalize; ///< finalize pointer
00027 } LibData;
00028 
00029 
00030 ///the data that filter needs to run
00031 typedef struct __FilterData__{
00032         int id; ///< the filter id
00033         char name[MAX_FNAME_LENGTH +1]; ///<the filter name
00034         char hostName[MAX_HNAME_LENGTH + 1]; ///< name of filter host
00035         int memory; ///< the memory this machine has available for this execution, from XML
00036         int numLocalInstances; ///< the number of brother + me in this machine
00037         int numInstances; ///< number of brothers + me
00038         int tids[MAXINSTANCES]; ///< array of tids, mine and brothers 
00039         int myRank; ///< which brother am I?
00040         int numInputPorts, numOutputPorts; ///<my number of ports
00041         int numInportsAdded, numOutportsAdded; ///<number of ports loaded till now
00042         InputPort *inputPorts[MAXINPSTREAMS]; ///<my input ports
00043         OutputPort *outputPorts[MAXOUTSTREAMS]; ///<my output ports
00044         LibData libdata; ///<the library data
00045         //TaskData taskData;
00046 #ifdef VOID_INST
00047         InstData *instData; ///< instrumentation data
00048 #endif
00049 #ifdef VOID_TRACER
00050         TrcData *trcData; ///< tracing data
00051 #endif
00052 
00053 } FilterData;
00054 
00055 
00056 #ifdef FILTERDATA_C
00057 FilterData *fd; ///< Global variable that points to data of filter
00058 #else
00059 extern FilterData *fd; ///< Global variable that points to data of filter
00060 #endif
00061 
00062 
00063 ///constructor
00064 FilterData *createFilterData(); 
00065 ///destroyer
00066 void destroyFilterData(FilterData *fd); 
00067 /** when the filter runs this, hell receive all data he needs to run the pipeline
00068  * @return 1 if all goes well, -1 if an error is found
00069  */
00070 int recvFilterData();
00071 ///runs the filter
00072 void runFilter();
00073 
00074 //these functions does not use arguments after call
00075 /// Sets the name of filter
00076 int setFDName(FilterData *fd, char *name);
00077 /// Sets the name of the machine where the filter is runnig
00078 int setFDHostName(FilterData *fd, char *hostName); 
00079 /// Sets the number of inputs of the filter 
00080 int setFDNumInputs(FilterData *fd, int numInp);
00081 /// Sets the number of output
00082 int setFDNumOutputs(FilterData *fd, int numOut);
00083 /// Sets the libname of the filter: Used to load the filter
00084 int setFDLibName(FilterData *fd, char *libName);
00085 ///sets the machine memory declared inside the XML file
00086 int setFDMachineMem(FilterData *fd, int mem);
00087 ///sets the number of instances this filter has in current machine
00088 int setFDLocalInstances(FilterData *fd, int numLocalInst);
00089 /// Sets the number of instances of this type of filter
00090 int setFDNumInstances(FilterData *fd, int numInstances); 
00091 /// Sets the rank of this instance in his set of filters
00092 void setFDRank(FilterData *fd, int rank);
00093 /// Sets the id of this filter - unique for all filters 
00094 void setFDIdFilter(FilterData *fd, int id);
00095 /// sets the tids of this filter, mine and brothers
00096 void setFDTids(FilterData *fd, int *tids);
00097 #ifdef VOID_INST
00098 /// sets the instrumentation directory
00099 void setFDInstDir(FilterData *fd, char *dir);
00100 #endif
00101 
00102 
00103 /// Gets the ammount of memory the machine this filter runs on has
00104 int getFDMachineMem(FilterData *fd);
00105 ///get the number of brothers I have in this same machine
00106 int getFDLocalInstances(FilterData *fd);
00107 /// Gets the name of filter
00108 char *getFDName(FilterData *fd);
00109 /// Gets the number of instances of this type of filter
00110 int getFDNumInstances(FilterData *fd); 
00111 
00112 
00113 //these functions use argument after call, ie, dont free them
00114 /// adds another inputPort to filteData: we only point to InputPort received -- dont free it
00115 int addFDInputPort(FilterData *fd, InputPort *p);
00116 /// adds another OutputPort to filteData: we only point to OutputPort received -- dont free it
00117 int addFDOutputPort(FilterData *fd, OutputPort *p);
00118 
00119 ///this function loads the filter libraries(init process finalize)
00120 int loadFDLibFunctions(FilterData *fd); 
00121 
00122 
00123 #endif

Generated on Tue Jan 17 19:18:38 2006 for Void by  doxygen 1.4.6