Changeset 25528


Ignore:
Timestamp:
09/03/20 15:11:20 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: better handling of Marshall

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/datastructures/DataSet.cpp

    r25508 r25528  
    9494
    9595        vector<Object*>::iterator obj;
    96         int obj_size=0;
    9796        int obj_enum=0;
    9897        int i;
    9998
    100         if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
     99        int obj_size=0;
     100        if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
    101101                obj_size=objects.size();
    102102        }
    103103        else{
    104                 clear();
     104                /*FIXME: if the assert below does not go off, then remove else{}*/
     105                _assert_(this->Size()==0);
     106                //clear();
    105107        }
    106108
     
    114116
    115117        /*Now branch according to direction of marshalling: */
    116         if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
     118        if(marshallhandle->OperationNumber()!=MARSHALLING_LOAD){
    117119                if(!(this->sorted && numsorted>0 && this->id_offsets)){
    118120                        this->sorted_ids=NULL;
     
    152154                         *stored in the buffer: */
    153155                        if(obj_enum==NodeEnum){
    154                                 Node* node=NULL;
    155                                 node=new Node();
     156                                Node* node=new Node();
    156157                                node->Marshall(marshallhandle);
    157158                                this->AddObject(node);
    158159                        }
    159160                        else if(obj_enum==VertexEnum){
    160                                 Vertex* vertex=NULL;
    161                                 vertex=new Vertex();
     161                                Vertex* vertex=new Vertex();
    162162                                vertex->Marshall(marshallhandle);
    163163                                this->AddObject(vertex);
    164164                        }
    165165                        else if(obj_enum==MaticeEnum){
    166                                 Matice* matice=NULL;
    167                                 matice=new Matice();
     166                                Matice* matice=new Matice();
    168167                                matice->Marshall(marshallhandle);
    169168                                this->AddObject(matice);
    170169                        }
    171170                        else if(obj_enum==MatestarEnum){
    172                                 Matestar* matestar=NULL;
    173                                 matestar=new Matestar();
     171                                Matestar* matestar=new Matestar();
    174172                                matestar->Marshall(marshallhandle);
    175173                                this->AddObject(matestar);
    176174                        }
    177175                        else if(obj_enum==SpcStaticEnum){
    178                                 SpcStatic* spcstatic=NULL;
    179                                 spcstatic=new SpcStatic();
     176                                SpcStatic* spcstatic=new SpcStatic();
    180177                                spcstatic->Marshall(marshallhandle);
    181178                                this->AddObject(spcstatic);
    182179                        }
    183180                        else if(obj_enum==SpcDynamicEnum){
    184                                 SpcDynamic* spcdynamic=NULL;
    185                                 spcdynamic=new SpcDynamic();
     181                                SpcDynamic* spcdynamic=new SpcDynamic();
    186182                                spcdynamic->Marshall(marshallhandle);
    187183                                this->AddObject(spcdynamic);
    188184                        }
    189185                        else if(obj_enum==SpcTransientEnum){
    190                                 SpcTransient* spctransient=NULL;
    191                                 spctransient=new SpcTransient();
     186                                SpcTransient* spctransient=new SpcTransient();
    192187                                spctransient->Marshall(marshallhandle);
    193188                                this->AddObject(spctransient);
    194189                        }
    195190                        else if(obj_enum==TriaEnum){
    196                                 Tria* tria=NULL;
    197                                 tria=new Tria();
     191                                Tria* tria=new Tria();
    198192                                tria->Marshall(marshallhandle);
    199193                                this->AddObject(tria);
    200194                        }
    201195                        else if(obj_enum==PentaEnum){
    202                                 Penta* penta=NULL;
    203                                 penta=new Penta();
     196                                Penta* penta=new Penta();
    204197                                penta->Marshall(marshallhandle);
    205198                                this->AddObject(penta);
    206199                        }
    207200                        else if(obj_enum==TetraEnum){
    208                                 Tetra* tetra=NULL;
    209                                 tetra=new Tetra();
     201                                Tetra* tetra=new Tetra();
    210202                                tetra->Marshall(marshallhandle);
    211203                                this->AddObject(tetra);
    212204                        }
    213205                        else if(obj_enum==SegEnum){
    214                                 Seg* seg=NULL;
    215                                 seg=new Seg();
     206                                Seg* seg=new Seg();
    216207                                seg->Marshall(marshallhandle);
    217208                                this->AddObject(seg);
    218209                        }
    219210                        else if(obj_enum==RiftfrontEnum){
    220                                 Riftfront* rift=NULL;
    221                                 rift=new Riftfront();
     211                                Riftfront* rift=new Riftfront();
    222212                                rift->Marshall(marshallhandle);
    223213                                this->AddObject(rift);
    224214                        }
    225215                        else if(obj_enum==NumericalfluxEnum){
    226                                 Numericalflux* numflux=NULL;
    227                                 numflux=new Numericalflux();
     216                                Numericalflux* numflux=new Numericalflux();
    228217                                numflux->Marshall(marshallhandle);
    229218                                this->AddObject(numflux);
    230219                        }
    231220                        else if(obj_enum==PengridEnum){
    232                                 Pengrid* pengrid=NULL;
    233                                 pengrid=new Pengrid();
     221                                Pengrid* pengrid=new Pengrid();
    234222                                pengrid->Marshall(marshallhandle);
    235223                                this->AddObject(pengrid);
    236224                        }
    237225                        else if(obj_enum==PenpairEnum){
    238                                 Penpair* penpair=NULL;
    239                                 penpair=new Penpair();
     226                                Penpair* penpair=new Penpair();
    240227                                penpair->Marshall(marshallhandle);
    241228                                this->AddObject(penpair);
     
    245232                                result->Marshall(marshallhandle);
    246233                                this->AddObject(result);
     234                        }
     235                        else if(obj_enum==DependentObjectEnum){
     236                                DependentObject* dep=new DependentObject();
     237                                dep->Marshall(marshallhandle);
     238                                this->AddObject(dep);
     239                        }
     240                        else if(obj_enum==GenericExternalResultEnum){
     241                                _printf_("   WARNING: Could not load GenericExternalResult, need overload\n");
    247242                        }
    248243                        else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) );
Note: See TracChangeset for help on using the changeset viewer.