00001
00002 #ifndef _REMOTE_SOCKET_H_
00003 #define _REMOTE_SOCKET_H_
00004
00005 #ifdef HPUX
00006 #include <iostream.h>
00007 #include <fstream.h>
00008 #else
00009 #include <iostream>
00010 #include <fstream>
00011 #endif
00012 #ifdef __GNUG__
00013 #include <fstream.h>
00014 using namespace std;
00015 #endif
00016 #include <unistd.h>
00017 #include <stdlib.h>
00018 #undef TCPSocket
00019 #include "tcpsocket.h"
00020 #include "misc.h"
00021 #include "alloc.h"
00022 #include "semaphore.h"
00023 #include "errcode.h"
00024
00025 #define VERIFICATION_NUMBER 123423
00026
00027 class RemoteSocket : public TCPSocket
00028 {
00029 private:
00030
00031 protected:
00032 int print_flag;
00033
00034 public:
00036 RemoteSocket() { print_flag = 0; }
00037 ~RemoteSocket() { }
00038 int SetPrintFlag(int flag) { print_flag = flag; return print_flag; }
00039
00040 int SendLine(char *fmt, ...);
00041 int RecvLine(char *line);
00042 int PrintRecvLine();
00043 int SendFile(char *filename);
00044 int RecvFile(char *filename);
00045
00046 template <class Etype>
00047 int SendVar(Etype a);
00048 template <class Etype>
00049 int RecvVar(Etype *a);
00050 template <class Etype>
00051 Etype RecvVar();
00052
00053 int SendArrayGeneric(void *a, int totsize, int elemsize);
00054 int RecvArrayGeneric(void *a, int totsize, int elemsize);
00055
00056 template <class Etype>
00057 int SendArray1D(Etype *a, int n1);
00058 template <class Etype>
00059 int RecvArray1D(Etype *a, int n1);
00060
00061 template <class Etype>
00062 int SendArray2D(Etype **a, int n1, int n2);
00063 template <class Etype>
00064 int RecvArray2D(Etype **a, int n1, int n2);
00065
00066 template <class Etype>
00067 int SendArray3D(Etype ***a, int n1, int n2, int n3);
00068 template <class Etype>
00069 int RecvArray3D(Etype ***a, int n1, int n2, int n3);
00070
00071 template <class Etype>
00072 int SendArray4D(Etype ****a, int n1, int n2, int n3, int n4);
00073 template <class Etype>
00074 int RecvArray4D(Etype ****a, int n1, int n2, int n3, int n4);
00075
00076 template <class myStruct>
00077 double RecvStruct(myStruct *S, Semaphore *sem = NULL);
00078 template <class myStruct>
00079 int SendStruct(myStruct *S, Semaphore *sem = NULL);
00080 };
00081
00082 #include "dataarray.h"
00083 #include "1Darray.h"
00084 #include "2Darray.h"
00085 #include "3Darray.h"
00086 #include "4Darray.h"
00087 #include "sendrecvstruct.h"
00088
00089 #endif // _REMOTE_SOCKET_H_
00090