map.hd
1 #REM
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 #PARAMETER(iType)
54 #DESCRIPTION(Type of the keys. For pointers, you usual must declare Global_iType_ICOPY and Global_iType_IFREE)
55 #PARAMETER(oType)
56 #DESCRIPTION(Type of the values)
57 #CHECK
58 #REM
59 #REM
60 #REPLACE_PERHAPS_START(iT###ypeVar,iType)
61 #REPLACE_PERHAPS_START(oT###ypeVar,oType)
62 #REPLACE_PERHAPS_START(iT###ypeSuffix,)
63 #REPLACE_PERHAPS_START(oT###ypeSuffix,)
64 #REM
65 #REM
66 #REPLACE_PERHAPS_START(iT###ypeParamSuffix,iTypeSuffix)
67 #REPLACE_PERHAPS_START(oT###ypeParamSuffix,oTypeSuffix)
68 #REPLACE_PERHAPS_START(iT###ypeParam,iType iTypeParamSuffix)
69 #REPLACE_PERHAPS_START(oT###ypeParam,oType oTypeParamSuffix)
70 #REPLACE_PERHAPS_START(iT###ypeVarParam,iTypeVar iTypeParamSuffix)
71 #REPLACE_PERHAPS_START(oT###ypeVarParam,oTypeVar oTypeParamSuffix)
72 #REPLACE_PERHAPS_START(iT###ypeTouched,iTypeParam)
73 #REPLACE_PERHAPS_START(oT###ypeTouched,oTypeParam)
74 #REM
75 #REM
76 #REPLACE_PERHAPS_START(iT###ypeResultSuffix,iTypeSuffix)
77 #REPLACE_PERHAPS_START(oT###ypeResultSuffix,oTypeSuffix)
78 #REPLACE_PERHAPS_START(iT###ypeResult,iType iTypeResultSuffix)
79 #IF(oType == void)
80 #REPLACE_PERHAPS_START(oT###ypeResult,Global_ERWIN_BOOL)
81 #ELSE
82 #REPLACE_PERHAPS_START(oT###ypeResult,oType oTypeResultSuffix)
83 #ENDIF
84 #REPLACE_PERHAPS_START(oT###ypeIndex,oTypeResult)
85 #REM
86 #REM
87 #REPLACE(Map,Global_map_iType_oType)
88 #REPLACE(NSMap,nsmap_iType_oType)
89 #REPLACE(List,Map_hashlist)
90 #FILES(map.cd map_i.hd map_u.hd)
91 #GENERAL(Global_map_u.ErwinHExt Map_u.ErwinHExt)
92 #HEADER(Map.ErwinHExt Map_i.ErwinHExt Map_d.ErwinHExt Map_f.ErwinHExt Map_ti.ErwinHExt Map_n.ErwinHExt)
93 #CLASS_IDENTIFIER(Map_class)
94 #CLASS_IDENTIFIER(NSMap_class)
95 #SPLIT_TARGET(Map)
96 #REM *****************************************************************************************
97 #OUTPUT(Map_f.ErwinHExt)
98
99 #ifndef ERWIN_Map_f_ErwinHExt
100 #define ERWIN_Map_f_ErwinHExt
101
102 struct Map_t;
103 #TYPEDEF_GLOBAL(aggregate Map_t NSMap_t)
104 #ifndef __cplusplus
105 typedef struct Map_t Map_t;
106 #endif
107 typedef struct Map_t Map_class;
108 #TYPEDEF_GLOBAL(aggregate Map_class NSMap_class)
109
110 typedef Map_t *Map_t_p;
111 #TYPEDEF_GLOBAL(Map_t_p NSMap_t_p)
112
113 typedef Map_t const *Map_t_const_p;
114 #TYPEDEF_GLOBAL(Map_t_const_p NSMap_t_const_p)
115
116 #define Map_SIG __gen_sig__
117
118 ErwinGlobalDefines
119
120 #REM #DEEPDECLS(Map,HASH_RAW,CMP,ZERO,EQUAL,HAS_CONSTANT_ZERO,ICOPY,OCOPY,IFREE,OFREE,CONSTRUCTOR,DESTRUCTOR)
121 #DEEPDECLS(Map,HASH_RAW,CMP,ZERO,EQUAL,ICOPY,OCOPY,IFREE,OFREE,CONSTRUCTOR,DESTRUCTOR)
122
123 #endif
124
125 #REM *****************************************************************************************
126 #OUTPUT(Map_n.ErwinHExt)
127
128 #CHECKINCLUDE(Map)
129
130 #ifdef Map_NEED_HEADER
131 #include "#Map.ErwinHExt"
132 #endif
133
134 #REM *****************************************************************************************
135 #OUTPUT(Map_ti.ErwinHExt)
136
137 #ifndef ERWIN_Map_ti_ErwinHExt
138 #define ERWIN_Map_ti_ErwinHExt
139
140 #define List_t_KIND STRUCT
141 #define List_t_TYPE_INFO TYPE_INFO_NAME(List_t)
142 extern TYPE_INFO_T(List_t);
143
144 #define List_t_p_KIND POINTER
145 #define List_t_p_TYPE_INFO TYPE_INFO_NAME(List_t_p)
146 extern TYPE_INFO_T(List_t_p);
147
148 #define List_t_const_p_KIND POINTER
149 #define List_t_const_p_TYPE_INFO TYPE_INFO_NAME(List_t_const_p)
150 extern TYPE_INFO_T(List_t_const_p);
151
152 #define Map_internal_Iterator_KIND STRUCT
153 #define Map_internal_Iterator_TYPE_INFO TYPE_INFO_NAME(Map_internal_Iterator)
154 extern TYPE_INFO_T(Map_internal_Iterator);
155
156 #define Map_t_KIND STRUCT
157 #define Map_t_TYPE_INFO TYPE_INFO_NAME(Map_t)
158 extern TYPE_INFO_T(Map_t);
159
160 #define Map_t_p_KIND POINTER
161 #define Map_t_p_TYPE_INFO TYPE_INFO_NAME(Map_t_p)
162 extern TYPE_INFO_T(Map_t_p);
163
164 #define Map_t_const_p_KIND POINTER
165 #define Map_t_const_p_TYPE_INFO TYPE_INFO_NAME(Map_t_const_p)
166 extern TYPE_INFO_T(Map_t_const_p);
167
168 #define Map_content_KIND VECTOR
169 #define Map_content_TYPE_INFO TYPE_INFO_NAME(Map_content)
170 extern TYPE_INFO_T(Map_content);
171
172 #define Map_content_p_KIND POINTER
173 #define Map_content_p_TYPE_INFO TYPE_INFO_NAME(Map_content_p)
174 extern TYPE_INFO_T(Map_content_p);
175
176 #define Map_class###_TYPE_INFO Map_t_TYPE_INFO
177 #define Map_class_p###_TYPE_INFO Map_t_p_TYPE_INFO
178 #define Map_class_const_p###_TYPE_INFO Map_t_const_p_TYPE_INFO
179
180 #endif
181
182 #REM *****************************************************************************************
183 #OUTPUT(Map.ErwinHExt)
184
185 #DATE
186
187
188
189
190
191
192
193
194 #LICENCE
195
196 #ifdef ERWIN_DEBUG_INCLUDE
197 #warning "Including Map.h"
198 #endif
199
200 #ifndef ERWIN_Map_ErwinHExt
201 #define ERWIN_Map_ErwinHExt
202
203 #ifdef ERWIN_DEBUG_INCLUDE
204 #warning "First inclusion of Map.h"
205 #endif
206
207
208 #ifdef Global_ERWIN_COMPILING
209 # include "erwin/defs.h"
210 #else
211 # include <erwin/defs.h>
212 #endif
213
214
215 #include "#Map_d.ErwinHExt"
216
217
218 #ifdef Global_ERWIN_COMPILING
219 # include "erwin/base.h"
220 #else
221 # include <erwin/base.h>
222 #endif
223
224
225 #ifdef Global_ERWIN_COMPILING
226 # include "erwin/forwards.h"
227 #else
228 # include <erwin/forwards.h>
229 #endif
230
231 #ifdef HAVE_STDIO_H
232 #include <stdio.h>
233 #endif
234
235 #IFCPPONLY
236 #ELSE
237 #ifdef __cplusplus
238 extern "C" {
239 #endif
240 #ENDIF
241
242 #if defined(Global_ERWIN_REQUIRE_DETERMINISM) && !defined(Global_ERWIN_WEAK_DETERMINISM)
243 # ifndef __cplusplus
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258 # endif
259 #endif
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279 #undef Global_map_errno
280
281 #if Global_ERWIN_GLOBAL_ERRNO
282 # define Global_map_errno Global_erwininternalmaperrno
283
284 #endif
285
286 #undef Global_map_strerror
287 #define Global_map_strerror Global_erwininternalmapstrerror
288
289
290
291
292
293
294
295 #undef Global_MAP_OK
296 #define Global_MAP_OK Global_ERWININTERNALMAPOK
297
298
299 #undef Global_MAP_IS_OK
300 #define Global_MAP_IS_OK(X) Global_ERWININTERNALMAPISOK(X)
301
302
303 #undef Global_MAP_IS_ERROR
304 #define Global_MAP_IS_ERROR(X) Global_ERWININTERNALMAPISERROR(X)
305
306
307 #undef Global_MAP_IS_WARNING
308 #define Global_MAP_IS_WARNING(X) Global_ERWININTERNALMAPISWARNING(X)
309
310
311 #undef Global_MAP_ERR_NOMEM
312 #define Global_MAP_ERR_NOMEM Global_ERWININTERNALMAPERRNOMEM
313
314
315
316
317 #undef Global_MAP_ERR_ASSERTIONFAILED
318 #define Global_MAP_ERR_ASSERTIONFAILED Global_ERWININTERNALMAPERRASSERTIONFAILED
319
320
321
322
323
324
325
326
327
328
329 #undef Global_MAP_WARN_EXISTINGKEY
330 #define Global_MAP_WARN_EXISTINGKEY Global_ERWININTERNALMAPWARNEXISTINGKEY
331
332
333 #undef Global_MAP_ERR_EXISTINGKEY
334 #define Global_MAP_ERR_EXISTINGKEY please_use_MAP_WARN_EXISTINGKEY_instead
335
336 #undef Global_MAP_WARN_KEYNOTFOUND
337 #define Global_MAP_WARN_KEYNOTFOUND Global_ERWININTERNALMAPWARNKEYNOTFOUND
338
339
340 #undef Global_MAP_ERR_KEYNOTFOUND
341 #define Global_MAP_ERR_KEYNOTFOUND please_use_MAP_WARN_KEYNOTFOUND_instead
342
343 #undef Global_MAP_WARN_EMTPY
344 #define Global_MAP_WARN_EMPTY Global_ERWININTERNALMAPWARNEMPTY
345
346 #undef Global_MAP_WARN_NOMOREELEMS
347 #define Global_MAP_WARN_NOMOREELEMS Global_ERWININTERNALMAPWARNNOMOREELEMS
348
349 #undef Global_MAP_REHASH_NOMEM
350 #define Global_MAP_REHASH_NOMEM Global_ERWININTERNALMAPREHASHNOMEM
351
352
353 #undef Global_MAP_REHASH_DUPLICATEKEY
354 #define Global_MAP_REHASH_DUPLICATEKEY Global_ERWININTERNALMAPREHASHDUPLICATEKEY
355
356
357
358
359
360
361 #undef Global_MAP_REHASH_RECURSION
362 #define Global_MAP_REHASH_RECURSION Global_ERWININTERNALMAPREHASHRECURSION
363
364
365
366
367 typedef iType Map_index_t;
368 typedef oType Map_value_t;
369 #TYPEDEF(Map_index_t NSMap_index_t)
370 #TYPEDEF(Map_value_t NSMap_value_t)
371
372 #REM For oType==void, 'pair' is a misnomer, but sorted operators are easier to implement.
373 typedef struct _Map_pair_t {
374 iType key;
375 #IF(oType != void)
376 oType value;
377 #ENDIF
378 } Map_pair_t;
379 #TYPEDEF(aggregate Map_pair_t NSMap_pair_t)
380
381 typedef Map_pair_t Map_pair_dynarray;
382
383
384 #REM For oType==void, 'pair' is a misnomer, but sorted operators are easier to implement.
385 typedef struct _Map_pair_ptr_t {
386 iType key;
387 #IF(oType != void)
388 oTypeVar *value;
389 #ENDIF
390 #REM For oType==void, this type is a misnomer, but sorted operators are easier to implement.
391 } Map_pair_ptr_t;
392 #TYPEDEF(aggregate Map_pair_ptr_t NSMap_pair_ptr_t)
393
394
395 typedef Map_pair_ptr_t Map_pair_ptr_dynarray;
396
397 typedef int (*Map_pair_cmp_t)(Map_pair_t const *, Map_pair_t const *);
398 #TYPEDEF(Map_pair_cmp_t NSMap_pair_cmp_t)
399
400 typedef int (*Map_pair_ptr_cmp_t)(Map_pair_ptr_t const *, Map_pair_ptr_t const *);
401 #TYPEDEF(Map_pair_ptr_cmp_t NSMap_pair_ptr_cmp_t)
402
403 typedef int (*Map_void_pair_cmp_t)(void const *, void const *);
404 #TYPEDEF(Map_void_pair_cmp_t NSMap_void_pair_cmp_t)
405
406
407
408 #IF(oType == void)
409 typedef Global_ERWIN_BOOL (*Map_feature_t)(iTypeParam);
410 #ELSE
411 typedef Global_ERWIN_BOOL (*Map_feature_t)(iTypeParam, oTypeParam);
412 #ENDIF
413 #TYPEDEF(Map_feature_t NSMap_feature_t)
414
415 #IF(oType != void)
416
417 #IF(oType == oTypeVar)
418 typedef oType *Map_element_ptr_t;
419 #ELSE
420 typedef oType const *Map_element_ptr_t;
421 #ENDIF
422 #TYPEDEF(Map_element_ptr_t NSMap_element_ptr_t)
423
424 #ENDIF(oType != void)
425
426
427 #IF(iType == iTypeResult)
428 typedef iType Map_key_result_t;
429 #ELSE
430 typedef iTypeVar const *Map_key_result_t;
431 #ENDIF
432 #TYPEDEF(Map_key_result_t NSMap_key_result_t)
433
434
435 #ifndef Global_MAP_ITERATOR
436
437 #define Global_MAP_ITERATOR
438 #REM no: TYPEDEF(aggregate Global_map_iterator_t map_iterator_t)
439 struct _Global_map_iterator_t;
440
441 typedef void (*_Global_map_iterator_callback_t) (void const *, struct _Global_map_iterator_t *);
442
443 typedef struct _Global_map_iterator_t {
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458 void *p;
459 int i;
460 #ifdef __cplusplus
461 _Global_map_iterator_t ()
462 {}
463
464
465 _Global_map_iterator_t (
466 _Global_map_iterator_callback_t callback,
467 void const *map)
468 {
469 callback (map, this);
470 }
471 #endif
472 } Global_map_iterator_t;
473
474
475 #ifdef __cplusplus
476
477
478
479
480 #REM no: TYPEDEF_CXX(aggregate Global_map_iterator_sorted_t map_iterator_sorted_t)
481 struct _Global_map_iterator_sorted_t;
482
483 typedef void (*_Global_map_iterator_sorted_callback_t)
484 (void const *, struct _Global_map_iterator_sorted_t *);
485
486 typedef int (*_Global_map_iterator_cmp_callback_t)(void const *, void const *);
487
488 typedef void (*_Global_map_iterator_sorted_init_callback_t)(
489 void const *,
490 struct _Global_map_iterator_sorted_t *,
491 _Global_map_iterator_cmp_callback_t);
492
493 typedef struct _Global_map_iterator_sorted_t {
494
495
496
497
498
499
500
501
502 void *p;
503 int l;
504 int c;
505 void (*free_cb)(void *);
506
507 _Global_map_iterator_sorted_t ():
508 free_cb(0)
509 {}
510
511 _Global_map_iterator_sorted_t (
512 _Global_map_iterator_sorted_callback_t callback,
513 void const *map)
514 {
515 callback (map, this);
516 }
517
518 _Global_map_iterator_sorted_t (
519 _Global_map_iterator_sorted_init_callback_t callback,
520 void const *map,
521 _Global_map_iterator_cmp_callback_t u)
522 {
523 callback (map, this, u);
524 }
525
526 ~_Global_map_iterator_sorted_t ()
527 {
528 if (free_cb) free_cb ((void*)this);
529
530
531
532 }
533 } Global_map_iterator_sorted_t;
534 #endif
535
536 #endif
537
538
539
540
541
542
543 Global_ERWIN_EXPORT
544 Map_t *Map_new (void) ATTR_MALLOC;
545
546
547
548
549
550
551
552 Global_ERWIN_EXPORT
553 Map_t *Map_new_with_initial_size (int ) ATTR_MALLOC;
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578 #if Map_DYN_ZERO
579 Global_ERWIN_EXPORT
580 Map_t *Map_new_with_zero (oTypeTouched ) ATTR_MALLOC;
581
582
583
584
585
586
587 Global_ERWIN_EXPORT
588 Map_t *Map_new_with_zero_and_initial_size (oTypeTouched , int ) ATTR_MALLOC;
589
590
591
592
593
594
595
596
597
598 #endif
599
600 Global_ERWIN_EXPORT
601 int Map_init (
602 Map_t * ) ATTR_NONNULL((1));
603
604
605
606
607
608
609
610
611
612
613 #if Map_DYN_ZERO
614 Global_ERWIN_EXPORT
615 int Map_init_with_zero_and_initial_size (
616 Map_t * ,
617 oTypeTouched ,
618 int ) ATTR_NONNULL((1));
619
620
621
622
623
624
625
626
627
628
629 #endif
630
631 Global_ERWIN_EXPORT
632 int Map_init_with_initial_size (
633 Map_t * ,
634 int ) ATTR_NONNULL((1));
635
636
637
638
639
640
641
642
643
644
645 Global_ERWIN_EXPORT
646 void Map_destroy (Map_t * );
647
648
649
650
651
652
653
654
655
656
657 Global_ERWIN_EXPORT
658 void Map_xchg (Map_t * , Map_t * );
659
660
661
662
663
664 Global_ERWIN_EXPORT
665 void Map_destroy_flags (
666 Map_t * , Global_ERWIN_BOOL , Global_ERWIN_BOOL );
667
668
669
670
671
672
673
674
675
676
677
678 #if !Global_ERWIN_GLOBAL_ERRNO
679 Global_ERWIN_EXPORT
680 int Map_errno(Map_t const *) ATTR_PURE ATTR_NONNULL((1));
681
682
683
684
685
686
687
688
689
690
691 Global_ERWIN_EXPORT
692 void Map_clear_errno(Map_t const *) ATTR_NONNULL((1));
693
694
695
696
697
698
699
700
701
702 #else
703
704 #define Map_errno(X) Global_map_errno
705
706
707
708
709
710
711
712
713
714
715 #define Map_clear_errno(X) ((void)(Global_map_errno= Global_MAP_OK))
716
717
718
719
720
721
722
723
724
725
726 #endif
727
728 Global_ERWIN_EXPORT
729 Map_t *Map_copy (Map_t const* );
730
731
732
733
734
735
736
737
738
739 Global_ERWIN_EXPORT
740 Map_t *Map_copy_err (Map_t const* , int *err);
741
742
743
744
745
746
747
748 Global_ERWIN_EXPORT
749 void Map_delete (Map_t* );
750
751
752
753
754
755 Global_ERWIN_EXPORT
756 void Map_delete_flags (Map_t* , Global_ERWIN_BOOL , Global_ERWIN_BOOL );
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772 #IF(oType == void)
773 Global_ERWIN_EXPORT
774 int Map_insert (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
775 #ELSE
776 Global_ERWIN_EXPORT
777 int Map_insert (Map_t* , iTypeTouched , oTypeTouched ) ATTR_NONNULL((1));
778 #ENDIF
779
780
781
782
783
784
785
786
787
788 Global_ERWIN_EXPORT
789 int Map_insert_map (Map_t* , Map_t const * );
790
791
792
793
794
795
796 Global_ERWIN_EXPORT
797 iTypeResult Map_ensure (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
798
799
800
801
802
803
804
805
806
807
808
809 Global_ERWIN_EXPORT
810 iTypeResult Map_ensure_no_icopy (Map_t * , iTypeVarParam ) ATTR_NONNULL((1));
811
812
813
814
815
816
817
818
819
820
821
822 #IF(oType != void)
823 Global_ERWIN_EXPORT
824 oTypeResult Map_find_any (Map_t const* )
825 ATTR_ERRNO_PURE;
826
827
828
829
830
831
832
833
834
835
836 #ENDIF
837
838
839 #IF(oType == void)
840 Global_ERWIN_EXPORT
841 int Map_find_any_pair (Map_key_result_t *, Map_t const* )
842 ATTR_ERRNO_PURE;
843 #ELSE
844 Global_ERWIN_EXPORT
845 int Map_find_any_pair (Map_key_result_t *, Map_element_ptr_t *, Map_t const* )
846 ATTR_ERRNO_PURE;
847 #ENDIF
848
849
850
851
852
853
854
855
856
857
858
859
860
861 Global_ERWIN_EXPORT
862 oTypeResult Map_find (Map_t const* , iTypeParam )
863 ATTR_ERRNO_PURE;
864
865
866
867
868
869 #IF(oType != void)
870 Global_ERWIN_EXPORT
871 oTypeResult Map_find_ensure (Map_t * , iTypeTouched );
872
873
874
875
876
877
878
879
880
881
882 #ENDIF
883
884 Global_ERWIN_EXPORT
885 iTypeResult Map_find_key (Map_t const* , iTypeParam ) ATTR_ERRNO_PURE;
886
887
888
889
890
891
892 Global_ERWIN_EXPORT
893 iTypeResult Map_find_any_key (Map_t const* ) ATTR_ERRNO_PURE;
894
895
896
897
898
899
900
901 #IF(oType != void)
902
903 Global_ERWIN_EXPORT
904 Map_element_ptr_t Map_find_ptr (Map_t const* , iTypeParam ) ATTR_ERRNO_PURE;
905
906
907
908
909
910
911
912
913
914
915 Global_ERWIN_EXPORT
916 Map_element_ptr_t Map_find_any_ptr (Map_t const* ) ATTR_ERRNO_PURE;
917
918
919
920
921
922
923
924
925
926
927 Global_ERWIN_EXPORT
928 Map_element_ptr_t Map_find_ptr_ensure (Map_t * , iTypeTouched );
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944 Global_ERWIN_EXPORT
945 oTypeVar Map_modify (
946 Map_t* , iTypeParam , oTypeTouched ) ATTR_NONNULL((1));
947
948
949
950
951
952
953
954
955
956 Global_ERWIN_EXPORT
957 int Map_modify_map (Map_t* , Map_t const * );
958
959
960
961
962
963
964 Global_ERWIN_EXPORT
965 int Map_set (Map_t* , iTypeTouched , oTypeTouched ) ATTR_NONNULL((1));
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982 Global_ERWIN_EXPORT
983 int Map_set_map (Map_t* , Map_t const * );
984
985
986
987
988
989 #ENDIF
990
991 Global_ERWIN_EXPORT
992 int Map_intersect (Map_t* , Map_t const * );
993
994
995
996
997
998
999
1000 Global_ERWIN_EXPORT
1001 int Map_intersect_no_resize (Map_t* , Map_t const * );
1002
1003
1004
1005
1006
1007 #IF(oType != void)
1008 Global_ERWIN_EXPORT
1009 oTypeVar Map_remove (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020 Global_ERWIN_EXPORT
1021 oTypeVar Map_remove_no_resize (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
1022
1023
1024
1025
1026
1027 Global_ERWIN_EXPORT
1028 int Map_remove_map (Map_t* , Map_t const * );
1029
1030
1031
1032
1033
1034
1035 Global_ERWIN_EXPORT
1036 int Map_remove_if (Map_t * , Map_feature_t , Global_ERWIN_BOOL );
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047 #ENDIF
1048
1049 Global_ERWIN_EXPORT
1050 int Map_erase (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
1051
1052
1053
1054
1055
1056
1057
1058 Global_ERWIN_EXPORT
1059 int Map_erase_no_resize (Map_t* , iTypeTouched ) ATTR_NONNULL((1));
1060
1061
1062
1063
1064
1065 Global_ERWIN_EXPORT
1066 int Map_erase_map (Map_t* , Map_t const * );
1067
1068
1069
1070
1071
1072
1073 Global_ERWIN_EXPORT
1074 int Map_erase_map_no_resize (Map_t* , Map_t const * );
1075
1076
1077
1078
1079
1080 Global_ERWIN_EXPORT
1081 int Map_erase_if (Map_t * , Map_feature_t , Global_ERWIN_BOOL );
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093 #IF(oType == void)
1094 Global_ERWIN_EXPORT
1095 int Map_poke (
1096 iType * ,
1097 Map_t * ,
1098 iTypeTouched ,
1099 Global_ERWIN_BOOL ) ATTR_NONNULL((2));
1100 #ELSE
1101 Global_ERWIN_EXPORT
1102 int Map_poke (
1103 iType * ,
1104 oTypeVar * ,
1105 Map_t * ,
1106 iTypeTouched ,
1107 oTypeTouched ,
1108 Global_ERWIN_BOOL ,
1109 Global_ERWIN_BOOL ) ATTR_NONNULL((3));
1110 #ENDIF
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202 #IF(oType == void)
1203 Global_ERWIN_EXPORT
1204 int Map_poke_no_icopy (
1205 iType * ,
1206 Map_t * ,
1207 iTypeVarParam ,
1208 Global_ERWIN_BOOL ) ATTR_NONNULL((2));
1209 #ELSE
1210 Global_ERWIN_EXPORT
1211 int Map_poke_no_icopy (
1212 iType * ,
1213 oTypeVar * ,
1214 Map_t * ,
1215 iTypeVarParam ,
1216 oTypeParam ,
1217 Global_ERWIN_BOOL ,
1218 Global_ERWIN_BOOL ) ATTR_NONNULL((3));
1219 #ENDIF
1220
1221
1222
1223
1224
1225
1226
1227 #IF(oType != void)
1228 Global_ERWIN_EXPORT
1229 int Map_poke_no_ocopy (
1230 iType * ,
1231 oTypeVar * ,
1232 Map_t * ,
1233 iTypeTouched ,
1234 oTypeVarParam ,
1235 Global_ERWIN_BOOL ,
1236 Global_ERWIN_BOOL ) ATTR_NONNULL((3));
1237
1238
1239
1240
1241
1242 Global_ERWIN_EXPORT
1243 int Map_poke_no_icopy_no_ocopy (
1244 iType * ,
1245 oTypeVar * ,
1246 Map_t * ,
1247 iTypeVarParam ,
1248 oTypeVarParam ,
1249 Global_ERWIN_BOOL ,
1250 Global_ERWIN_BOOL ) ATTR_NONNULL((3));
1251
1252
1253
1254
1255 #ENDIF
1256
1257 Global_ERWIN_EXPORT
1258 oTypeResult Map_zero (Map_t const* ) ATTR_PURE ATTR_NONNULL((1));
1259
1260
1261
1262
1263
1264 Global_ERWIN_EXPORT
1265 int Map_cmp (Map_t const* , Map_t const * ) ATTR_ERRNO_PURE;
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286 Global_ERWIN_EXPORT
1287 Global_ERWIN_BOOL Map_equal (Map_t const* , Map_t const * ) ATTR_ERRNO_PURE;
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300 Global_ERWIN_EXPORT
1301 int Map_cmp_keys (Map_t const* , Map_t const * ) ATTR_ERRNO_PURE;
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313 Global_ERWIN_EXPORT
1314 Global_ERWIN_BOOL Map_equal_keys (Map_t const* , Map_t const * ) ATTR_ERRNO_PURE;
1315
1316
1317
1318
1319
1320
1321
1322
1323 Global_ERWIN_EXPORT
1324 Global_hashval_t Map_hash_raw (Map_t const * ) ATTR_ERRNO_PURE;
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334 ERWIN_WRAPPER Global_hashval_t Map_hash (Map_t const *) ATTR_ERRNO_PURE;
1335
1336
1337 ERWIN_WRAPPER Global_hashval_t Map_hash (Map_t const *x)
1338 {
1339 return Map_hash_raw(x);
1340 }
1341
1342
1343
1344 Global_ERWIN_EXPORT
1345 void Map_clear (Map_t* );
1346
1347
1348
1349
1350
1351 Global_ERWIN_EXPORT
1352 void Map_clear_no_resize (Map_t* );
1353
1354
1355
1356
1357
1358 Global_ERWIN_EXPORT
1359 void Map_clear_flags (
1360 Map_t* ,
1361 Global_ERWIN_BOOL ,
1362 Global_ERWIN_BOOL );
1363
1364
1365
1366
1367
1368 Global_ERWIN_EXPORT
1369 void Map_clear_flags_no_resize (
1370 Map_t* ,
1371 Global_ERWIN_BOOL ,
1372 Global_ERWIN_BOOL );
1373
1374
1375
1376
1377
1378 Global_ERWIN_EXPORT
1379 int Map_nentries (Map_t const* ) ATTR_PURE;
1380
1381
1382
1383
1384
1385 Global_ERWIN_EXPORT
1386 Global_ERWIN_BOOL Map_empty (Map_t const* ) ATTR_PURE;
1387
1388
1389
1390
1391
1392 Global_ERWIN_EXPORT
1393 Map_pair_t *Map_get_entries (Map_t const* ) ATTR_MALLOC;
1394
1395
1396
1397
1398
1399 Global_ERWIN_EXPORT
1400 void Map_delete_entries (Map_pair_t * );
1401
1402
1403
1404 #IF(oType != void)
1405 Global_ERWIN_EXPORT
1406 Map_pair_ptr_t *Map_get_entries_ptr (Map_t const* ) ATTR_MALLOC;
1407
1408
1409
1410
1411 Global_ERWIN_EXPORT
1412 void Map_delete_entries_ptr (Map_pair_ptr_t * );
1413
1414
1415 Global_ERWIN_EXPORT
1416 oType *Map_get_values (Map_t const* ) ATTR_MALLOC;
1417
1418
1419 Global_ERWIN_EXPORT
1420 void Map_delete_values (oType * );
1421
1422 #ENDIF(oType==void)
1423
1424 Global_ERWIN_EXPORT
1425 iType *Map_get_keys (Map_t const* ) ATTR_MALLOC;
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441 Global_ERWIN_EXPORT
1442 void Map_delete_keys (iType * );
1443
1444
1445
1446
1447 Global_ERWIN_EXPORT
1448 int Map_hash_size (Map_t const* ) ATTR_PURE;
1449
1450
1451
1452
1453
1454
1455 Global_ERWIN_EXPORT
1456 void Map_rehash (Map_t* , int );
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466 Global_ERWIN_EXPORT
1467 Global_ERWIN_BOOL Map_expect_size (Map_t* , int );
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482 Global_ERWIN_EXPORT
1483 double Map_average_line_length (Map_t const* ) ATTR_PURE;
1484
1485 Global_ERWIN_EXPORT
1486 double Map_variance_line_length (Map_t const* ) ATTR_PURE;
1487
1488 #ifdef HAVE_SQRT
1489 Global_ERWIN_EXPORT
1490 double Map_deviation_line_length (Map_t const* ) ATTR_PURE;
1491 #endif
1492
1493 Global_ERWIN_EXPORT
1494 int Map_max_line_length (Map_t const* ) ATTR_PURE;
1495
1496 Global_ERWIN_EXPORT
1497 int Map_min_line_length (Map_t const* ) ATTR_PURE;
1498
1499 Global_ERWIN_EXPORT
1500 void Map_dump (FILE *, Map_t const * );
1501
1502
1503
1504
1505 #define Map_forall_nondet(h,i,k,v) \
1506 for(Map_init_iterator ((h),&i); \
1507 Map_next_iteration ((h),&i,&k,&v);)
1508
1509
1510
1511
1512
1513
1514
1515 #define Map_forall_ptr_nondet(h,i,k,v) \
1516 for(Map_init_iterator ((h),&i); \
1517 Map_next_iteration_ptr ((h),&i,&k,&v);)
1518
1519
1520
1521
1522
1523
1524
1525
1526 #define Map_forall_values_nondet(h,i,v) \
1527 for(Map_init_iterator ((h),&i); \
1528 Map_next_iteration_values ((h),&i,&v);)
1529
1530
1531
1532
1533
1534
1535
1536 #define Map_forall_values_ptr_nondet(h,i,v) \
1537 for(Map_init_iterator ((h),&i); \
1538 Map_next_iteration_values_ptr ((h),&i,&v);)
1539
1540
1541
1542
1543
1544
1545
1546
1547 #define Map_forall_keys_nondet(h,i,k) \
1548 for(Map_init_iterator ((h),&i); \
1549 Map_next_iteration_keys ((h),&i,&k);)
1550
1551
1552
1553
1554
1555
1556
1557 #define Map_forall_pairs_nondet(h,i,p) \
1558 for(Map_init_iterator ((h),&i); \
1559 Map_next_iteration_pairs ((h),&i,&p);)
1560
1561
1562
1563
1564
1565
1566
1567 #define Map_forall_pairs_ptr_nondet(h,i,p) \
1568 for(Map_init_iterator ((h),&i); \
1569 Map_next_iteration_pairs_ptr ((h),&i,&p);)
1570
1571
1572
1573
1574
1575
1576
1577
1578 #if !defined (Global_ERWIN_REQUIRE_DETERMINISM) || defined (Global_ERWIN_WEAK_DETERMINISM)
1579
1580
1581
1582 # define Map_forall(h,i,k,v) Map_forall_nondet(h,i,k,v)
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595 # define Map_forall_ptr(h,i,k,v) Map_forall_ptr_nondet(h,i,k,v)
1596
1597
1598
1599
1600
1601
1602
1603 # define Map_forall_values(h,i,v) Map_forall_values_nondet(h,i,v)
1604
1605
1606
1607
1608
1609
1610 # define Map_forall_values_ptr(h,i,v) Map_forall_values_ptr_nondet(h,i,v)
1611
1612
1613
1614
1615
1616
1617
1618 # define Map_forall_keys(h,i,k) Map_forall_keys_nondet(h,i,k)
1619
1620
1621
1622
1623
1624
1625 # define Map_forall_pairs(h,i,p) Map_forall_pairs_nondet(h,i,p)
1626
1627
1628
1629
1630
1631
1632 # define Map_forall_pairs_ptr(h,i,p) Map_forall_pairs_ptr_nondet(h,i,p)
1633
1634
1635
1636
1637
1638
1639
1640 #endif
1641
1642
1643
1644
1645 Global_ERWIN_EXPORT
1646 void Map_init_iterator (Map_t const *, Global_map_iterator_t *);
1647
1648
1649 #ifdef __cplusplus
1650 Global_ERWIN_EXPORT
1651 void Map_init_iterator_sorted_by_key (Map_t const *, Global_map_iterator_sorted_t *);
1652
1653
1654 #IF(oType != void)
1655 Global_ERWIN_EXPORT
1656 void Map_init_iterator_sorted_by_value (Map_t const *, Global_map_iterator_sorted_t *);
1657
1658
1659 Global_ERWIN_EXPORT
1660 void Map_init_iterator_sorted_by_key_and_value (Map_t const *, Global_map_iterator_sorted_t *);
1661
1662
1663 Global_ERWIN_EXPORT
1664 void Map_init_iterator_sorted_by_value_and_key (Map_t const *, Global_map_iterator_sorted_t *);
1665
1666 #ENDIF
1667
1668 Global_ERWIN_EXPORT
1669 void Map_init_iterator_sorted_by_user (Map_t const *, Global_map_iterator_sorted_t *,
1670 Map_pair_cmp_t);
1671
1672
1673 #IF(oType != void)
1674 Global_ERWIN_EXPORT
1675 void Map_init_iterator_ptr_sorted_by_key (Map_t const *, Global_map_iterator_sorted_t *);
1676
1677
1678 Global_ERWIN_EXPORT
1679 void Map_init_iterator_ptr_sorted_by_value (Map_t const *, Global_map_iterator_sorted_t *);
1680
1681
1682 Global_ERWIN_EXPORT
1683 void Map_init_iterator_ptr_sorted_by_key_and_value (Map_t const *, Global_map_iterator_sorted_t *);
1684
1685
1686 Global_ERWIN_EXPORT
1687 void Map_init_iterator_ptr_sorted_by_value_and_key (Map_t const *, Global_map_iterator_sorted_t *);
1688
1689
1690 Global_ERWIN_EXPORT
1691 void Map_init_iterator_ptr_sorted_by_user (Map_t const *, Global_map_iterator_sorted_t *,
1692 Map_pair_ptr_cmp_t);
1693
1694 #ENDIF(oType != void)
1695
1696 Global_ERWIN_EXPORT
1697 void Map_init_iterator_sorted_by_key_reverse (Map_t const *, Global_map_iterator_sorted_t *);
1698
1699
1700 #IF(oType != void)
1701 Global_ERWIN_EXPORT
1702 void Map_init_iterator_sorted_by_value_reverse (Map_t const *, Global_map_iterator_sorted_t *);
1703
1704
1705 Global_ERWIN_EXPORT
1706 void Map_init_iterator_sorted_by_key_and_value_reverse (
1707 Map_t const *, Global_map_iterator_sorted_t *);
1708
1709
1710 Global_ERWIN_EXPORT
1711 void Map_init_iterator_sorted_by_value_and_key_reverse (
1712 Map_t const *, Global_map_iterator_sorted_t *);
1713
1714 #ENDIF
1715
1716 Global_ERWIN_EXPORT
1717 void Map_init_iterator_sorted_by_user_reverse (
1718 Map_t const *, Global_map_iterator_sorted_t *, Map_pair_cmp_t);
1719
1720
1721 #IF(oType != void)
1722 Global_ERWIN_EXPORT
1723 void Map_init_iterator_ptr_sorted_by_key_reverse (Map_t const *, Global_map_iterator_sorted_t *);
1724
1725
1726 Global_ERWIN_EXPORT
1727 void Map_init_iterator_ptr_sorted_by_value_reverse (Map_t const *, Global_map_iterator_sorted_t *);
1728
1729
1730 Global_ERWIN_EXPORT
1731 void Map_init_iterator_ptr_sorted_by_key_and_value_reverse (
1732 Map_t const *, Global_map_iterator_sorted_t *);
1733
1734
1735 Global_ERWIN_EXPORT
1736 void Map_init_iterator_ptr_sorted_by_value_and_key_reverse (
1737 Map_t const *, Global_map_iterator_sorted_t *);
1738
1739
1740 Global_ERWIN_EXPORT
1741 void Map_init_iterator_ptr_sorted_by_user_reverse (
1742 Map_t const *, Global_map_iterator_sorted_t *, Map_pair_ptr_cmp_t);
1743
1744
1745 Global_ERWIN_EXPORT
1746 Global_ERWIN_BOOL Map_next_iteration_sorted (Map_t const *, Global_map_iterator_sorted_t *,
1747 iType *, oType *);
1748
1749
1750 Global_ERWIN_EXPORT
1751 Global_ERWIN_BOOL Map_next_iteration_sorted_ptr (Map_t const *, Global_map_iterator_sorted_t *,
1752 iType *, Map_element_ptr_t *);
1753
1754 #ENDIF
1755
1756 Global_ERWIN_EXPORT
1757 Global_ERWIN_BOOL Map_next_iteration_sorted_keys (Map_t const *,
1758 Global_map_iterator_sorted_t *, iType *);
1759
1760
1761 #IF(oType != void)
1762 Global_ERWIN_EXPORT
1763 Global_ERWIN_BOOL Map_next_iteration_sorted_values (Map_t const *,
1764 Global_map_iterator_sorted_t *, oType *);
1765
1766
1767 Global_ERWIN_EXPORT
1768 Global_ERWIN_BOOL Map_next_iteration_sorted_values_ptr (Map_t const *,
1769 Global_map_iterator_sorted_t *, Map_element_ptr_t *);
1770
1771 #ENDIF
1772
1773 Global_ERWIN_EXPORT
1774 Global_ERWIN_BOOL Map_next_iteration_sorted_pairs (Map_t const *,
1775 Global_map_iterator_sorted_t *, Map_pair_t *);
1776
1777
1778 #IF(oType != void)
1779 Global_ERWIN_EXPORT
1780 Global_ERWIN_BOOL Map_next_iteration_sorted_pairs_ptr (Map_t const *,
1781 Global_map_iterator_sorted_t *, Map_pair_ptr_t *);
1782
1783 #ENDIF
1784
1785 #IF(oType != void)
1786 Global_ERWIN_EXPORT
1787 Global_ERWIN_BOOL Map_next_iteration_sorted_reverse (
1788 Map_t const *, Global_map_iterator_sorted_t *, iType *, oType *);
1789
1790
1791 Global_ERWIN_EXPORT
1792 Global_ERWIN_BOOL Map_next_iteration_sorted_ptr_reverse (
1793 Map_t const *, Global_map_iterator_sorted_t *, iType *, Map_element_ptr_t *);
1794
1795 #ENDIF
1796
1797 Global_ERWIN_EXPORT
1798 Global_ERWIN_BOOL Map_next_iteration_sorted_keys_reverse (Map_t const *,
1799 Global_map_iterator_sorted_t *, iType *);
1800
1801
1802 #IF(oType != void)
1803 Global_ERWIN_EXPORT
1804 Global_ERWIN_BOOL Map_next_iteration_sorted_values_reverse (Map_t const *,
1805 Global_map_iterator_sorted_t *, oType *);
1806
1807
1808 Global_ERWIN_EXPORT
1809 Global_ERWIN_BOOL Map_next_iteration_sorted_values_ptr_reverse (Map_t const *,
1810 Global_map_iterator_sorted_t *, Map_element_ptr_t *);
1811
1812 #ENDIF
1813
1814 Global_ERWIN_EXPORT
1815 Global_ERWIN_BOOL Map_next_iteration_sorted_pairs_reverse (Map_t const *,
1816 Global_map_iterator_sorted_t *, Map_pair_t *);
1817
1818
1819 #IF(oType != void)
1820 Global_ERWIN_EXPORT
1821 Global_ERWIN_BOOL Map_next_iteration_sorted_pairs_ptr_reverse (Map_t const *,
1822 Global_map_iterator_sorted_t *, Map_pair_ptr_t *);
1823
1824 #ENDIF
1825
1826 #endif
1827
1828 #IF(oType != void)
1829 Global_ERWIN_EXPORT
1830 Global_ERWIN_BOOL Map_next_iteration (Map_t const* ,
1831 Global_map_iterator_t *, iType * , oType * );
1832
1833
1834 Global_ERWIN_EXPORT
1835 Global_ERWIN_BOOL Map_next_iteration_ptr (Map_t const* ,
1836 Global_map_iterator_t *, iType * , Map_element_ptr_t * );
1837
1838
1839 Global_ERWIN_EXPORT
1840 Global_ERWIN_BOOL Map_next_iteration_values (Map_t const * ,
1841 Global_map_iterator_t *, oType * );
1842
1843
1844 Global_ERWIN_EXPORT
1845 Global_ERWIN_BOOL Map_next_iteration_values_ptr (Map_t const * ,
1846 Global_map_iterator_t *, Map_element_ptr_t * );
1847
1848 #ENDIF
1849
1850 Global_ERWIN_EXPORT
1851 Global_ERWIN_BOOL Map_next_iteration_keys (Map_t const* ,
1852 Global_map_iterator_t *, iType * );
1853
1854
1855 Global_ERWIN_EXPORT
1856 Global_ERWIN_BOOL Map_next_iteration_pairs (Map_t const* ,
1857 Global_map_iterator_t *, Map_pair_t * );
1858
1859
1860 #IF(oType != void)
1861 Global_ERWIN_EXPORT
1862 Global_ERWIN_BOOL Map_next_iteration_pairs_ptr (Map_t const* ,
1863 Global_map_iterator_t *, Map_pair_ptr_t * );
1864
1865 #ENDIF
1866
1867 #ifdef Global_ERWIN_PROFILE
1868
1869 Global_ERWIN_EXPORT
1870 int Map_nrehash_ops (Map_t const* ) ATTR_PURE;
1871
1872 Global_ERWIN_EXPORT
1873 int Map_nrehash (Map_t const* ) ATTR_PURE;
1874
1875
1876
1877 Global_ERWIN_EXPORT
1878 int Map_ninsert (Map_t const* ) ATTR_PURE;
1879
1880 Global_ERWIN_EXPORT
1881 int Map_nremove (Map_t const* ) ATTR_PURE;
1882
1883 Global_ERWIN_EXPORT
1884 int Map_nfind (Map_t const* ) ATTR_PURE;
1885
1886 Global_ERWIN_EXPORT
1887 int Map_nops (Map_t const* ) ATTR_PURE;
1888
1889
1890
1891 #endif
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901 #include "#Map_i.ErwinHExt"
1902
1903 #IFCPPONLY
1904 #ELSE
1905 #ifdef __cplusplus
1906 }
1907 #endif
1908 #ENDIF
1909
1910 struct Map_t
1911 #ifdef Map_SUPER_CLASS
1912 : Map_SUPER_CLASS_ACCESS Map_SUPER_CLASS
1913 #endif
1914 {
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979 Map_STD_MEMBERS(Map_t)
1980
1981 #ifdef __cplusplus
1982 public:
1983 #endif
1984
1985 Map_record
1986
1987 #ifdef __cplusplus
1988
1989
1990 Map_t *it() { return this; }
1991
1992
1993 Map_t const *it() const { return this; }
1994
1995 protected:
1996 #ifndef NDEBUG
1997 void cn() const;
1998 void cn(void const *) const;
1999 #else
2000
2001 static void cn() {}
2002 static void cn(void const *) {}
2003 #endif
2004 static void nocn() {}
2005 static void nocn(void const *) {}
2006
2007
2008 public:
2009 #ifdef __cplusplus
2010 #if !Global_ERWIN_DEFAULT_NEW_DELETE
2011 static void *operator new(size_t);
2012 static void operator delete(void *, size_t);
2013 static void *operator new[](size_t);
2014 static void operator delete[](void *, size_t);
2015 #endif
2016 #endif
2017
2018
2019
2020 Map_t (void);
2021
2022 static Map_t const &static_zero();
2023
2024 #if Map_HAVE_INT_CONSTRUCTOR
2025 Global_ERWIN_EXPLICIT Map_t (int initial_size);
2026 #endif
2027 #if Map_DYN_ZERO
2028 Global_ERWIN_EXPLICIT Map_t (oTypeTouched zero_element);
2029 Map_t (oTypeTouched zero_element, int initial_size);
2030 #endif
2031
2032
2033 #if !Global_ERWIN_GLOBAL_ERRNO
2034 int get_errno(void) const { cn(); return it()->m_errno; }
2035 void clear_errno(void) const { cn(); Map_clear_errno (it()); }
2036 #else
2037 static int get_errno(void) { return Global_map_errno; }
2038 static void clear_errno(void) { Global_map_errno= Global_MAP_OK; }
2039 #endif
2040
2041
2042
2043 Global_ERWIN_EXPLICIT Map_t (Map_t const *a);
2044
2045 Map_t (Map_t const &a);
2046
2047 Map_t *copy (void) const
2048 {
2049 cn();
2050 return new Map_t (it());
2051 }
2052
2053 Map_t *copy_err (int *err) const
2054 {
2055 cn();
2056 Map_t *result= new Map_t (it());
2057 if (err != NULL && Global_MAP_IS_ERROR (get_errno ()))
2058 *err= 1;
2059 return result;
2060 }
2061
2062 Map_t &xchg(Map_t *other)
2063 {
2064 Map_xchg (it(), other);
2065 return *this;
2066 }
2067
2068 Map_t &xchg(Map_t &other)
2069 {
2070 Map_xchg (this, &other);
2071 return *this;
2072 }
2073
2074
2075
2076 Map_t &operator= (Map_t const &);
2077
2078 Map_t &operator= (Map_t const *);
2079
2080
2081 void _constructor (void);
2082
2083
2084
2085
2086
2087
2088 void _destructor (void);
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098 ~Map_t ();
2099
2100
2101
2102
2103
2104
2105
2106
2107 operator Map_t *(void) { cn(); return it(); }
2108 operator Map_t const *(void) const { cn(); return it(); }
2109
2110
2111
2112 #IF(oTypeIndex == oTypeResult)
2113
2114
2115 oTypeResult operator[] (iTypeParam i) const
2116 {
2117 nocn();
2118 return Map_find (it(), i);
2119 }
2120
2121
2122
2123
2124 #IF(oType != void)
2125 #IF(oType == oTypeVar)
2126 oType &operator[] (iTypeTouched i) {
2127 cn();
2128 return *Map_find_ptr_ensure (it(), i);
2129 }
2130 #ENDIF
2131 #ENDIF
2132
2133 #ELSE
2134
2135
2136
2137
2138
2139
2140
2141 oTypeIndex &operator[] (iTypeTouched i) {
2142 cn();
2143 return *Map_find_ensure (it(), i);
2144 }
2145
2146 #ENDIF
2147
2148 #IF(oType != void)
2149 #IF(oType == oTypeVar)
2150 oType *find_ptr (iTypeParam i) const
2151 { nocn(); return Map_find_ptr (it(), i); }
2152
2153 oType *find_ptr_ensure (iTypeTouched i)
2154 { cn(); return Map_find_ptr_ensure (it(), i); }
2155 #ELSE
2156 oType const *find_ptr (iTypeParam i) const
2157 { nocn(); return Map_find_ptr (it(), i); }
2158
2159 oType const *find_ptr_ensure (iTypeTouched i)
2160 { cn(); return Map_find_ptr_ensure (it(), i); }
2161 #ENDIF
2162 #ENDIF
2163
2164
2165 oTypeResult find (iTypeParam i) const
2166 { nocn(); return Map_find (it(), i); }
2167
2168 #IF(oType != void)
2169 oTypeResult find_ensure (iTypeTouched i)
2170 { cn(); return Map_find_ensure (it(), i); }
2171 #ENDIF
2172
2173 iTypeResult find_any_key() const
2174 { nocn(); return Map_find_any_key (it()); }
2175
2176 #IF(oType != void)
2177 oTypeResult find_any() const
2178 { nocn(); return Map_find_any (it()); }
2179
2180 Map_element_ptr_t find_any_ptr() const
2181 { nocn(); return Map_find_any_ptr (it()); }
2182
2183 int find_any_pair(Map_key_result_t &kp, Map_element_ptr_t &vp) const
2184 { nocn(); return Map_find_any_pair (&kp, &vp, it()); }
2185 #ENDIF
2186
2187
2188
2189 #IF(oType == void)
2190 Map_t &insert (iTypeTouched k)
2191 { cn(); Map_insert (it(), k); return *this; }
2192 #ELSE
2193 Map_t &insert (iTypeTouched k, oTypeTouched v)
2194 { cn(); Map_insert (it(), k, v); return *this; }
2195 #ENDIF
2196
2197 Map_t &insert_map (Map_t const &other)
2198 { cn(&other); Map_insert_map (it(), other.it()); return *this; }
2199
2200 Map_t &insert_map (Map_t const *other)
2201 { cn(other); Map_insert_map (it(), other->it()); return *this; }
2202
2203 #if Map_DIRECT_RECURSION == 0
2204 Map_t &insert (Map_t const &other)
2205 { cn(&other); Map_insert_map (it(), other.it()); return *this; }
2206
2207 Map_t &insert (Map_t const *other)
2208 { cn(other); Map_insert_map (it(), other->it()); return *this; }
2209
2210 #endif
2211
2212 #IF(oType != void)
2213
2214 oTypeVar modify (iTypeParam i, oTypeTouched v)
2215 { cn(); return Map_modify (it(), i, v); }
2216
2217 Map_t &modify_map (Map_t const &other)
2218 { cn(&other); Map_modify_map (it(), other.it()); return *this; }
2219
2220 Map_t &modify_map (Map_t const *other)
2221 { cn(other); Map_modify_map (it(), other->it()); return *this; }
2222
2223 #if Map_DIRECT_RECURSION == 0
2224 Map_t &modify (Map_t const &other)
2225 { cn(&other); Map_modify_map (it(), other.it()); return *this; }
2226
2227 Map_t &modify (Map_t const *other)
2228 { cn(other); Map_modify_map (it(), other->it()); return *this; }
2229
2230 #endif
2231
2232
2233
2234 Map_t &set (iTypeTouched i, oTypeTouched v)
2235 { cn(); Map_set (it(), i, v); return *this; }
2236
2237 Map_t &set_map (Map_t const &other)
2238 { cn(&other); Map_set_map (it(), other.it()); return *this; }
2239
2240 Map_t &set_map (Map_t const *other)
2241 { cn(other); Map_set_map (it(), other->it()); return *this; }
2242
2243
2244 #if Map_DIRECT_RECURSION == 0
2245 Map_t &set (Map_t const &other)
2246 { cn(&other); Map_set_map (it(), other.it()); return *this; }
2247
2248 Map_t &set (Map_t const *other)
2249 { cn(other); Map_set_map (it(), other->it()); return *this; }
2250
2251 #endif
2252
2253
2254 oTypeVar remove (iTypeTouched i)
2255 { nocn(); return Map_remove (it(), i); }
2256
2257 Map_t &remove_map (Map_t const &other)
2258 { nocn(&other); Map_remove_map (it(), other.it()); return *this; }
2259
2260 Map_t &remove_map (Map_t const *other)
2261 { nocn(other); Map_remove_map (it(), other->it()); return *this; }
2262
2263 int remove_if (Map_feature_t f, bool value = true)
2264 {
2265 nocn();
2266 return Map_remove_if (it(), f, value);
2267 }
2268 #ENDIF
2269 #REM oType=void
2270
2271
2272 Map_t &erase (iTypeTouched i)
2273 { nocn(); Map_erase (it(), i); return *this; }
2274
2275 Map_t &erase_map (Map_t const &other)
2276 { nocn(&other); Map_erase_map (it(), other.it()); return *this; }
2277
2278 Map_t &erase_map (Map_t const *other)
2279 { nocn(other); Map_erase_map (it(), other->it()); return *this; }
2280
2281 #if Map_DIRECT_RECURSION == 0
2282 Map_t &erase (Map_t const &other)
2283 { nocn(other); Map_erase_map (it(), other.it()); return *this; }
2284
2285 Map_t &erase (Map_t const *other)
2286 { nocn(other); Map_erase_map (it(), other->it()); return *this; }
2287
2288 #endif
2289
2290 int erase_if (Map_feature_t f, bool value = true)
2291 {
2292 nocn();
2293 return Map_erase_if (it(), f, value);
2294 }
2295
2296 Map_t &intersect (Map_t const &other)
2297 { nocn(&other); Map_intersect (it(), other.it()); return *this; }
2298
2299 Map_t &intersect (Map_t const *other)
2300 { nocn(other); Map_intersect (it(), other->it()); return *this; }
2301
2302 Map_t &intersect_no_resize (Map_t const &other)
2303 { nocn(&other); Map_intersect_no_resize (it(), other.it()); return *this; }
2304
2305 Map_t &intersect_no_resize (Map_t const *other)
2306 { nocn(other); Map_intersect_no_resize (it(), other->it()); return *this; }
2307
2308
2309
2310 iTypeResult find_key (iTypeParam i) const { nocn(); return Map_find_key (it(), i); }
2311
2312 oTypeResult zero(void) const { nocn(); return Map_zero (it()); }
2313
2314 iTypeResult ensure (iTypeTouched k)
2315 { cn(); return Map_ensure (it(), k); }
2316
2317 iTypeResult ensure_no_icopy (iTypeVarParam k)
2318 { cn(); return Map_ensure_no_icopy (it(), k); }
2319
2320 iTypeResult operator() (iTypeTouched k)
2321 { cn(); return Map_ensure (it(), k); }
2322
2323 #IF(oType == void)
2324 Map_t &poke (
2325 iType *kp,
2326 iTypeTouched k,
2327 bool aintroduce Map_DEFAULT_ARG(true))
2328 {
2329 cn();
2330 Map_poke (kp, it(), k, aintroduce);
2331 return *this;
2332 }
2333 #ELSE
2334 Map_t &poke (
2335 iType *kp, oTypeVar *vo,
2336 iTypeTouched k, oTypeTouched v,
2337 bool aintroduce Map_DEFAULT_ARG(true),
2338 bool aoverwrite Map_DEFAULT_ARG(true))
2339 {
2340 cn();
2341 Map_poke (kp,vo, it(), k,v, aintroduce, aoverwrite);
2342 return *this;
2343 }
2344 #ENDIF
2345
2346 #IF(oType == void)
2347 Map_t &poke_no_icopy (
2348 iType *kp,
2349 iTypeVarParam k,
2350 bool aintroduce Map_DEFAULT_ARG(true))
2351 {
2352 cn();
2353 Map_poke_no_icopy (kp, it(), k, aintroduce);
2354 return *this;
2355 }
2356 #ELSE
2357 Map_t &poke_no_icopy (
2358 iType *kp, oTypeVar *vo,
2359 iTypeVarParam k, oTypeTouched v,
2360 bool aintroduce Map_DEFAULT_ARG(true),
2361 bool aoverwrite Map_DEFAULT_ARG(true))
2362 {
2363 cn();
2364 Map_poke_no_icopy (kp,vo, it(), k,v, aintroduce, aoverwrite);
2365 return *this;
2366 }
2367 #ENDIF
2368
2369 #IF(oType != void)
2370 Map_t &poke_no_ocopy (
2371 iType *kp, oTypeVar *vo,
2372 iTypeTouched k, oTypeVarParam v,
2373 bool aintroduce Map_DEFAULT_ARG(true),
2374 bool aoverwrite Map_DEFAULT_ARG(true))
2375 {
2376 cn();
2377 Map_poke_no_ocopy (kp,vo, it(), k,v, aintroduce, aoverwrite);
2378 return *this;
2379 }
2380
2381 Map_t &poke_no_icopy_no_ocopy (
2382 iType *kp, oTypeVar *vo,
2383 iTypeVarParam k, oTypeVarParam v,
2384 bool aintroduce Map_DEFAULT_ARG(true),
2385 bool aoverwrite Map_DEFAULT_ARG(true))
2386 {
2387 cn();
2388 Map_poke_no_icopy_no_ocopy (kp,vo, it(), k,v, aintroduce, aoverwrite);
2389 return *this;
2390 }
2391 #ENDIF
2392
2393
2394 Map_t &clear (void)
2395 {
2396 nocn();
2397 Map_clear (it());
2398 return *this;
2399 }
2400
2401 Map_t &clear_no_resize (void)
2402 {
2403 nocn();
2404 Map_clear_no_resize (it());
2405 return *this;
2406 }
2407
2408 Map_t &clear (bool k, bool v)
2409 {
2410 nocn();
2411 Map_clear_flags (it(), k, v);
2412 return *this;
2413 }
2414
2415 int nentries (void) const { nocn(); return Map_nentries (it()); }
2416 bool empty (void) const { nocn(); return Global_ERWIN_TO_BOOL(Map_empty (it())); }
2417 bool non_empty (void) const { nocn(); return !Map_empty (it()); }
2418
2419 iType *get_keys (void) const { nocn(); return Map_get_keys (it()); }
2420 static void delete_keys (iType *k) { Map_delete_keys (k); }
2421
2422 #IF(oType != void)
2423 Map_pair_t *get_entries (void) const { nocn(); return Map_get_entries (it()); }
2424 Map_pair_ptr_t *get_entries_ptr (void) const { nocn(); return Map_get_entries_ptr (it()); }
2425 oType *get_values (void) const { nocn(); return Map_get_values (it()); }
2426
2427 static void delete_entries_ptr (Map_pair_ptr_t *k) { Map_delete_entries_ptr (k); }
2428 static void delete_entries (Map_pair_t *k) { Map_delete_entries (k); }
2429 static void delete_values (oType *k) { Map_delete_values (k); }
2430 #ENDIF
2431
2432 int hash_size (void) const { nocn(); return Map_hash_size (it()); }
2433 Map_t &rehash (int n) { nocn(); Map_rehash (it(), n); return *this;}
2434 double average_line_length (void) const { nocn(); return Map_average_line_length (it()); }
2435 double variance_line_length (void) const { nocn(); return Map_variance_line_length (it()); }
2436 #ifdef HAVE_SQRT
2437 double deviation_line_length (void) const { nocn(); return Map_deviation_line_length (it()); }
2438 #endif
2439 int max_line_length (void) const { nocn(); return Map_max_line_length (it()); }
2440 int min_line_length (void) const { nocn(); return Map_min_line_length (it()); }
2441
2442 void dump (FILE *f) const { nocn(); Map_dump (f, it()); }
2443
2444 #ifdef Global_ERWIN_PROFILE
2445 int nrehash_ops (void) const { nocn(); return Map_nrehash_ops (it()); }
2446 int nrehash (void) const { nocn(); return Map_nrehash (it()); }
2447 int ninsert (void) const { nocn(); return Map_ninsert (it()); }
2448 int nremove (void) const { nocn(); return Map_nremove (it()); }
2449 int nfind (void) const { nocn(); return Map_nfind (it()); }
2450 int nops(void) const { nocn(); return Map_nops (it()); }
2451 #endif
2452
2453 Global_hashval_t hash_raw(void) const { nocn(); return Map_hash_raw (it()); }
2454 Global_hashval_t hash(void) const { nocn(); return Map_hash (it()); }
2455
2456 bool equal(Map_t const *other) const
2457 {
2458 if (this == NULL || other == NULL)
2459 return this == other;
2460 return Global_ERWIN_TO_BOOL(Map_equal (it(), other->it()));
2461 }
2462
2463 bool equal(Map_t const &other) const
2464 {
2465 return equal (&other);
2466 }
2467
2468 int cmp (Map_t const *other) const
2469 {
2470 if (this == NULL)
2471 return other == NULL ? 0 : -1;
2472 if (other == NULL)
2473 return +1;
2474 return Map_cmp (it(), other->it());
2475 }
2476
2477 int cmp (Map_t const &other) const { nocn(); return cmp (&other); }
2478
2479 bool operator== (Map_t const &b) const { nocn(); return equal(b); }
2480 bool operator== (Map_t const *b) const { nocn(); return equal(b); }
2481
2482 bool operator!= (Map_t const &b) const { nocn(); return !equal(b); }
2483 bool operator!= (Map_t const *b) const { nocn(); return !equal(b); }
2484
2485 bool operator<= (Map_t const &b) const { nocn(); return cmp(b) <= 0; }
2486 bool operator<= (Map_t const *b) const { nocn(); return cmp(b) <= 0; }
2487
2488 bool operator>= (Map_t const &b) const { nocn(); return cmp(b) >= 0; }
2489 bool operator>= (Map_t const *b) const { nocn(); return cmp(b) >= 0; }
2490
2491 bool operator< (Map_t const &b) const { nocn(); return cmp(b) < 0; }
2492 bool operator< (Map_t const *b) const { nocn(); return cmp(b) < 0; }
2493
2494 bool operator> (Map_t const &b) const { nocn(); return cmp(b) > 0; }
2495 bool operator> (Map_t const *b) const { nocn(); return cmp(b) > 0; }
2496
2497
2498 #IF(oType != void)
2499 typedef oType ValueType;
2500 #ENDIF
2501
2502 typedef iType KeyType;
2503
2504 #INCLUDE <generated/map_forall_cpp_members.hd>
2505
2506
2507 #endif
2508 };
2509
2510 #ifdef __cplusplus
2511
2512 #IF(1)
2513
2514
2515
2516
2517 extern "C++" {
2518 ERWIN_WRAPPER
2519 Map_t *Global_erwin_ptr_of(Map_t *x) { return x; }
2520
2521 ERWIN_WRAPPER
2522 Map_t *Global_erwin_ptr_of(Map_t &x) { return &x; }
2523
2524 ERWIN_WRAPPER
2525 Map_t const *Global_erwin_ptr_const_of (Map_t const *x) { return x; }
2526
2527 ERWIN_WRAPPER
2528 Map_t const *Global_erwin_ptr_const_of (Map_t const &x) { return &x; }
2529 }
2530
2531 #ELSE
2532
2533 #ifndef Global_erwin_ptr_of
2534 #define Global_erwin_ptr_of(x) x
2535 #endif
2536
2537 #ifndef Global_erwin_ptr_const_of
2538 #define Global_erwin_ptr_const_of(x) x
2539 #endif
2540
2541 #ENDIF
2542
2543
2544
2545
2546
2547 #if defined (Global_ERWIN_REQUIRE_DETERMINISM) && !defined (Global_ERWIN_WEAK_DETERMINISM)
2548
2549
2550
2551
2552 # ifndef Global_map_forall
2553 # define Global_map_forall(h,k,v) Global_map_forall_copy(h,k,v)
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652 # endif
2653
2654 # ifndef Global_map_forall_ptr
2655 # define Global_map_forall_ptr(h,k,v) Global_map_forall_ptr_copy(h,k,v)
2656 # endif
2657
2658 # ifndef Global_map_forall_keys
2659 # define Global_map_forall_keys(h,k) Global_map_forall_keys_copy(h,k)
2660 # endif
2661
2662 # ifndef Global_map_forall_values
2663 # define Global_map_forall_values(h,v) Global_map_forall_values_copy(h,v)
2664 # endif
2665
2666 # ifndef Global_map_forall_values_ptr
2667 # define Global_map_forall_values_ptr(h,v) Global_map_forall_values_ptr_copy(h,v)
2668 # endif
2669
2670 # ifndef Global_map_forall_pairs
2671 # define Global_map_forall_pairs(h,p) Global_map_forall_pairs_copy(h,p)
2672 # endif
2673
2674 # ifndef Global_map_forall_pairs_ptr
2675 # define Global_map_forall_pairs_ptr(h,p) Global_map_forall_pairs_ptr_copy(h,p)
2676 # endif
2677
2678 #else
2679
2680 # ifndef Global_map_forall
2681 # define Global_map_forall(h,k,v) Global_map_forall_nondet(h,k,v)
2682 # endif
2683
2684 # ifndef Global_map_forall_ptr
2685 # define Global_map_forall_ptr(h,k,v) Global_map_forall_ptr_nondet(h,k,v)
2686 # endif
2687
2688 # ifndef Global_map_forall_keys
2689 # define Global_map_forall_keys(h,k) Global_map_forall_keys_nondet(h,k)
2690 # endif
2691
2692 # ifndef Global_map_forall_values
2693 # define Global_map_forall_values(h,v) Global_map_forall_values_nondet(h,v)
2694 # endif
2695
2696 # ifndef Global_map_forall_values_ptr
2697 # define Global_map_forall_values_ptr(h,v) Global_map_forall_values_ptr_nondet(h,v)
2698 # endif
2699
2700 # ifndef Global_map_forall_pairs
2701 # define Global_map_forall_pairs(h,p) Global_map_forall_pairs_nondet(h,p)
2702 # endif
2703
2704 # ifndef Global_map_forall_pairs_ptr
2705 # define Global_map_forall_pairs_ptr(h,p) Global_map_forall_pairs_ptr_nondet(h,p)
2706 # endif
2707
2708 #endif
2709
2710
2711
2712
2713 #ifndef Global_map_forall_copy
2714 # define Global_map_forall_copy(h,k,v) Global_map_forall_sorted_by_user(h,NULL,k,v)
2715 #endif
2716
2717 #ifndef Global_map_forall_ptr_copy
2718 # define Global_map_forall_ptr_copy(h,k,v) Global_map_forall_ptr_sorted_by_user(h,NULL,k,v)
2719 #endif
2720
2721 #ifndef Global_map_forall_keys_copy
2722 # define Global_map_forall_keys_copy(h,k) Global_map_forall_keys_sorted_by_user(h,NULL,k)
2723 #endif
2724
2725 #ifndef Global_map_forall_values_copy
2726 # define Global_map_forall_values_copy(h,v) Global_map_forall_values_sorted_by_user(h,NULL,v)
2727 #endif
2728
2729 #ifndef Global_map_forall_values_ptr_copy
2730 # define Global_map_forall_values_ptr_copy(h,v) Global_map_forall_values_ptr_sorted_by_user(h,NULL,v)
2731 #endif
2732
2733 #ifndef Global_map_forall_pairs_copy
2734 # define Global_map_forall_pairs_copy(h,p) Global_map_forall_pairs_sorted_by_user(h,NULL,p)
2735 #endif
2736
2737 #ifndef Global_map_forall_pairs_ptr_copy
2738 # define Global_map_forall_pairs_ptr_copy(h,p) Global_map_forall_pairs_ptr_sorted_by_user(h,NULL,p)
2739 #endif
2740
2741 #INCLUDE <generated/map_forall_macros.hd>
2742
2743 #endif
2744
2745 #endif
2746