Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

PESNetworkAdapter Class Reference

Adapter class for PES Network functions. More...

#include <pesnetworkadapter.h>

List of all members.

Public Methods

void receivePing ()
void sendString (char *str)
void sendPingReply (int condition)
void sendResult (float result)
void receiveTask (PESTask *tsk)
void sendTask (PESSlaveInfo *slv, PESTask *tsk)
void ping (int tid, int timeout)
void recievePing (int *slave, int *status)
void recieveString (int *slave, int *len, char *str)
void Init ()
void InitAsSlave ()
int checkMessage ()
int getMessageType ()
void closeNetwork ()

Public Attributes

int me
int mytid
int tids [200]
int nproc


Detailed Description

Adapter class for PES Network functions.

This class provides required functionality to use PES network functions. Both slave and master classes should use this class to communicate.

Author:
soysal
Version:
0.1


Member Function Documentation

int PESNetworkAdapter::checkMessage  
 

Checks for a new message

Returns:
0 when no new message >0 when some new message is waiting <0 when some error

void PESNetworkAdapter::closeNetwork  
 

Close PES connection

int PESNetworkAdapter::getMessageType  
 

Used to learn the type of PES message recieved. When there's no message in the buffer this function blocks the execution of program until a message arrives. To check for a message use checkMessage which immidiately returns.

See also:
checkMessage
Returns:
type of message

void PESNetworkAdapter::Init  
 

Connects to PVM service.

void PESNetworkAdapter::InitAsSlave  
 

This function initiates PES system as slave. This function also recieves initial broadcast data. This initial broadcast data contains information about other slaves in the system.

void PESNetworkAdapter::ping int    tid,
int    timeout
 

Sends a ping packet with timeout 'timeout' seconds to slave with TaskID 'tid'

Parameters:
tid  TaskID (which is obtained from PVM) of slave.
timeout  number of seconds that ping reply should be sent before timeout occurs.

void PESNetworkAdapter::receivePing  
 

Recieves ping packet

void PESNetworkAdapter::receiveTask PESTask   tsk
 

Recieves a task from master

Parameters:
tsk  address of the task class. this class is filled with the data read from network through pvm functions

void PESNetworkAdapter::recievePing int *    slave,
int *    status
 

Recieves ping reply.

Parameters:
slave  the slave that sent the ping reply. This is the index of the slave in the slaves list.
status  status of the slave that sent this ping reply package
See also:
sendPingReply

void PESNetworkAdapter::recieveString int *    slave,
int *    len,
char *    str
 

Recieves a string

Parameters:
slave  the slave that has sent the string. This is the index of the slave in the slaves list.
len  the length of the string that was recieved
str  the string that has been recieved.

void PESNetworkAdapter::sendPingReply int    condition
 

Sends ping reply to the master

Parameters:
condition  Can have 2 values o '0' for free o '1' for busy on the current task

void PESNetworkAdapter::sendResult float    result
 

Sends result to the master

Parameters:
result  result to be sent

void PESNetworkAdapter::sendString char *    str
 

Sends 'str' to the master

Parameters:
str  null terminated string to be sent

void PESNetworkAdapter::sendTask PESSlaveInfo   slv,
PESTask   tsk
 

Sends Task 'tsk' to Slave 'slv'

Parameters:
slv  pointer to the slave class which holds information about a slave
tsk  poineter to the Task class which holds information about a task


Member Data Documentation

int PESNetworkAdapter::me
 

Used to denote which slave this machine is in the tids table.

See also:
tids

int PESNetworkAdapter::mytid
 

The TaskID of process given by PVM system.

int PESNetworkAdapter::nproc
 

actual number processes in the system

int PESNetworkAdapter::tids[200]
 

TaskID's of other processes


The documentation for this class was generated from the following file:
Generated on Thu Feb 12 18:42:57 2004 for ParallelizedEvolutionSystem by doxygen1.2.18