13 #define MSH_ASSERT(X) {assert(X);} 15 #define MSH_HEADER_SIZE (sizeof(int)*2) 18 #define MSH_TOTALSIZE_OFFSET (sizeof(int)) 19 #define MSH_TYPECHOICE_OFFSET 0 21 #define MSH_SET_TYPECHOICE(X) { memcpy(msh_buffer+MSH_TYPECHOICE_OFFSET,&(X),sizeof(int));} 22 #define MSH_SET_TOTALSIZE(X) { memcpy(msh_buffer+MSH_TOTALSIZE_OFFSET,&(X),sizeof(int));} 23 #define MSH_GET_TYPECHOICE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TYPECHOICE_OFFSET,sizeof(int));} 24 #define MSH_GET_TOTALSIZE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TOTALSIZE_OFFSET,sizeof(int));} 33 return (((x)+(WORD_SIZE-1)) / WORD_SIZE) *
WORD_SIZE;
65 if(chIsUnmarshaling !=
'u') {
66 printf(
"MarshaledObj(void*, char): wrong argument\n");
124 if(msh_size > msh_extent){
130 int msh_displacement = msh_cursor -
msh_buffer;
131 int field_displacement = msh_field_begin -
msh_buffer;
133 while(new_size > msh_extent)
136 msh_buffer = (
char *)realloc( msh_buffer, msh_extent);
139 msh_cursor = msh_buffer + msh_displacement;
140 msh_field_begin = msh_buffer + field_displacement;
157 throw "Tried to marshal in object marked isUnmarshaling = true";
158 msh_currentSize = size;
162 memcpy(msh_cursor, &msh_currentSize,
sizeof(
int));
163 msh_cursor +=
sizeof(int);
164 memcpy(msh_cursor, p, size);
165 msh_cursor += msh_currentSize;
175 msh_currentSize = size;
176 msh_cursor +=
sizeof(int);
177 memcpy(p, msh_cursor, msh_currentSize);
178 msh_cursor += msh_currentSize;
185 template <
class T,
class>
#define MSH_GET_TOTALSIZE(X, BUF)
void unmarshalPrimitive(void *p, int size)
MarshaledObj(void *buf, char chIsUnmarshaling)
static int ROUND_UP(int x)
printf("%d Experimental points found\, nlines)
#define MSH_SET_TYPECHOICE(X)
void resizeBuffer(size_t new_size)
#define MSH_GET_TYPECHOICE(X, BUF)
void EXTEND_BUFFER(int size)
const MarshaledObj & operator=(const MarshaledObj &right)
void marshalPrimitive(void *p, int size)
static const int WORD_SIZE
#define MSH_SET_TOTALSIZE(X)