00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef ELST2_H
00021 #define ELST2_H
00022
00023 #include <stdio.h>
00024 #include "host.h"
00025 #include "serialis.h"
00026 #include "lsterr.h"
00027
00028 class ELIST2_ITERATOR;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 class DLLSYM ELIST2_LINK
00059 {
00060 friend class ELIST2_ITERATOR;
00061 friend class ELIST2;
00062
00063 ELIST2_LINK *prev;
00064 ELIST2_LINK *next;
00065
00066 public:
00067 ELIST2_LINK() {
00068 prev = next = NULL;
00069 }
00070
00071 ELIST2_LINK(
00072 const ELIST2_LINK &) {
00073 prev = next = NULL;
00074 }
00075
00076 void operator= (
00077 const ELIST2_LINK &) {
00078 prev = next = NULL;
00079 }
00080
00081
00082
00083
00084
00085
00086 };
00087
00088
00089
00090
00091
00092
00093
00094 class DLLSYM ELIST2
00095 {
00096 friend class ELIST2_ITERATOR;
00097
00098 ELIST2_LINK *last;
00099
00100 ELIST2_LINK *First() {
00101 return last ? last->next : NULL;
00102 }
00103
00104 public:
00105 ELIST2() {
00106 last = NULL;
00107 }
00108
00109 void internal_clear (
00110 void (*zapper) (ELIST2_LINK *));
00111
00112
00113 bool empty() {
00114 return !last;
00115 }
00116
00117 bool singleton() {
00118 return last ? (last == last->next) : FALSE;
00119 }
00120
00121 void shallow_copy(
00122 ELIST2 *from_list) {
00123 last = from_list->last;
00124 }
00125
00126
00127 void internal_deep_copy (ELIST2_LINK * (*copier) (ELIST2_LINK *),
00128 const ELIST2 * list);
00129
00130 void assign_to_sublist(
00131 ELIST2_ITERATOR *start_it,
00132 ELIST2_ITERATOR *end_it);
00133
00134 inT32 length();
00135
00136 void sort (
00137 int comparator (
00138 const void *, const void *));
00139
00140
00141
00142
00143
00144
00145 void add_sorted(int comparator(const void*, const void*),
00146 ELIST2_LINK* new_link);
00147
00148 void internal_dump (
00149 FILE * f,
00150 void element_serialiser (
00151 FILE *, ELIST2_LINK *));
00152
00153 void internal_de_dump (
00154 FILE * f,
00155
00156 ELIST2_LINK * element_de_serialiser (
00157 FILE *));
00158
00159 void prep_serialise();
00160
00161
00162
00163
00164
00165
00166 };
00167
00168
00169
00170
00171
00172
00173
00174 class DLLSYM ELIST2_ITERATOR
00175 {
00176 friend void ELIST2::assign_to_sublist(ELIST2_ITERATOR *, ELIST2_ITERATOR *);
00177
00178 ELIST2 *list;
00179 ELIST2_LINK *prev;
00180 ELIST2_LINK *current;
00181 ELIST2_LINK *next;
00182 bool ex_current_was_last;
00183
00184 bool ex_current_was_cycle_pt;
00185
00186 ELIST2_LINK *cycle_pt;
00187
00188 bool started_cycling;
00189
00190
00191 ELIST2_LINK *extract_sublist(
00192 ELIST2_ITERATOR *other_it);
00193
00194 public:
00195 ELIST2_ITERATOR() {
00196 list = NULL;
00197 }
00198
00199 ELIST2_ITERATOR(
00200 ELIST2 *list_to_iterate);
00201
00202 void set_to_list(
00203 ELIST2 *list_to_iterate);
00204
00205 void add_after_then_move(
00206 ELIST2_LINK *new_link);
00207
00208 void add_after_stay_put(
00209 ELIST2_LINK *new_link);
00210
00211 void add_before_then_move(
00212 ELIST2_LINK *new_link);
00213
00214 void add_before_stay_put(
00215 ELIST2_LINK *new_link);
00216
00217 void add_list_after(
00218 ELIST2 *list_to_add);
00219
00220 void add_list_before(
00221 ELIST2 *list_to_add);
00222
00223 ELIST2_LINK *data() {
00224 #ifndef NDEBUG
00225 if (!current)
00226 NULL_DATA.error ("ELIST2_ITERATOR::data", ABORT, NULL);
00227 if (!list)
00228 NO_LIST.error ("ELIST2_ITERATOR::data", ABORT, NULL);
00229 #endif
00230 return current;
00231 }
00232
00233 ELIST2_LINK *data_relative(
00234 inT8 offset);
00235
00236 ELIST2_LINK *forward();
00237
00238 ELIST2_LINK *backward();
00239
00240 ELIST2_LINK *extract();
00241
00242
00243 ELIST2_LINK *move_to_first();
00244
00245 ELIST2_LINK *move_to_last();
00246
00247 void mark_cycle_pt();
00248
00249 bool empty() {
00250 #ifndef NDEBUG
00251 if (!list)
00252 NO_LIST.error ("ELIST2_ITERATOR::empty", ABORT, NULL);
00253 #endif
00254 return list->empty ();
00255 }
00256
00257 bool current_extracted() {
00258 return !current;
00259 }
00260
00261 bool at_first();
00262
00263 bool at_last();
00264
00265 bool cycled_list();
00266
00267 void add_to_end(
00268 ELIST2_LINK *new_link);
00269
00270 void exchange(
00271 ELIST2_ITERATOR *other_it);
00272
00273 inT32 length();
00274
00275 void sort (
00276 int comparator (
00277 const void *, const void *));
00278
00279 };
00280
00281
00282
00283
00284
00285
00286
00287
00288 inline void ELIST2_ITERATOR::set_to_list(
00289 ELIST2 *list_to_iterate) {
00290 #ifndef NDEBUG
00291 if (!this)
00292 NULL_OBJECT.error ("ELIST2_ITERATOR::set_to_list", ABORT, NULL);
00293 if (!list_to_iterate)
00294 BAD_PARAMETER.error ("ELIST2_ITERATOR::set_to_list", ABORT,
00295 "list_to_iterate is NULL");
00296 #endif
00297
00298 list = list_to_iterate;
00299 prev = list->last;
00300 current = list->First ();
00301 next = current ? current->next : NULL;
00302 cycle_pt = NULL;
00303 started_cycling = FALSE;
00304 ex_current_was_last = FALSE;
00305 ex_current_was_cycle_pt = FALSE;
00306 }
00307
00308
00309
00310
00311
00312
00313
00314
00315 inline ELIST2_ITERATOR::ELIST2_ITERATOR(ELIST2 *list_to_iterate) {
00316 set_to_list(list_to_iterate);
00317 }
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327 inline void ELIST2_ITERATOR::add_after_then_move(
00328 ELIST2_LINK *new_element) {
00329 #ifndef NDEBUG
00330 if (!this)
00331 NULL_OBJECT.error ("ELIST2_ITERATOR::add_after_then_move", ABORT, NULL);
00332 if (!list)
00333 NO_LIST.error ("ELIST2_ITERATOR::add_after_then_move", ABORT, NULL);
00334 if (!new_element)
00335 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_after_then_move", ABORT,
00336 "new_element is NULL");
00337 if (new_element->next)
00338 STILL_LINKED.error ("ELIST2_ITERATOR::add_after_then_move", ABORT, NULL);
00339 #endif
00340
00341 if (list->empty ()) {
00342 new_element->next = new_element;
00343 new_element->prev = new_element;
00344 list->last = new_element;
00345 prev = next = new_element;
00346 }
00347 else {
00348 new_element->next = next;
00349 next->prev = new_element;
00350
00351 if (current) {
00352 new_element->prev = current;
00353 current->next = new_element;
00354 prev = current;
00355 if (current == list->last)
00356 list->last = new_element;
00357 }
00358 else {
00359 new_element->prev = prev;
00360 prev->next = new_element;
00361 if (ex_current_was_last)
00362 list->last = new_element;
00363 if (ex_current_was_cycle_pt)
00364 cycle_pt = new_element;
00365 }
00366 }
00367 current = new_element;
00368 }
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 inline void ELIST2_ITERATOR::add_after_stay_put(
00379 ELIST2_LINK *new_element) {
00380 #ifndef NDEBUG
00381 if (!this)
00382 NULL_OBJECT.error ("ELIST2_ITERATOR::add_after_stay_put", ABORT, NULL);
00383 if (!list)
00384 NO_LIST.error ("ELIST2_ITERATOR::add_after_stay_put", ABORT, NULL);
00385 if (!new_element)
00386 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_after_stay_put", ABORT,
00387 "new_element is NULL");
00388 if (new_element->next)
00389 STILL_LINKED.error ("ELIST2_ITERATOR::add_after_stay_put", ABORT, NULL);
00390 #endif
00391
00392 if (list->empty ()) {
00393 new_element->next = new_element;
00394 new_element->prev = new_element;
00395 list->last = new_element;
00396 prev = next = new_element;
00397 ex_current_was_last = FALSE;
00398 current = NULL;
00399 }
00400 else {
00401 new_element->next = next;
00402 next->prev = new_element;
00403
00404 if (current) {
00405 new_element->prev = current;
00406 current->next = new_element;
00407 if (prev == current)
00408 prev = new_element;
00409 if (current == list->last)
00410 list->last = new_element;
00411 }
00412 else {
00413 new_element->prev = prev;
00414 prev->next = new_element;
00415 if (ex_current_was_last) {
00416 list->last = new_element;
00417 ex_current_was_last = FALSE;
00418 }
00419 }
00420 next = new_element;
00421 }
00422 }
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 inline void ELIST2_ITERATOR::add_before_then_move(
00433 ELIST2_LINK *new_element) {
00434 #ifndef NDEBUG
00435 if (!this)
00436 NULL_OBJECT.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);
00437 if (!list)
00438 NO_LIST.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);
00439 if (!new_element)
00440 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_before_then_move", ABORT,
00441 "new_element is NULL");
00442 if (new_element->next)
00443 STILL_LINKED.error ("ELIST2_ITERATOR::add_before_then_move", ABORT, NULL);
00444 #endif
00445
00446 if (list->empty ()) {
00447 new_element->next = new_element;
00448 new_element->prev = new_element;
00449 list->last = new_element;
00450 prev = next = new_element;
00451 }
00452 else {
00453 prev->next = new_element;
00454 new_element->prev = prev;
00455
00456 if (current) {
00457 new_element->next = current;
00458 current->prev = new_element;
00459 next = current;
00460 }
00461 else {
00462 new_element->next = next;
00463 next->prev = new_element;
00464 if (ex_current_was_last)
00465 list->last = new_element;
00466 if (ex_current_was_cycle_pt)
00467 cycle_pt = new_element;
00468 }
00469 }
00470 current = new_element;
00471 }
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 inline void ELIST2_ITERATOR::add_before_stay_put(
00482 ELIST2_LINK *new_element) {
00483 #ifndef NDEBUG
00484 if (!this)
00485 NULL_OBJECT.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);
00486 if (!list)
00487 NO_LIST.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);
00488 if (!new_element)
00489 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT,
00490 "new_element is NULL");
00491 if (new_element->next)
00492 STILL_LINKED.error ("ELIST2_ITERATOR::add_before_stay_put", ABORT, NULL);
00493 #endif
00494
00495 if (list->empty ()) {
00496 new_element->next = new_element;
00497 new_element->prev = new_element;
00498 list->last = new_element;
00499 prev = next = new_element;
00500 ex_current_was_last = TRUE;
00501 current = NULL;
00502 }
00503 else {
00504 prev->next = new_element;
00505 new_element->prev = prev;
00506
00507 if (current) {
00508 new_element->next = current;
00509 current->prev = new_element;
00510 if (next == current)
00511 next = new_element;
00512 }
00513 else {
00514 new_element->next = next;
00515 next->prev = new_element;
00516 if (ex_current_was_last)
00517 list->last = new_element;
00518 }
00519 prev = new_element;
00520 }
00521 }
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531 inline void ELIST2_ITERATOR::add_list_after(ELIST2 *list_to_add) {
00532 #ifndef NDEBUG
00533 if (!this)
00534 NULL_OBJECT.error ("ELIST2_ITERATOR::add_list_after", ABORT, NULL);
00535 if (!list)
00536 NO_LIST.error ("ELIST2_ITERATOR::add_list_after", ABORT, NULL);
00537 if (!list_to_add)
00538 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_list_after", ABORT,
00539 "list_to_add is NULL");
00540 #endif
00541
00542 if (!list_to_add->empty ()) {
00543 if (list->empty ()) {
00544 list->last = list_to_add->last;
00545 prev = list->last;
00546 next = list->First ();
00547 ex_current_was_last = TRUE;
00548 current = NULL;
00549 }
00550 else {
00551 if (current) {
00552 current->next = list_to_add->First ();
00553 current->next->prev = current;
00554 if (current == list->last)
00555 list->last = list_to_add->last;
00556 list_to_add->last->next = next;
00557 next->prev = list_to_add->last;
00558 next = current->next;
00559 }
00560 else {
00561 prev->next = list_to_add->First ();
00562 prev->next->prev = prev;
00563 if (ex_current_was_last) {
00564 list->last = list_to_add->last;
00565 ex_current_was_last = FALSE;
00566 }
00567 list_to_add->last->next = next;
00568 next->prev = list_to_add->last;
00569 next = prev->next;
00570 }
00571 }
00572 list_to_add->last = NULL;
00573 }
00574 }
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585 inline void ELIST2_ITERATOR::add_list_before(ELIST2 *list_to_add) {
00586 #ifndef NDEBUG
00587 if (!this)
00588 NULL_OBJECT.error ("ELIST2_ITERATOR::add_list_before", ABORT, NULL);
00589 if (!list)
00590 NO_LIST.error ("ELIST2_ITERATOR::add_list_before", ABORT, NULL);
00591 if (!list_to_add)
00592 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_list_before", ABORT,
00593 "list_to_add is NULL");
00594 #endif
00595
00596 if (!list_to_add->empty ()) {
00597 if (list->empty ()) {
00598 list->last = list_to_add->last;
00599 prev = list->last;
00600 current = list->First ();
00601 next = current->next;
00602 ex_current_was_last = FALSE;
00603 }
00604 else {
00605 prev->next = list_to_add->First ();
00606 prev->next->prev = prev;
00607
00608 if (current) {
00609 list_to_add->last->next = current;
00610 current->prev = list_to_add->last;
00611 }
00612 else {
00613 list_to_add->last->next = next;
00614 next->prev = list_to_add->last;
00615 if (ex_current_was_last)
00616 list->last = list_to_add->last;
00617 if (ex_current_was_cycle_pt)
00618 cycle_pt = prev->next;
00619 }
00620 current = prev->next;
00621 next = current->next;
00622 }
00623 list_to_add->last = NULL;
00624 }
00625 }
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637 inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
00638 ELIST2_LINK *extracted_link;
00639
00640 #ifndef NDEBUG
00641 if (!this)
00642 NULL_OBJECT.error ("ELIST2_ITERATOR::extract", ABORT, NULL);
00643 if (!list)
00644 NO_LIST.error ("ELIST2_ITERATOR::extract", ABORT, NULL);
00645 if (!current)
00646
00647 NULL_CURRENT.error ("ELIST2_ITERATOR::extract",
00648 ABORT, NULL);
00649 #endif
00650
00651 if (list->singleton()) {
00652
00653 prev = next = list->last = NULL;
00654 } else {
00655 prev->next = next;
00656 next->prev = prev;
00657
00658 if (current == list->last) {
00659 list->last = prev;
00660 ex_current_was_last = TRUE;
00661 } else {
00662 ex_current_was_last = FALSE;
00663 }
00664 }
00665
00666 ex_current_was_cycle_pt = (current == cycle_pt) ? TRUE : FALSE;
00667 extracted_link = current;
00668 extracted_link->next = NULL;
00669 extracted_link->prev = NULL;
00670 current = NULL;
00671 return extracted_link;
00672 }
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682 inline ELIST2_LINK *ELIST2_ITERATOR::move_to_first() {
00683 #ifndef NDEBUG
00684 if (!this)
00685 NULL_OBJECT.error ("ELIST2_ITERATOR::move_to_first", ABORT, NULL);
00686 if (!list)
00687 NO_LIST.error ("ELIST2_ITERATOR::move_to_first", ABORT, NULL);
00688 #endif
00689
00690 current = list->First ();
00691 prev = list->last;
00692 next = current ? current->next : NULL;
00693 return current;
00694 }
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704 inline ELIST2_LINK *ELIST2_ITERATOR::move_to_last() {
00705 #ifndef NDEBUG
00706 if (!this)
00707 NULL_OBJECT.error ("ELIST2_ITERATOR::move_to_last", ABORT, NULL);
00708 if (!list)
00709 NO_LIST.error ("ELIST2_ITERATOR::move_to_last", ABORT, NULL);
00710 #endif
00711
00712 current = list->last;
00713 prev = current ? current->prev : NULL;
00714 next = current ? current->next : NULL;
00715 return current;
00716 }
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730 inline void ELIST2_ITERATOR::mark_cycle_pt() {
00731 #ifndef NDEBUG
00732 if (!this)
00733 NULL_OBJECT.error ("ELIST2_ITERATOR::mark_cycle_pt", ABORT, NULL);
00734 if (!list)
00735 NO_LIST.error ("ELIST2_ITERATOR::mark_cycle_pt", ABORT, NULL);
00736 #endif
00737
00738 if (current)
00739 cycle_pt = current;
00740 else
00741 ex_current_was_cycle_pt = TRUE;
00742 started_cycling = FALSE;
00743 }
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753 inline bool ELIST2_ITERATOR::at_first() {
00754 #ifndef NDEBUG
00755 if (!this)
00756 NULL_OBJECT.error ("ELIST2_ITERATOR::at_first", ABORT, NULL);
00757 if (!list)
00758 NO_LIST.error ("ELIST2_ITERATOR::at_first", ABORT, NULL);
00759 #endif
00760
00761
00762 return ((list->empty ()) || (current == list->First ()) || ((current == NULL) &&
00763 (prev == list->last) &&
00764 !ex_current_was_last));
00765 }
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775 inline bool ELIST2_ITERATOR::at_last() {
00776 #ifndef NDEBUG
00777 if (!this)
00778 NULL_OBJECT.error ("ELIST2_ITERATOR::at_last", ABORT, NULL);
00779 if (!list)
00780 NO_LIST.error ("ELIST2_ITERATOR::at_last", ABORT, NULL);
00781 #endif
00782
00783
00784 return ((list->empty ()) || (current == list->last) || ((current == NULL) &&
00785 (prev == list->last) &&
00786 ex_current_was_last));
00787 }
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797 inline bool ELIST2_ITERATOR::cycled_list() {
00798 #ifndef NDEBUG
00799 if (!this)
00800 NULL_OBJECT.error ("ELIST2_ITERATOR::cycled_list", ABORT, NULL);
00801 if (!list)
00802 NO_LIST.error ("ELIST2_ITERATOR::cycled_list", ABORT, NULL);
00803 #endif
00804
00805 return ((list->empty ()) || ((current == cycle_pt) && started_cycling));
00806
00807 }
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817 inline inT32 ELIST2_ITERATOR::length() {
00818 #ifndef NDEBUG
00819 if (!this)
00820 NULL_OBJECT.error ("ELIST2_ITERATOR::length", ABORT, NULL);
00821 if (!list)
00822 NO_LIST.error ("ELIST2_ITERATOR::length", ABORT, NULL);
00823 #endif
00824
00825 return list->length ();
00826 }
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836 inline void
00837 ELIST2_ITERATOR::sort (
00838 int comparator (
00839 const void *, const void *)) {
00840 #ifndef NDEBUG
00841 if (!this)
00842 NULL_OBJECT.error ("ELIST2_ITERATOR::sort", ABORT, NULL);
00843 if (!list)
00844 NO_LIST.error ("ELIST2_ITERATOR::sort", ABORT, NULL);
00845 #endif
00846
00847 list->sort (comparator);
00848 move_to_first();
00849 }
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862 inline void ELIST2_ITERATOR::add_to_end(
00863 ELIST2_LINK *new_element) {
00864 #ifndef NDEBUG
00865 if (!this)
00866 NULL_OBJECT.error ("ELIST2_ITERATOR::add_to_end", ABORT, NULL);
00867 if (!list)
00868 NO_LIST.error ("ELIST2_ITERATOR::add_to_end", ABORT, NULL);
00869 if (!new_element)
00870 BAD_PARAMETER.error ("ELIST2_ITERATOR::add_to_end", ABORT,
00871 "new_element is NULL");
00872 if (new_element->next)
00873 STILL_LINKED.error ("ELIST2_ITERATOR::add_to_end", ABORT, NULL);
00874 #endif
00875
00876 if (this->at_last ()) {
00877 this->add_after_stay_put (new_element);
00878 }
00879 else {
00880 if (this->at_first ()) {
00881 this->add_before_stay_put (new_element);
00882 list->last = new_element;
00883 }
00884 else {
00885 new_element->next = list->last->next;
00886 new_element->prev = list->last;
00887 list->last->next->prev = new_element;
00888 list->last->next = new_element;
00889 list->last = new_element;
00890 }
00891 }
00892 }
00893
00894
00895
00896
00897
00898
00899
00900
00901 #define QUOTE_IT( parm ) #parm
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941 #define ELIST2IZEH_A( CLASSNAME ) \
00942 \
00943 extern DLLSYM void CLASSNAME##_zapper( \
00944 ELIST2_LINK* link);
00945
00946 #define ELIST2IZEH_B( CLASSNAME ) \
00947 \
00948
00949
00950
00951
00952
00953 \
00954 \
00955 class DLLSYM CLASSNAME##_LIST : public ELIST2 \
00956 { \
00957 public: \
00958 CLASSNAME##_LIST():ELIST2() {} \
00959 \
00960 \
00961 CLASSNAME##_LIST( \
00962 const CLASSNAME##_LIST&) \
00963 { DONT_CONSTRUCT_LIST_BY_COPY.error( QUOTE_IT( CLASSNAME##_LIST ), \
00964 ABORT, NULL ); } \
00965 \
00966 void clear() \
00967 { ELIST2::internal_clear( &CLASSNAME##_zapper ); } \
00968 \
00969 ~CLASSNAME##_LIST() \
00970 { clear(); } \
00971 \
00972 \
00973 void deep_copy(const CLASSNAME##_LIST* src_list, \
00974 CLASSNAME* (*copier)(const CLASSNAME*)); \
00975 \
00976 void operator=( \
00977 const CLASSNAME##_LIST&) \
00978 { DONT_ASSIGN_LISTS.error( QUOTE_IT( CLASSNAME##_LIST ), \
00979 ABORT, NULL ); }
00980
00981 #define ELIST2IZEH_C( CLASSNAME ) \
00982 }; \
00983 \
00984 \
00985 \
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995 \
00996 \
00997 class DLLSYM CLASSNAME##_IT : public ELIST2_ITERATOR \
00998 { \
00999 public: \
01000 CLASSNAME##_IT():ELIST2_ITERATOR(){} \
01001 \
01002 CLASSNAME##_IT( \
01003 CLASSNAME##_LIST* list):ELIST2_ITERATOR(list){} \
01004 \
01005 CLASSNAME* data() \
01006 { return (CLASSNAME*) ELIST2_ITERATOR::data(); } \
01007 \
01008 CLASSNAME* data_relative( \
01009 inT8 offset) \
01010 { return (CLASSNAME*) ELIST2_ITERATOR::data_relative( offset ); } \
01011 \
01012 CLASSNAME* forward() \
01013 { return (CLASSNAME*) ELIST2_ITERATOR::forward(); } \
01014 \
01015 CLASSNAME* backward() \
01016 { return (CLASSNAME*) ELIST2_ITERATOR::backward(); } \
01017 \
01018 CLASSNAME* extract() \
01019 { return (CLASSNAME*) ELIST2_ITERATOR::extract(); } \
01020 \
01021 CLASSNAME* move_to_first() \
01022 { return (CLASSNAME*) ELIST2_ITERATOR::move_to_first(); } \
01023 \
01024 CLASSNAME* move_to_last() \
01025 { return (CLASSNAME*) ELIST2_ITERATOR::move_to_last(); } \
01026 };
01027
01028 #define ELIST2IZEH( CLASSNAME ) \
01029 \
01030 ELIST2IZEH_A( CLASSNAME ) \
01031 \
01032 ELIST2IZEH_B( CLASSNAME ) \
01033 \
01034 ELIST2IZEH_C( CLASSNAME )
01035
01036 #define ELIST2IZEH_S( CLASSNAME ) \
01037 \
01038 ELIST2IZEH_A( CLASSNAME ) \
01039 \
01040 extern DLLSYM void CLASSNAME##_serialiser( \
01041 FILE* f, \
01042 ELIST2_LINK* element); \
01043 \
01044 extern DLLSYM ELIST2_LINK* CLASSNAME##_de_serialiser( \
01045 FILE* f); \
01046 \
01047 ELIST2IZEH_B( CLASSNAME ) \
01048 \
01049 void dump( \
01050 FILE* f) \
01051 { ELIST2::internal_dump( f, &CLASSNAME##_serialiser );} \
01052 \
01053 void de_dump( \
01054 FILE* f) \
01055 { ELIST2::internal_de_dump( f, &CLASSNAME##_de_serialiser );} \
01056 \
01057 make_serialise( CLASSNAME##_LIST ) \
01058 \
01059 ELIST2IZEH_C( CLASSNAME )
01060
01061
01062
01063
01064
01065
01066 #define ELIST2IZE( CLASSNAME ) \
01067 \
01068
01069
01070
01071
01072
01073
01074
01075 \
01076 \
01077 DLLSYM void CLASSNAME##_zapper( \
01078 ELIST2_LINK* link) \
01079 { \
01080 delete (CLASSNAME *) link; \
01081 } \
01082 \
01083 \
01084 void CLASSNAME##_LIST::deep_copy(const CLASSNAME##_LIST* src_list, \
01085 CLASSNAME* (*copier)(const CLASSNAME*)) { \
01086 \
01087 CLASSNAME##_IT from_it(const_cast<CLASSNAME##_LIST*>(src_list)); \
01088 CLASSNAME##_IT to_it(this); \
01089 \
01090 for (from_it.mark_cycle_pt(); !from_it.cycled_list(); from_it.forward()) \
01091 to_it.add_after_then_move((*copier)(from_it.data())); \
01092 }
01093
01094 #define ELIST2IZE_S(CLASSNAME) \
01095 \
01096 ELIST2IZE(CLASSNAME) \
01097 \
01098
01099
01100
01101
01102
01103
01104 \
01105 \
01106 DLLSYM void CLASSNAME##_serialiser(FILE* f, ELIST2_LINK* element) { \
01107 reinterpret_cast<CLASSNAME*>(element)->serialise(f); \
01108 } \
01109 \
01110
01111
01112
01113
01114
01115
01116 \
01117 \
01118 DLLSYM ELIST2_LINK* CLASSNAME##_de_serialiser(FILE* f) { \
01119 return reinterpret_cast<ELIST2_LINK*>(CLASSNAME::de_serialise(f)); \
01120 }
01121 #endif