- Timestamp:
- 09/01/20 14:46:34 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
r25506 r25507 53 53 fwrite(&step,sizeof(int),1,fid); 54 54 } /*}}}*/ 55 void GenericMarshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/ 56 57 MARSHALLING_ENUM(this->ObjectEnum()); 58 MARSHALLING(id); 59 MARSHALLING(step); 60 MARSHALLING(time); 55 void GenericMarshall(MarshallHandle* marshallhandle){/*{{{*/ 56 57 int object_enum = this->ObjectEnum(); 58 marshallhandle->call(object_enum); 59 marshallhandle->call(this->id); 60 marshallhandle->call(this->step); 61 marshallhandle->call(this->time); 61 62 62 63 /*Marshal result name*/ 63 64 int size = 0; 64 if(marshall _direction==MARSHALLING_WRITE || marshall_direction== MARSHALLING_SIZE) size=strlen(result_name)+1;65 MARSHALLING(size);66 MARSHALLING_DYNAMIC(result_name,char,size);65 if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber() == MARSHALLING_SIZE) size=strlen(result_name)+1; 66 marshallhandle->call(size); 67 marshallhandle->call(this->result_name,size); 67 68 68 69 /*Marshall value*/ 69 70 this->value=0; 70 71 bool isnull=true; 71 if(marshall _direction==MARSHALLING_WRITE || marshall_direction== MARSHALLING_SIZE){72 if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber() == MARSHALLING_SIZE){ 72 73 if(value) isnull=false; 73 74 } 74 MARSHALLING(isnull); 75 if(!isnull){MARSHALLING(value);} 75 marshallhandle->call(isnull); 76 if(!isnull){ 77 marshallhandle->call(this->value); 78 } 76 79 } /*}}}*/ 77 80 … … 167 170 _error_("template ObjectEnum not implemented for this ResultType\n"); 168 171 } /*}}}*/ 169 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/170 _error_("not implemented yet!");171 }172 /*}}}*/173 172 void Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 174 173 _error_("not implemented yet!"); … … 239 238 return BoolExternalResultEnum; 240 239 } /*}}}*/ 241 template <> inline void GenericExternalResult<bool>::Marshall (char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/242 243 this->GenericMarshall( pmarshalled_data,pmarshalled_data_size,marshall_direction);240 template <> inline void GenericExternalResult<bool>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 241 242 this->GenericMarshall(marshallhandle); 244 243 245 244 } /*}}}*/ … … 256 255 return IntExternalResultEnum; 257 256 } /*}}}*/ 258 template <> inline void GenericExternalResult<int>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/ 259 260 this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 261 257 template <> inline void GenericExternalResult<int>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 258 this->GenericMarshall(marshallhandle); 262 259 } /*}}}*/ 263 260 … … 276 273 return value; 277 274 } /*}}}*/ 278 template <> inline void GenericExternalResult<double>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/ 279 280 this->GenericMarshall(pmarshalled_data,pmarshalled_data_size,marshall_direction); 281 275 template <> inline void GenericExternalResult<double>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 276 this->GenericMarshall(marshallhandle); 282 277 } /*}}}*/ 283 278 … … 347 342 return StringExternalResultEnum; 348 343 } /*}}}*/ 349 template <> inline void GenericExternalResult<char*>::Marshall (char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/344 template <> inline void GenericExternalResult<char*>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 350 345 351 346 int size = 0; 352 347 353 if(marshall _direction==MARSHALLING_WRITE || marshall_direction== MARSHALLING_SIZE)size=strlen(value)+1;354 355 MARSHALLING(id);356 MARSHALLING(result_name);357 MARSHALLING(size);358 MARSHALLING_DYNAMIC(value,char,size);359 MARSHALLING(step);360 MARSHALLING(time);348 if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber() == MARSHALLING_SIZE)size=strlen(value)+1; 349 350 marshallhandle->call(this->id); 351 marshallhandle->call(this->result_name); 352 marshallhandle->call(size); 353 marshallhandle->call(this->value,size); 354 marshallhandle->call(this->step); 355 marshallhandle->call(this->time); 361 356 362 357 } /*}}}*/ … … 477 472 return IntMatExternalResultEnum; 478 473 } /*}}}*/ 479 template <> inline void GenericExternalResult<int*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/ 480 481 MARSHALLING_ENUM(this->ObjectEnum()); 482 483 MARSHALLING(id); 484 MARSHALLING(result_name); 485 MARSHALLING(M); 486 MARSHALLING(N); 487 MARSHALLING_DYNAMIC(value,int,M*N); 488 MARSHALLING(step); 489 MARSHALLING(time); 474 template <> inline void GenericExternalResult<int*>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 475 476 int object_enum = this->ObjectEnum(); 477 marshallhandle->call(object_enum); 478 479 marshallhandle->call(this->id); 480 marshallhandle->call(this->result_name); 481 marshallhandle->call(this->M); 482 marshallhandle->call(this->N); 483 marshallhandle->call(this->value,M*N); 484 marshallhandle->call(this->step); 485 marshallhandle->call(this->time); 490 486 491 487 } /*}}}*/ … … 609 605 return value; 610 606 } /*}}}*/ 611 template <> inline void GenericExternalResult<IssmPDouble*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/ 612 613 MARSHALLING_ENUM(this->ObjectEnum()); 614 615 MARSHALLING(id); 616 MARSHALLING(result_name); 617 MARSHALLING(M); 618 MARSHALLING(N); 619 MARSHALLING_DYNAMIC(value,IssmPDouble,M*N); 620 MARSHALLING(step); 621 MARSHALLING(time); 607 template <> inline void GenericExternalResult<IssmPDouble*>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 608 609 int object_enum = this->ObjectEnum(); 610 marshallhandle->call(object_enum); 611 612 marshallhandle->call(this->id); 613 marshallhandle->call(this->result_name); 614 marshallhandle->call(this->M); 615 marshallhandle->call(this->N); 616 marshallhandle->call(this->value,M*N); 617 marshallhandle->call(this->step); 618 marshallhandle->call(this->time); 622 619 623 620 } /*}}}*/ … … 831 828 } 832 829 /*}}}*/ 833 template <> inline void GenericExternalResult<Vector<IssmDouble>*>::Marshall (char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/830 template <> inline void GenericExternalResult<Vector<IssmDouble>*>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/ 834 831 835 832 _error_("GenericExternalResult instantiated for type Vector<IssmDouble>* called " << result_name << " not implemented yet");
Note:
See TracChangeset
for help on using the changeset viewer.