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

dataclientsend.h

Go to the documentation of this file.
00001 //**************************************************************************
00002 #include "dataclient.h"
00003 //**************************************************************************
00004 #ifndef _DATACLIENT_SEND_H_
00005 #define _DATACLIENT_SEND_H_
00006 //**************************************************************************
00007 template <class Etype>
00008 inline int DataClient::SendVariable(char *keyword, Etype data)
00009 {
00010 int handle;
00011 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00012 if (!isVariable(handle)) return POSSE_FAILURE;
00013 if (!VerifyElementSize(handle, sizeof(Etype))) return POSSE_FAILURE;
00014 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00015 
00016 Etype v = setByteOrder(data);
00017 int size = RecvVar<int>();
00018 SendBytes(sizeof(Etype), &v);
00019 
00020 return POSSE_SUCCESS;
00021 }
00022 //**************************************************************************
00023 inline int DataClient::SendArray(char *keyword, void *a)
00024 {
00025 int handle;
00026 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00027 if (!isStaticArray(handle)) return POSSE_FAILURE;
00028 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00029 
00030 int size = RecvVar<int>();
00031 int elemsize = RecvVar<int>();
00032 RemoteSocket::SendArrayGeneric(a, size, elemsize);
00033 
00034 return POSSE_SUCCESS;
00035 }
00036 //**************************************************************************
00037 template <class myStruct>
00038 inline int DataClient::SendStruct(char *keyword, myStruct *S, Semaphore *sem)
00039 {
00040 int handle;
00041 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00042 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00043 
00044 RemoteSocket::SendStruct(S, sem);
00045 
00046 return POSSE_SUCCESS;
00047 }
00048 //**************************************************************************
00049 template <class Etype>
00050 inline int DataClient::SendArray1D(char *keyword, Etype *a)
00051 {
00052 int handle;
00053 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00054 if (!VerifyElementSize(handle, sizeof(Etype))) return POSSE_FAILURE;
00055 if (!isDynamicArray(handle, 1)) return POSSE_FAILURE;
00056 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00057 
00058 int n1 = RecvVar<int>();   
00059 RemoteSocket::SendArray1D(a, n1);
00060                 
00061 return POSSE_SUCCESS;
00062 }
00063 //**************************************************************************
00064 template <class Etype>
00065 inline int DataClient::SendArray2D(char *keyword, Etype **a)
00066 {
00067 int handle;
00068 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00069 if (!VerifyElementSize(handle, sizeof(Etype))) return POSSE_FAILURE;
00070 if (!isDynamicArray(handle, 2)) return POSSE_FAILURE;
00071 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00072 
00073 int n1 = RecvVar<int>();
00074 int n2 = RecvVar<int>();
00075 RemoteSocket::SendArray2D(a, n1, n2);
00076 
00077 return POSSE_SUCCESS;
00078 }
00079 //**************************************************************************
00080 template <class Etype>
00081 inline int DataClient::SendArray3D(char *keyword, Etype ***a)
00082 {
00083 int handle;
00084 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00085 if (!VerifyElementSize(handle, sizeof(Etype))) return POSSE_FAILURE;
00086 if (!isDynamicArray(handle, 3)) return POSSE_FAILURE;
00087 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00088 
00089 int n1 = RecvVar<int>();   
00090 int n2 = RecvVar<int>();
00091 int n3 = RecvVar<int>();   
00092 RemoteSocket::SendArray3D(a, n1, n2, n3);
00093                 
00094 return POSSE_SUCCESS;
00095 }
00096 //**************************************************************************
00097 template <class Etype>
00098 inline int DataClient::SendArray4D(char *keyword, Etype ****a)
00099 {
00100 int handle;
00101 if (!isValidKeyword(keyword, &handle)) return POSSE_FAILURE;
00102 if (!VerifyElementSize(handle, sizeof(Etype))) return POSSE_FAILURE;
00103 if (!isDynamicArray(handle, 4)) return POSSE_FAILURE;
00104 if (!SendKeyForDataSend(handle)) return POSSE_FAILURE;
00105 
00106 int n1 = RecvVar<int>();
00107 int n2 = RecvVar<int>();
00108 int n3 = RecvVar<int>();
00109 int n4 = RecvVar<int>();
00110 RemoteSocket::SendArray4D(a, n1, n2, n3, n4);
00111 
00112 return POSSE_SUCCESS;
00113 }
00114 //**************************************************************************
00115 inline int DataClient::SendFile(char *filename, char *destfile)
00116 {
00117 SendKeyword("Rinternal_ftp");
00118 if (destfile == NULL)
00119         SendLine(filename);
00120 else
00121         SendLine(destfile);
00122 return RemoteSocket::SendFile(filename);
00123 }
00124 //**************************************************************************
00125 #endif // _DATACLIENT_SEND_H_
00126 //**************************************************************************

Generated on Sun Jun 16 17:36:41 2002 for Anirudh's Vortex-Wake Simulation Code by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001