10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
19 #include "../datastructures/datastructures.h"
20 #include "../shared/shared.h"
21 #include "../classes/classes.h"
39 enum_type=dataset_enum;
51 vector<Object*>::iterator obj;
56 copy->sorted=this->sorted;
57 copy->numsorted=this->numsorted;
58 copy->presorted=this->presorted;
61 for ( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
63 object_copy = (*obj)->
copy();
64 copy->AddObject(object_copy);
68 int objsize = this->numsorted;
69 if(this->sorted && objsize>0 && this->id_offsets){
71 copy->id_offsets=xNew<int>(objsize);
72 xMemCpy<int>(
copy->id_offsets,this->id_offsets,objsize);
74 else copy->id_offsets=NULL;
75 if(this->sorted && objsize>0 && this->sorted_ids){
77 copy->sorted_ids=xNew<int>(objsize);
78 xMemCpy<int>(
copy->sorted_ids,this->sorted_ids,objsize);
80 else copy->sorted_ids=NULL;
87 xDelete<int>(sorted_ids);
88 xDelete<int>(id_offsets);
93 void DataSet::Marshall(
char** pmarshalled_data,
int* pmarshalled_data_size,
int marshall_direction){
95 vector<Object*>::iterator obj;
101 obj_size=objects.size();
115 if(!(this->sorted && numsorted>0 && this->id_offsets)){
124 for( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
125 obj_enum=(*obj)->ObjectEnum();
127 (*obj)->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
134 if (!(this->sorted && numsorted>0)){
144 for(i=0;i<obj_size;i++){
154 node->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
155 this->AddObject(node);
160 vertex->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
161 this->AddObject(vertex);
166 matice->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
167 this->AddObject(matice);
172 matestar->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
173 this->AddObject(matestar);
178 spcstatic->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
179 this->AddObject(spcstatic);
184 spcdynamic->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
185 this->AddObject(spcdynamic);
190 spctransient->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
191 this->AddObject(spctransient);
196 tria->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
197 this->AddObject(tria);
202 penta->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
203 this->AddObject(penta);
208 tetra->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
209 this->AddObject(tetra);
214 seg->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
215 this->AddObject(seg);
220 rift->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
221 this->AddObject(rift);
226 numflux->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
227 this->AddObject(numflux);
232 pengrid->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
233 this->AddObject(pengrid);
238 penpair->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
239 this->AddObject(penpair);
243 result->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
245 this->AddObject(result);
247 else _error_(
"could not recognize enum type: " << obj_enum <<
": " <<
EnumToStringx(obj_enum) );
255 objects.push_back(
object);
266 vector<Object*>::reverse_iterator object;
271 for (
object=objects.rbegin() ;
object < objects.rend();
object++ ){
279 vector<Object*>::iterator iterator;
282 iterator = find(objects.begin(), objects.end(),
object);
284 objects.erase(iterator);
293 vector<Object*>::iterator object;
297 _printf0_(
"DataSet echo: " << objects.size() <<
" objects\n");
299 for (
object=objects.begin() ;
object < objects.end();
object++ ){
302 (*object)->DeepEcho();
309 vector<Object*>::iterator object;
313 _printf0_(
"DataSet echo: " << objects.size() <<
" objects\n");
315 for (
object=objects.begin() ;
object < objects.end();
object++ ){
330 return objects[offset]->ObjectEnum();
341 return objects[offset];
351 if(!sorted || objects.size()>numsorted)
_error_(
"trying to binary search on a non-sorted dataset!");
354 if(!
binary_search(&id_offset,eid,sorted_ids,objects.size())){
359 offset=id_offsets[id_offset];
362 if(poffset)*poffset=offset;
365 return objects[offset];
375 if(sorted_ids) xDelete<int>(sorted_ids);
376 if(id_offsets) xDelete<int>(id_offsets);
379 sorted_ids=xNew<int>(objects.size());
380 id_offsets=xNew<int>(objects.size());
383 for(
int i=0;i<objects.size();i++){
385 sorted_ids[i]=objects[i]->Id();
395 numsorted=objects.size();
402 return objects.size();
409 _error_(
"not implemented yet!");