void setGroup(Cmiss::Field_ensemble_group *in_ensemble_group) { Cmiss_field_access(in_ensemble_group->getField()); clear_ensemble_group(); ensemble_group = in_ensemble_group; clear_iterator(); }
~Indexing() { if (valuesIterator) Cmiss_ensemble_iterator_destroy(&valuesIterator); clear_iterator(); clear_ensemble_group(); }
int main() { Hash_map hash_map; Data data; Iterator iter; int i, correct= 1; int sorted_offsets[NUM]= {7, 8, 9, 2, 0, 3, 4, 6, 1, 5}; mcheck_pedantic(NULL); hash_map= create_example_hash_map(); iter= create_iterator(hash_map); for (i= 0; i < 5 && correct; i++) { data= next(&iter); if ((int) *((long *) data) != sorted_offsets[i]) correct= 0; } if (!get(&hash_map, (Key) (long) 'a', &data) || data != (Data) 7 || !get(&hash_map, (Key) (long) 'q', &data) || data != (Data) 0 || !get(&hash_map, (Key) (long) 'c', &data) || data != (Data) 9) correct= 0; reset(&iter); for (i= 0; i < NUM && correct; i++) { data= next(&iter); if ((int) *((long *) data) != sorted_offsets[i]) correct= 0; } if (correct && !has_next(iter)) printf("Correct values were accessed when iterating! :)\n"); else printf("Incorrect results occurred when iterating. :(\n"); clear(&hash_map); clear_iterator(&iter); if (mallinfo().uordblks != 0) printf("Memory leak of %d bytes. :(\n", mallinfo().uordblks); else printf("No memory leak detected. :)\n"); return 0; }
void setAllEnsemble() { clear_iterator(); clear_ensemble_group(); }