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

1Darray.h

Go to the documentation of this file.
00001 //**************************************************************************
00002 #ifndef _1DARRAY_H
00003 #define _1DARRAY_H
00004 //**************************************************************************
00005 #include "myendian.h"
00006 #include "remotesocket.h"
00007 //**************************************************************************
00008 template <class Etype>
00009 inline int RemoteSocket::SendArray1D(Etype *a, int n1)
00010 {
00011 static int elemsize = sizeof(Etype);
00012 int totsize = elemsize*n1;
00013 unsigned char *data;
00014 ALLOC1D(&data, totsize);
00015 int ptr = 0;
00016 
00017 memcpy(&data[ptr], &a[0], totsize);
00018 ptr += totsize;
00019 
00020 setByteOrder(data, totsize, elemsize);
00021 SendBytes(totsize, data);
00022 FREE1D(&data, totsize);
00023 
00024 return 0;
00025 }
00026 //**************************************************************************
00027 template <class Etype>
00028 inline int RemoteSocket::RecvArray1D(Etype *a, int n1)
00029 {
00030 static int elemsize = sizeof(Etype);
00031 int totsize = elemsize*n1;
00032 unsigned char *data;
00033 ALLOC1D(&data, totsize);
00034 int ptr = 0;
00035 
00036 RecvBytes(totsize, data);
00037 setByteOrder(data, totsize, elemsize);
00038 
00039 memcpy(&a[0], &data[ptr], totsize);
00040 ptr += totsize;
00041 
00042 FREE1D(&data, totsize);
00043 
00044 return 0;
00045 }
00046 //**************************************************************************
00047 #endif // _1DARRAY_H
00048 //**************************************************************************

Generated on Sun Jun 16 17:36:48 2002 for POSSE: Portable Object-oriented Scientific Steering Environment by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001