Changeset 4248 for issm/trunk/src/c/objects/Hook.cpp
- Timestamp:
- 06/26/10 12:30:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Hook.cpp
r4236 r4248 104 104 } 105 105 /*}}}*/ 106 /*FUNCTION Hook::copy(Hook* input) {{{1*/107 void Hook::copy(Hook* input){108 109 int i;110 Object** input_objects=NULL;111 int* input_ids=NULL;112 int* input_offsets=NULL;113 114 /*get internals of input: */115 this->num=input->GetNum();116 input_objects=input->GetObjects();117 input_ids=input->Ids();118 input_offsets=input->GetOffsets();119 120 if(this->num){121 this->objects=(Object**)xmalloc(this->num*sizeof(Object*));122 this->ids=(int*)xmalloc(this->num*sizeof(int));123 this->offsets=(int*)xmalloc(this->num*sizeof(int));124 }125 126 127 for(i=0;i<this->num;i++){128 this->objects[i]=input_objects[i];129 this->offsets[i]=input_offsets[i];130 this->ids[i]=input_ids[i];131 }132 }133 /*}}}*/134 106 /*FUNCTION Hook::~Hook(){{{1*/ 135 107 Hook::~Hook(){ … … 142 114 /*}}}*/ 143 115 144 /*Object marshalling*/ 116 /*Some of the Object functionality: */ 117 /*FUNCTION Hook::Echo{{{1*/ 118 void Hook::Echo(void){ 119 120 int i; 121 if (num){ 122 printf(" Hook: \n"); 123 printf(" num=%i\n",this->num); 124 printf(" ids: "); 125 for (i=0;i<this->num;i++){ 126 printf("%i ",this->ids[i]); 127 } 128 printf("\n"); 129 printf(" offsets: "); 130 for (i=0;i<this->num;i++){ 131 printf("%i ",this->offsets[i]); 132 } 133 printf("\n"); 134 } 135 else{ 136 printf(" Hook: num=0 \n"); 137 } 138 } 139 /*}}}*/ 140 /*FUNCTION Hook::DeepEcho{{{1*/ 141 void Hook::DeepEcho(void){ 142 143 int i; 144 if (num){ 145 printf(" Hook: \n"); 146 printf(" num=%i\n",this->num); 147 printf(" ids: "); 148 for (i=0;i<this->num;i++){ 149 printf("%i ",this->ids[i]); 150 } 151 printf("\n"); 152 printf(" offsets: "); 153 for (i=0;i<this->num;i++){ 154 printf("%i ",this->offsets[i]); 155 } 156 printf("\n"); 157 if (!objects) printf(" warning: object not hooked yet\n"); 158 else{ 159 printf(" objects:\n "); 160 for (i=0;i<this->num;i++){ 161 printf(" object %i\n",i); 162 objects[i]->DeepEcho(); 163 } 164 } 165 } 166 else{ 167 printf(" Hook: num=0 \n"); 168 } 169 } 170 /*}}}*/ 145 171 /*FUNCTION Hook::Marshall{{{1*/ 146 172 void Hook::Marshall(char** pmarshalled_dataset){ … … 226 252 } 227 253 /*}}}*/ 228 229 /*Object processing: */ 254 /*FUNCTION Hook::copy(Hook* input) {{{1*/ 255 void Hook::copy(Hook* input){ 256 257 int i; 258 Object** input_objects=NULL; 259 int* input_ids=NULL; 260 int* input_offsets=NULL; 261 262 /*get internals of input: */ 263 this->num=input->GetNum(); 264 input_objects=input->GetObjects(); 265 input_ids=input->Ids(); 266 input_offsets=input->GetOffsets(); 267 268 if(this->num){ 269 this->objects=(Object**)xmalloc(this->num*sizeof(Object*)); 270 this->ids=(int*)xmalloc(this->num*sizeof(int)); 271 this->offsets=(int*)xmalloc(this->num*sizeof(int)); 272 } 273 274 275 for(i=0;i<this->num;i++){ 276 this->objects[i]=input_objects[i]; 277 this->offsets[i]=input_offsets[i]; 278 this->ids[i]=input_ids[i]; 279 } 280 } 281 /*}}}*/ 282 283 /*Hook management: */ 230 284 /*FUNCTION Hook::configure{{{1*/ 231 285 void Hook::configure(DataSet* dataset){ … … 270 324 } 271 325 /*}}}*/ 272 /*FUNCTION Hook::Echo{{{1*/273 void Hook::Echo(void){274 275 int i;276 if (num){277 printf(" Hook: \n");278 printf(" num=%i\n",this->num);279 printf(" ids: ");280 for (i=0;i<this->num;i++){281 printf("%i ",this->ids[i]);282 }283 printf("\n");284 printf(" offsets: ");285 for (i=0;i<this->num;i++){286 printf("%i ",this->offsets[i]);287 }288 printf("\n");289 }290 else{291 printf(" Hook: num=0 \n");292 }293 }294 /*}}}*/295 /*FUNCTION Hook::DeepEcho{{{1*/296 void Hook::DeepEcho(void){297 298 int i;299 if (num){300 printf(" Hook: \n");301 printf(" num=%i\n",this->num);302 printf(" ids: ");303 for (i=0;i<this->num;i++){304 printf("%i ",this->ids[i]);305 }306 printf("\n");307 printf(" offsets: ");308 for (i=0;i<this->num;i++){309 printf("%i ",this->offsets[i]);310 }311 printf("\n");312 if (!objects) printf(" warning: object not hooked yet\n");313 else{314 printf(" objects:\n ");315 for (i=0;i<this->num;i++){316 printf(" object %i\n",i);317 objects[i]->DeepEcho();318 }319 }320 }321 else{322 printf(" Hook: num=0 \n");323 }324 }325 /*}}}*/326 327 /*Object functions*/328 326 /*FUNCTION Hook::delivers{{{1*/ 329 327 Object* Hook::delivers(void){
Note:
See TracChangeset
for help on using the changeset viewer.