Ignore:
Timestamp:
09/01/20 14:46:34 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h

    r25506 r25507  
    5353                        fwrite(&step,sizeof(int),1,fid);
    5454                } /*}}}*/
    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);
    6162
    6263                        /*Marshal result name*/
    6364                        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);
    6768
    6869                        /*Marshall value*/
    6970                        this->value=0;
    7071                        bool isnull=true;
    71                         if(marshall_direction==MARSHALLING_WRITE || marshall_direction == MARSHALLING_SIZE){
     72                        if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber() == MARSHALLING_SIZE){
    7273                                if(value) isnull=false;
    7374                        }
    74                         MARSHALLING(isnull);
    75                         if(!isnull){MARSHALLING(value);}
     75                        marshallhandle->call(isnull);
     76                        if(!isnull){
     77                                marshallhandle->call(this->value);
     78                        }
    7679                }  /*}}}*/
    7780
     
    167170                        _error_("template ObjectEnum not implemented for this ResultType\n");
    168171                } /*}}}*/
    169                 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
    170                         _error_("not implemented yet!");
    171                 }
    172                 /*}}}*/
    173172                void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
    174173                        _error_("not implemented yet!");
     
    239238        return BoolExternalResultEnum;
    240239} /*}}}*/
    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);
     240template <> inline void GenericExternalResult<bool>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
     241
     242        this->GenericMarshall(marshallhandle);
    244243
    245244}  /*}}}*/
     
    256255        return IntExternalResultEnum;
    257256} /*}}}*/
    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 
     257template <> inline void GenericExternalResult<int>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
     258        this->GenericMarshall(marshallhandle);
    262259}  /*}}}*/
    263260
     
    276273        return value;
    277274} /*}}}*/
    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 
     275template <> inline void GenericExternalResult<double>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
     276        this->GenericMarshall(marshallhandle);
    282277}  /*}}}*/
    283278
     
    347342        return StringExternalResultEnum;
    348343} /*}}}*/
    349 template <> inline void GenericExternalResult<char*>::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
     344template <> inline void GenericExternalResult<char*>::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
    350345
    351346        int size = 0;
    352347
    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);
    361356
    362357}  /*}}}*/
     
    477472        return IntMatExternalResultEnum;
    478473} /*}}}*/
    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);
     474template <> 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);
    490486
    491487}  /*}}}*/
     
    609605        return value;
    610606} /*}}}*/
    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);
     607template <> 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);
    622619
    623620}  /*}}}*/
     
    831828        }
    832829        /*}}}*/
    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){/*{{{*/
    834831
    835832                _error_("GenericExternalResult instantiated for type Vector<IssmDouble>* called " << result_name << " not implemented yet");
Note: See TracChangeset for help on using the changeset viewer.