Changeset 3386


Ignore:
Timestamp:
04/05/10 09:22:22 (15 years ago)
Author:
Mathieu Morlighem
Message:

bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/c/objects/Hook.cpp

    r3383 r3386  
    2020
    2121
    22 /*FUNCTION Hook default constructor {{{1*/
     22/*Constructor/Destructors*/
     23/*FUNCTION Hook::Hook(){{{1*/
    2324Hook::Hook(){
    2425        this->num=0;
     
    2930}
    3031/*}}}*/
    31 /*FUNCTION Hook constructor {{{1*/
     32/*FUNCTION Hook::Hook(int* ids, int num){{{1*/
    3233Hook::Hook(int* ids, int num){
    3334
     
    4344        for (i=0;i<this->num;i++){
    4445                this->ids[i]=ids[i];
    45         }
    46 }
    47 /*}}}*/
    48 /*FUNCTION Hook sort of copy constructor {{{1*/
     46                this->objects[i]=NULL;
     47                this->offsets[i]=0;
     48        }
     49}
     50/*}}}*/
     51/*FUNCTION Hook::Hook(Object** hook_objects, int* hook_ids, int* hook_offsets,int hook_num){{{1*/
    4952Hook::Hook(Object** hook_objects, int* hook_ids, int* hook_offsets,int hook_num){
    5053
     
    5760}
    5861/*}}}*/
    59 /*FUNCTION Hook copy constructor {{{1*/
     62/*FUNCTION Hook::Hook(Hook* input) {{{1*/
    6063Hook::Hook(Hook* input){
    6164
     
    8588}
    8689/*}}}*/
    87 /*FUNCTION Hook destructeur{{{1*/
     90/*FUNCTION Hook::~Hook(){{{1*/
    8891Hook::~Hook(){
    8992        /*deallocate: */
     
    9497}
    9598/*}}}*/
    96 /*FUNCTION Hook Marshall{{{1*/
     99
     100/*Object marshalling*/
     101/*FUNCTION Hook::Marshall{{{1*/
    97102void Hook::Marshall(char** pmarshalled_dataset){
    98103
     
    121126}
    122127/*}}}*/
    123 /*FUNCTION Hook MarshallSize{{{1*/
     128/*FUNCTION Hook::MarshallSize{{{1*/
    124129int Hook::MarshallSize(){
    125130
     
    131136}
    132137/*}}}*/
    133 /*FUNCTION Hook Demarshall{{{1*/
     138/*FUNCTION Hook::Demarshall{{{1*/
    134139void Hook::Demarshall(char** pmarshalled_dataset){
    135140
     
    166171}
    167172/*}}}*/
    168 /*FUNCTION Hook deliver{{{1*/
    169 Object* Hook::delivers(void){
    170        
    171         /*first, check that we only have one T object in our object list: */
    172         if (this->num!=1) ISSMERROR(exprintf("%s%i%s\n"," trying to delivery a single hook object when hook holds ",this->num," objects"));
    173 
    174         /*check NULL: */
    175         if (this->objects=NULL)ISSMERROR("hook is not pointing to any object, objects pointer is NULL");
    176 
    177         return *objects;
    178 }
    179 
    180 /*}}}*/
    181 /*FUNCTION Hook deliver{{{1*/
    182 Object** Hook::deliverp(void){
    183         return objects;
    184 }
    185 /*}}}*/
    186 /*FUNCTION Hook ResolvePointers{{{1*/
     173
     174/*Object processing: */
     175/*FUNCTION Hook::configure{{{1*/
    187176void Hook::configure(DataSet* dataset){
    188177
     
    194183
    195184                /*is this object id -1? If so, drop this search, it was not requested: */
    196                 if (this->ids[i]==-1)continue;
     185                if (this->ids[i]==-1) continue;
    197186
    198187                /*Check whether existing this->objects are correct: */
     
    218207                        this->objects[i]=(Object*)dataset->GetObjectById(this->offsets+i,this->ids[i]); //remember the offset for later on.
    219208                        /*check the id is correct!: */
    220                         if (this->objects[i]->GetId()!=this->ids[i])ISSMERROR(exprintf("%s%i%s%i%s"," wrong id: ",this->objects[i]->GetId()," vs ",this->ids[i],"  in resolved pointer!"));
    221                 }
    222         }
    223 }
    224 /*}}}*/
    225 /*FUNCTION Hook echo{{{1*/
     209                        if (this->objects[i]->GetId()!=this->ids[i]) ISSMERROR(exprintf("%s%i%s%i%s"," wrong id: ",this->objects[i]->GetId()," vs ",this->ids[i],"  in resolved pointer!"));
     210                }
     211        }
     212}
     213/*}}}*/
     214/*FUNCTION Hook::Echo{{{1*/
    226215void Hook::Echo(void){
    227216
     
    244233}
    245234/*}}}*/
    246 /*FUNCTION Hook deep echo{{{1*/
     235/*FUNCTION Hook::DeepEcho{{{1*/
    247236void Hook::DeepEcho(void){
    248237
     
    270259}
    271260/*}}}*/
    272 /*FUNCTION Hook Spawn{{{1*/
     261
     262/*Object functions*/
     263/*FUNCTION Hook::delivers{{{1*/
     264Object* Hook::delivers(void){
     265       
     266        /*first, check that we only have one T object in our object list: */
     267        if (this->num!=1) ISSMERROR(exprintf("%s%i%s\n"," trying to delivery a single hook object when hook holds ",this->num," objects"));
     268
     269        /*check NULL: */
     270        if (this->objects=NULL)ISSMERROR("hook is not pointing to any object, objects pointer is NULL");
     271
     272        return *objects;
     273}
     274
     275/*}}}*/
     276/*FUNCTION Hook::deliverp{{{1*/
     277Object** Hook::deliverp(void){
     278        return objects;
     279}
     280/*}}}*/
     281/*FUNCTION Hook::GetIds{{{1*/
     282int* Hook::GetIds(void){
     283        return this->ids;
     284}
     285/*}}}*/
     286/*FUNCTION Hook::GetNum{{{1*/
     287int Hook::GetNum(void){
     288        return this->num;
     289}
     290/*}}}*/
     291/*FUNCTION Hook::GetObjects{{{1*/
     292Object** Hook::GetObjects(void){
     293        return this->objects;
     294}
     295/*}}}*/
     296/*FUNCTION Hook::GetOffsets{{{1*/
     297int* Hook::GetOffsets(void){
     298        return this->offsets;
     299}
     300/*}}}*/
     301/*FUNCTION Hook::Spawn{{{1*/
    273302Hook* Hook::Spawn(int* indices, int numindices){
    274303
     
    298327}
    299328/*}}}*/
    300 /*FUNCTION Hook GetObjects{{{1*/
    301 Object** Hook::GetObjects(void){
    302         return this->objects;
    303 }
    304 /*}}}*/
    305 /*FUNCTION Hook GetIds{{{1*/
    306 int* Hook::GetIds(void){
    307         return this->ids;
    308 }
    309 /*}}}*/
    310 /*FUNCTION Hook GetOffsets{{{1*/
    311 int* Hook::GetOffsets(void){
    312         return this->offsets;
    313 }
    314 /*}}}*/
    315 /*FUNCTION Hook GetNum{{{1*/
    316 int Hook::GetNum(void){
    317         return this->num;
    318 }
    319 /*}}}*/
Note: See TracChangeset for help on using the changeset viewer.