FilterData.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <dlfcn.h>
#include <pvm3.h>
#include <Task/Task.h>
#include <Cache/Cache.h>
#include "FilterData.h"
#include "Ports.h"
#include "../constants.h"
#include "../Messages.h"

Include dependency graph for FilterData.c:

Go to the source code of this file.

Functions

FilterDatacreateFilterData ()
 constructor
void destroyFilterData (FilterData *fd)
 destroyer
int setFDNumInputs (FilterData *fd, int numInp)
 Sets the number of inputs of the filter.
int setFDNumOutputs (FilterData *fd, int numOut)
 Sets the number of output.
char * getFDName (FilterData *fd)
 Gets the name of filter.
int setFDName (FilterData *fd, char *name)
 Sets the name of filter.
int setFDHostName (FilterData *fd, char *hostName)
 Sets the name of the machine where the filter is runnig.
int getFDNumInstances (FilterData *fd)
 Gets the number of instances of this type of filter.
int setFDNumInstances (FilterData *fd, int numInstances)
 Sets the number of instances of this type of filter.
void setFDRank (FilterData *fd, int rank)
 Sets the rank of this instance in his set of filters.
void setFDIdFilter (FilterData *fd, int id)
 Sets the id of this filter - unique for all filters.
void setFDTids (FilterData *fd, int *tids)
 sets the tids of this filter, mine and brothers
int addFDInputPort (FilterData *fd, InputPort *p)
 adds another inputPort to filteData: we only point to InputPort received -- dont free it
int addFDOutputPort (FilterData *fd, OutputPort *p)
 adds another OutputPort to filteData: we only point to OutputPort received -- dont free it
int setFDLibName (FilterData *fd, char *libName)
 Sets the libname of the filter: Used to load the filter.
int loadFDLibFunctions (FilterData *fd)
 this function loads the filter libraries(init process finalize)
int setFDMachineMem (FilterData *fd, int mem)
 sets the machine memory declared inside the XML file
int getFDMachineMem (FilterData *fd)
 Gets the ammount of memory the machine this filter runs on has.
int setFDNumLocalInstances (FilterData *fd, int numLocalInstances)
int getFDLocalInstances (FilterData *fd)
 get the number of brothers I have in this same machine
int recvFilterData (FilterData *fData)
void runFilter ()
 runs the filter


Function Documentation

int addFDInputPort FilterData fd,
InputPort p
 

adds another inputPort to filteData: we only point to InputPort received -- dont free it

Definition at line 202 of file FilterData.c.

References __FilterData__::inputPorts, MAXINPSTREAMS, and __FilterData__::numInportsAdded.

int addFDOutputPort FilterData fd,
OutputPort p
 

adds another OutputPort to filteData: we only point to OutputPort received -- dont free it

Definition at line 214 of file FilterData.c.

References MAXOUTSTREAMS, __FilterData__::numOutportsAdded, and __FilterData__::outputPorts.

Referenced by recvFilterData().

FilterData* createFilterData  ) 
 

constructor

Definition at line 51 of file FilterData.c.

References instCreate(), MAX_HNAME_LENGTH, __FilterData__::numInportsAdded, __FilterData__::numInputPorts, __FilterData__::numOutportsAdded, __FilterData__::numOutputPorts, and trcCreateData().

Referenced by runFilter().

Here is the call graph for this function:

void destroyFilterData FilterData fd  ) 
 

destroyer

Todo:
Only free FilterData. Needs to free input e output port.

Definition at line 82 of file FilterData.c.

References destroyInputPort(), __FilterData__::inputPorts, __FilterData__::libdata, _LibData_::libHandler, and __FilterData__::numInputPorts.

Here is the call graph for this function:

int getFDLocalInstances FilterData fd  ) 
 

get the number of brothers I have in this same machine

Definition at line 317 of file FilterData.c.

References __FilterData__::numLocalInstances.

Referenced by dsGetLocalInstances().

int getFDMachineMem FilterData fd  ) 
 

Gets the ammount of memory the machine this filter runs on has.

Definition at line 308 of file FilterData.c.

References __FilterData__::memory.

Referenced by dsGetMachineMemory().

char* getFDName FilterData fd  ) 
 

Gets the name of filter.

Definition at line 132 of file FilterData.c.

References __FilterData__::name.

int getFDNumInstances FilterData fd  ) 
 

Gets the number of instances of this type of filter.

Definition at line 168 of file FilterData.c.

References __FilterData__::numInstances.

int loadFDLibFunctions FilterData fd  ) 
 

this function loads the filter libraries(init process finalize)

Definition at line 241 of file FilterData.c.

References error, _LibData_::finalize, _LibData_::init, __FilterData__::libdata, _LibData_::libHandler, _LibData_::name, and _LibData_::process.

Referenced by recvFilterData().

int recvFilterData FilterData fData  ) 
 

used to notify manager some system error happened, and filter is aborting, similar to AEXIT

used to notify manager some system error happened, and filter is aborting, similar to AEXIT

used to notify manager some system error happened, and filter is aborting, similar to AEXIT

Definition at line 321 of file FilterData.c.

References addFDOutputPort(), createOutputPort(), getWritePolicyByName(), __FilterData__::hostName, LABELED_STREAM, loadFDLibFunctions(), loadOPLSData(), loadOPMLSData(), MAX_CWD_LENGTH, MAX_FNAME_LENGTH, MAX_HNAME_LENGTH, MAX_IDIR_LENGTH, MAX_LNAME_LENGTH, MAX_PTNAME_LENGTH, MAXINSTANCES, MSGT_FERROR, MULTICAST_LABELED_STREAM, __FilterData__::myRank, __FilterData__::name, __FilterData__::numOutputPorts, setFDHostName(), setFDIdFilter(), setFDLibName(), setFDMachineMem(), setFDName(), setFDNumInputs(), setFDNumInstances(), setFDNumLocalInstances(), setFDNumOutputs(), setFDRank(), setFDTids(), setOPLibName(), setOPName(), setOPNextToSend(), setOPNumDestinations(), setOPTag(), setOPTidsDestinations(), and setOPWritePolicy().

Referenced by runFilter().

Here is the call graph for this function:

void runFilter  ) 
 

runs the filter

Todo:
An error ocourred! We should notify manager of this!!
Bug:
Resetting the ports even before receiving the UOW ISN'T SAFE. Before we even recieve the UOW, the other filters can already started to run and sending valid data to this filter. The only safe way is: send EOW at the end of finalizeFilter() and only drain data from the channels that doesn't recieved a EOW until recieve it
if the message type is end of filter, which means, all done

Todo:
put a signal handler to clean the cache on SIGTERM recievement
used to notify manager this filter ended its work

Definition at line 563 of file FilterData.c.

References createFilterData(), initTerminationDetection(), __FilterData__::inputPorts, __FilterData__::numInputPorts, __FilterData__::numOutputPorts, __FilterData__::outputPorts, recvFilterData(), resetInputPort(), resetOutputPort(), and tdd.

Referenced by initDs().

Here is the call graph for this function:

int setFDHostName FilterData fd,
char *  hostName
 

Sets the name of the machine where the filter is runnig.

Definition at line 153 of file FilterData.c.

References __FilterData__::hostName, and MAX_HNAME_LENGTH.

Referenced by recvFilterData().

void setFDIdFilter FilterData fd,
int  id
 

Sets the id of this filter - unique for all filters.

Definition at line 185 of file FilterData.c.

References __FilterData__::id.

Referenced by recvFilterData().

int setFDLibName FilterData fd,
char *  libName
 

Sets the libname of the filter: Used to load the filter.

Definition at line 225 of file FilterData.c.

References __FilterData__::libdata, MAX_LNAME_LENGTH, and _LibData_::name.

Referenced by recvFilterData().

int setFDMachineMem FilterData fd,
int  mem
 

sets the machine memory declared inside the XML file

Todo:
Read memory. Now its hardcoded to 512MB

Definition at line 295 of file FilterData.c.

References __FilterData__::memory.

Referenced by recvFilterData().

int setFDName FilterData fd,
char *  name
 

Sets the name of filter.

Definition at line 137 of file FilterData.c.

References MAX_FNAME_LENGTH, and __FilterData__::name.

Referenced by recvFilterData().

int setFDNumInputs FilterData fd,
int  numInp
 

Sets the number of inputs of the filter.

Definition at line 118 of file FilterData.c.

References MAXINPSTREAMS, and __FilterData__::numInputPorts.

Referenced by recvFilterData().

int setFDNumInstances FilterData fd,
int  numInstances
 

Sets the number of instances of this type of filter.

Definition at line 172 of file FilterData.c.

References MAXINSTANCES, and __FilterData__::numInstances.

Referenced by recvFilterData().

int setFDNumLocalInstances FilterData fd,
int  numLocalInstances
 

Definition at line 312 of file FilterData.c.

References __FilterData__::numLocalInstances.

Referenced by recvFilterData().

int setFDNumOutputs FilterData fd,
int  numOut
 

Sets the number of output.

Definition at line 126 of file FilterData.c.

References __FilterData__::numOutputPorts.

Referenced by recvFilterData().

void setFDRank FilterData fd,
int  rank
 

Sets the rank of this instance in his set of filters.

Definition at line 180 of file FilterData.c.

References __FilterData__::myRank.

Referenced by recvFilterData().

void setFDTids FilterData fd,
int *  tids
 

sets the tids of this filter, mine and brothers

Definition at line 190 of file FilterData.c.

References __FilterData__::numInstances, and __FilterData__::tids.

Referenced by recvFilterData().


Generated on Tue Jan 17 19:20:12 2006 for Void by  doxygen 1.4.6