00001 /*************************************************************************** 00002 pesnetworkadapter.h - description 00003 ------------------- 00004 begin : Fri Apr 11 2003 00005 copyright : (C) 2003 by root 00006 email : soysal@ceng.metu.edu.tr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef PESNETWORKADAPTER_H 00019 #define PESNETWORKADAPTER_H 00020 00021 00022 #include <string.h> 00023 #include <math.h> 00024 #include "pestask.h" 00025 #include "pesslaveinfo.h" 00026 00027 #define PACKET_PING 1 00028 #define PACKET_DATA 2 00029 #define PACKET_RESULT 3 00030 #define PACKET_STRING 4 00031 00032 #include "worldconfig.h" 00033 //#define NROBOTS 3 00034 00044 class PESNetworkAdapter { 00045 public: 00050 int me; 00052 int mytid; 00054 int tids[200]; 00056 int nproc; 00057 PESNetworkAdapter(); 00058 ~PESNetworkAdapter(); 00060 void receivePing(); 00063 void sendString(char * str); 00069 void sendPingReply(int condition); 00072 void sendResult(float result); 00078 void receiveTask(PESTask *tsk); 00085 void sendTask(PESSlaveInfo *slv, PESTask *tsk); 00092 void ping(int tid, int timeout); 00100 void recievePing(int *slave,int *status); 00107 void recieveString(int *slave, int *len, char *str); 00110 void Init(); 00112 void InitAsSlave(); 00117 int checkMessage(); 00121 int getMessageType(); 00123 void closeNetwork(); 00124 }; 00125 00126 #endif
1.2.18