File: example.cc

package info (click to toggle)
otf2 3.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,000 kB
  • sloc: ansic: 92,997; python: 16,977; cpp: 9,057; sh: 6,299; makefile: 238; awk: 54
file content (2410 lines) | stat: -rw-r--r-- 91,373 bytes parent folder | download | duplicates (3)
1
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
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
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
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
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
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
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
#include <string.h>

#include <string>
#include <vector>
#include <map>

#include <otf2/otf2.h>


class Otf2Definitions
{
public:
    Otf2Definitions( OTF2_Reader* reader );
    ~Otf2Definitions();

    typedef std::map< OTF2_StringRef, std::string > StringT;
    typedef StringT::iterator                       StringIT;
    typedef StringT::const_iterator                 StringCIT;
    typedef StringT::value_type                     StringV;
    StringT m_Strings;


    struct ClockProperties
    {
        uint64_t timerResolution;
        uint64_t globalOffset;
        uint64_t traceLength;
        uint64_t realtimeTimestamp;
    };
    typedef std::vector< ClockProperties* >  ClockPropertiesT;
    typedef ClockPropertiesT::iterator       ClockPropertiesIT;
    typedef ClockPropertiesT::const_iterator ClockPropertiesCIT;
    typedef ClockPropertiesT::value_type     ClockPropertiesV;
    ClockPropertiesT m_ClockProperties;

    struct Paradigm
    {
        OTF2_Paradigm      paradigm;
        std::string        name;
        OTF2_ParadigmClass paradigmClass;
    };
    typedef std::vector< Paradigm* >  ParadigmT;
    typedef ParadigmT::iterator       ParadigmIT;
    typedef ParadigmT::const_iterator ParadigmCIT;
    typedef ParadigmT::value_type     ParadigmV;
    ParadigmT m_Paradigms;

    struct ParadigmProperty
    {
        OTF2_Paradigm         paradigm;
        OTF2_ParadigmProperty property;
        OTF2_Type             type;
        OTF2_AttributeValue   value;
    };
    typedef std::vector< ParadigmProperty* >  ParadigmPropertyT;
    typedef ParadigmPropertyT::iterator       ParadigmPropertyIT;
    typedef ParadigmPropertyT::const_iterator ParadigmPropertyCIT;
    typedef ParadigmPropertyT::value_type     ParadigmPropertyV;
    ParadigmPropertyT m_ParadigmProperties;


    struct MetricClassRecorder
    {
        OTF2_LocationRef recorder;
    };
    typedef std::vector< MetricClassRecorder* >  MetricClassRecorderT;
    typedef MetricClassRecorderT::iterator       MetricClassRecorderIT;
    typedef MetricClassRecorderT::const_iterator MetricClassRecorderCIT;
    typedef MetricClassRecorderT::value_type     MetricClassRecorderV;

    struct SystemTreeNodeProperty
    {
        std::string         name;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< SystemTreeNodeProperty* >  SystemTreeNodePropertyT;
    typedef SystemTreeNodePropertyT::iterator       SystemTreeNodePropertyIT;
    typedef SystemTreeNodePropertyT::const_iterator SystemTreeNodePropertyCIT;
    typedef SystemTreeNodePropertyT::value_type     SystemTreeNodePropertyV;

    struct SystemTreeNodeDomain
    {
        OTF2_SystemTreeDomain systemTreeDomain;
    };
    typedef std::vector< SystemTreeNodeDomain* >  SystemTreeNodeDomainT;
    typedef SystemTreeNodeDomainT::iterator       SystemTreeNodeDomainIT;
    typedef SystemTreeNodeDomainT::const_iterator SystemTreeNodeDomainCIT;
    typedef SystemTreeNodeDomainT::value_type     SystemTreeNodeDomainV;

    struct LocationGroupProperty
    {
        std::string         name;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< LocationGroupProperty* >  LocationGroupPropertyT;
    typedef LocationGroupPropertyT::iterator       LocationGroupPropertyIT;
    typedef LocationGroupPropertyT::const_iterator LocationGroupPropertyCIT;
    typedef LocationGroupPropertyT::value_type     LocationGroupPropertyV;

    struct LocationProperty
    {
        std::string         name;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< LocationProperty* >  LocationPropertyT;
    typedef LocationPropertyT::iterator       LocationPropertyIT;
    typedef LocationPropertyT::const_iterator LocationPropertyCIT;
    typedef LocationPropertyT::value_type     LocationPropertyV;

    struct CartCoordinate
    {
        uint32_t                rank;
        std::vector< uint32_t > coordinates;
    };
    typedef std::vector< CartCoordinate* >  CartCoordinateT;
    typedef CartCoordinateT::iterator       CartCoordinateIT;
    typedef CartCoordinateT::const_iterator CartCoordinateCIT;
    typedef CartCoordinateT::value_type     CartCoordinateV;

    struct CallingContextProperty
    {
        std::string         name;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< CallingContextProperty* >  CallingContextPropertyT;
    typedef CallingContextPropertyT::iterator       CallingContextPropertyIT;
    typedef CallingContextPropertyT::const_iterator CallingContextPropertyCIT;
    typedef CallingContextPropertyT::value_type     CallingContextPropertyV;

    struct IoFileProperty
    {
        std::string         name;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< IoFileProperty* >  IoFilePropertyT;
    typedef IoFilePropertyT::iterator       IoFilePropertyIT;
    typedef IoFilePropertyT::const_iterator IoFilePropertyCIT;
    typedef IoFilePropertyT::value_type     IoFilePropertyV;

    struct IoPreCreatedHandleState
    {
        OTF2_IoAccessMode mode;
        OTF2_IoStatusFlag statusFlags;
    };
    typedef std::vector< IoPreCreatedHandleState* >  IoPreCreatedHandleStateT;
    typedef IoPreCreatedHandleStateT::iterator       IoPreCreatedHandleStateIT;
    typedef IoPreCreatedHandleStateT::const_iterator IoPreCreatedHandleStateCIT;
    typedef IoPreCreatedHandleStateT::value_type     IoPreCreatedHandleStateV;

    struct CallpathParameter
    {
        OTF2_ParameterRef   parameter;
        OTF2_Type           type;
        OTF2_AttributeValue value;
    };
    typedef std::vector< CallpathParameter* >  CallpathParameterT;
    typedef CallpathParameterT::iterator       CallpathParameterIT;
    typedef CallpathParameterT::const_iterator CallpathParameterCIT;
    typedef CallpathParameterT::value_type     CallpathParameterV;

    enum MetricType
    {
        METRIC_CLASS,
        METRIC_INSTANCE,
    };
    struct Metric
    {
        MetricType           metricType;
        MetricClassRecorderT metricClassRecorders;
    };
    typedef std::map< OTF2_MetricRef, Metric* > MetricT;
    typedef MetricT::iterator                   MetricIT;
    typedef MetricT::const_iterator             MetricCIT;
    typedef MetricT::value_type                 MetricV;
    MetricT m_Metrics;

    enum CommType
    {
        COMM,
        INTER_COMM,
    };
    struct Comm
    {
        CommType commType;
    };
    typedef std::map< OTF2_CommRef, Comm* > CommT;
    typedef CommT::iterator                 CommIT;
    typedef CommT::const_iterator           CommCIT;
    typedef CommT::value_type               CommV;
    CommT m_Comms;

    enum IoFileType
    {
        IO_REGULAR_FILE,
        IO_DIRECTORY,
    };
    struct IoFile
    {
        IoFileType      ioFileType;
        IoFilePropertyT ioFileProperties;
    };
    typedef std::map< OTF2_IoFileRef, IoFile* > IoFileT;
    typedef IoFileT::iterator                   IoFileIT;
    typedef IoFileT::const_iterator             IoFileCIT;
    typedef IoFileT::value_type                 IoFileV;
    IoFileT m_IoFiles;



    struct IoParadigm
    {
        std::string                            identification;
        std::string                            name;
        OTF2_IoParadigmClass                   ioParadigmClass;
        OTF2_IoParadigmFlag                    ioParadigmFlags;
        std::vector< OTF2_IoParadigmProperty > properties;
        std::vector< OTF2_Type >               types;
        std::vector< OTF2_AttributeValue >     values;
    };
    typedef std::map< OTF2_IoParadigmRef, IoParadigm* > IoParadigmT;
    typedef IoParadigmT::iterator                       IoParadigmIT;
    typedef IoParadigmT::const_iterator                 IoParadigmCIT;
    typedef IoParadigmT::value_type                     IoParadigmV;
    IoParadigmT m_IoParadigms;

    struct Attribute
    {
        std::string name;
        std::string description;
        OTF2_Type   type;
    };
    typedef std::map< OTF2_AttributeRef, Attribute* > AttributeT;
    typedef AttributeT::iterator                      AttributeIT;
    typedef AttributeT::const_iterator                AttributeCIT;
    typedef AttributeT::value_type                    AttributeV;
    AttributeT m_Attributes;

    struct SystemTreeNode
    {
        std::string             name;
        std::string             className;
        OTF2_SystemTreeNodeRef  parent;
        SystemTreeNodePropertyT systemTreeNodeProperties;
        SystemTreeNodeDomainT   systemTreeNodeDomains;
    };
    typedef std::map< OTF2_SystemTreeNodeRef, SystemTreeNode* > SystemTreeNodeT;
    typedef SystemTreeNodeT::iterator                           SystemTreeNodeIT;
    typedef SystemTreeNodeT::const_iterator                     SystemTreeNodeCIT;
    typedef SystemTreeNodeT::value_type                         SystemTreeNodeV;
    SystemTreeNodeT m_SystemTreeNodes;

    struct LocationGroup
    {
        std::string            name;
        OTF2_LocationGroupType locationGroupType;
        OTF2_SystemTreeNodeRef systemTreeParent;
        OTF2_LocationGroupRef  creatingLocationGroup;
        LocationGroupPropertyT locationGroupProperties;
    };
    typedef std::map< OTF2_LocationGroupRef, LocationGroup* > LocationGroupT;
    typedef LocationGroupT::iterator                          LocationGroupIT;
    typedef LocationGroupT::const_iterator                    LocationGroupCIT;
    typedef LocationGroupT::value_type                        LocationGroupV;
    LocationGroupT m_LocationGroups;

    struct Location
    {
        std::string           name;
        OTF2_LocationType     locationType;
        uint64_t              numberOfEvents;
        OTF2_LocationGroupRef locationGroup;
        LocationPropertyT     locationProperties;
    };
    typedef std::map< OTF2_LocationRef, Location* > LocationT;
    typedef LocationT::iterator                     LocationIT;
    typedef LocationT::const_iterator               LocationCIT;
    typedef LocationT::value_type                   LocationV;
    LocationT m_Locations;

    struct Region
    {
        std::string     name;
        std::string     canonicalName;
        std::string     description;
        OTF2_RegionRole regionRole;
        OTF2_Paradigm   paradigm;
        OTF2_RegionFlag regionFlags;
        std::string     sourceFile;
        uint32_t        beginLineNumber;
        uint32_t        endLineNumber;
    };
    typedef std::map< OTF2_RegionRef, Region* > RegionT;
    typedef RegionT::iterator                   RegionIT;
    typedef RegionT::const_iterator             RegionCIT;
    typedef RegionT::value_type                 RegionV;
    RegionT m_Regions;

    struct Callsite
    {
        std::string    sourceFile;
        uint32_t       lineNumber;
        OTF2_RegionRef enteredRegion;
        OTF2_RegionRef leftRegion;
    };
    typedef std::map< OTF2_CallsiteRef, Callsite* > CallsiteT;
    typedef CallsiteT::iterator                     CallsiteIT;
    typedef CallsiteT::const_iterator               CallsiteCIT;
    typedef CallsiteT::value_type                   CallsiteV;
    CallsiteT m_Callsites;

    struct Callpath
    {
        OTF2_CallpathRef   parent;
        OTF2_RegionRef     region;
        CallpathParameterT callpathParameters;
    };
    typedef std::map< OTF2_CallpathRef, Callpath* > CallpathT;
    typedef CallpathT::iterator                     CallpathIT;
    typedef CallpathT::const_iterator               CallpathCIT;
    typedef CallpathT::value_type                   CallpathV;
    CallpathT m_Callpaths;

    struct Group
    {
        std::string             name;
        OTF2_GroupType          groupType;
        OTF2_Paradigm           paradigm;
        OTF2_GroupFlag          groupFlags;
        std::vector< uint64_t > members;
    };
    typedef std::map< OTF2_GroupRef, Group* > GroupT;
    typedef GroupT::iterator                  GroupIT;
    typedef GroupT::const_iterator            GroupCIT;
    typedef GroupT::value_type                GroupV;
    GroupT m_Groups;

    struct MetricMember
    {
        std::string     name;
        std::string     description;
        OTF2_MetricType metricType;
        OTF2_MetricMode metricMode;
        OTF2_Type       valueType;
        OTF2_Base       base;
        int64_t         exponent;
        std::string     unit;
    };
    typedef std::map< OTF2_MetricMemberRef, MetricMember* > MetricMemberT;
    typedef MetricMemberT::iterator                         MetricMemberIT;
    typedef MetricMemberT::const_iterator                   MetricMemberCIT;
    typedef MetricMemberT::value_type                       MetricMemberV;
    MetricMemberT m_MetricMembers;

    struct MetricClass
        : public Metric
    {
        std::vector< OTF2_MetricMemberRef > metricMembers;
        OTF2_MetricOccurrence               metricOccurrence;
        OTF2_RecorderKind                   recorderKind;
    };

    struct MetricInstance
        : public Metric
    {
        OTF2_MetricRef   metricClass;
        OTF2_LocationRef recorder;
        OTF2_MetricScope metricScope;
        uint64_t         scope;
    };

    struct Comm
        : public Comm
    {
        std::string   name;
        OTF2_GroupRef group;
        OTF2_CommRef  parent;
        OTF2_CommFlag flags;
    };

    struct Parameter
    {
        std::string        name;
        OTF2_ParameterType parameterType;
    };
    typedef std::map< OTF2_ParameterRef, Parameter* > ParameterT;
    typedef ParameterT::iterator                      ParameterIT;
    typedef ParameterT::const_iterator                ParameterCIT;
    typedef ParameterT::value_type                    ParameterV;
    ParameterT m_Parameters;

    struct RmaWin
    {
        std::string     name;
        OTF2_CommRef    comm;
        OTF2_RmaWinFlag flags;
    };
    typedef std::map< OTF2_RmaWinRef, RmaWin* > RmaWinT;
    typedef RmaWinT::iterator                   RmaWinIT;
    typedef RmaWinT::const_iterator             RmaWinCIT;
    typedef RmaWinT::value_type                 RmaWinV;
    RmaWinT m_RmaWins;

    struct CartDimension
    {
        std::string          name;
        uint32_t             size;
        OTF2_CartPeriodicity cartPeriodicity;
    };
    typedef std::map< OTF2_CartDimensionRef, CartDimension* > CartDimensionT;
    typedef CartDimensionT::iterator                          CartDimensionIT;
    typedef CartDimensionT::const_iterator                    CartDimensionCIT;
    typedef CartDimensionT::value_type                        CartDimensionV;
    CartDimensionT m_CartDimensions;

    struct CartTopology
    {
        std::string                          name;
        OTF2_CommRef                         communicator;
        std::vector< OTF2_CartDimensionRef > cartDimensions;
        CartCoordinateT                      cartCoordinates;
    };
    typedef std::map< OTF2_CartTopologyRef, CartTopology* > CartTopologyT;
    typedef CartTopologyT::iterator                         CartTopologyIT;
    typedef CartTopologyT::const_iterator                   CartTopologyCIT;
    typedef CartTopologyT::value_type                       CartTopologyV;
    CartTopologyT m_CartTopologies;

    struct SourceCodeLocation
    {
        std::string file;
        uint32_t    lineNumber;
    };
    typedef std::map< OTF2_SourceCodeLocationRef, SourceCodeLocation* > SourceCodeLocationT;
    typedef SourceCodeLocationT::iterator                               SourceCodeLocationIT;
    typedef SourceCodeLocationT::const_iterator                         SourceCodeLocationCIT;
    typedef SourceCodeLocationT::value_type                             SourceCodeLocationV;
    SourceCodeLocationT m_SourceCodeLocations;

    struct CallingContext
    {
        OTF2_RegionRef             region;
        OTF2_SourceCodeLocationRef sourceCodeLocation;
        OTF2_CallingContextRef     parent;
        CallingContextPropertyT    callingContextProperties;
    };
    typedef std::map< OTF2_CallingContextRef, CallingContext* > CallingContextT;
    typedef CallingContextT::iterator                           CallingContextIT;
    typedef CallingContextT::const_iterator                     CallingContextCIT;
    typedef CallingContextT::value_type                         CallingContextV;
    CallingContextT m_CallingContexts;

    struct InterruptGenerator
    {
        std::string                 name;
        OTF2_InterruptGeneratorMode interruptGeneratorMode;
        OTF2_Base                   base;
        int64_t                     exponent;
        uint64_t                    period;
    };
    typedef std::map< OTF2_InterruptGeneratorRef, InterruptGenerator* > InterruptGeneratorT;
    typedef InterruptGeneratorT::iterator                               InterruptGeneratorIT;
    typedef InterruptGeneratorT::const_iterator                         InterruptGeneratorCIT;
    typedef InterruptGeneratorT::value_type                             InterruptGeneratorV;
    InterruptGeneratorT m_InterruptGenerators;

    struct IoRegularFile
        : public IoFile
    {
        std::string            name;
        OTF2_SystemTreeNodeRef scope;
    };

    struct IoDirectory
        : public IoFile
    {
        std::string            name;
        OTF2_SystemTreeNodeRef scope;
    };

    struct IoHandle
    {
        std::string              name;
        OTF2_IoFileRef           file;
        OTF2_IoParadigmRef       ioParadigm;
        OTF2_IoHandleFlag        ioHandleFlags;
        OTF2_CommRef             comm;
        OTF2_IoHandleRef         parent;
        IoPreCreatedHandleStateT ioPreCreatedHandleStates;
    };
    typedef std::map< OTF2_IoHandleRef, IoHandle* > IoHandleT;
    typedef IoHandleT::iterator                     IoHandleIT;
    typedef IoHandleT::const_iterator               IoHandleCIT;
    typedef IoHandleT::value_type                   IoHandleV;
    IoHandleT m_IoHandles;

    struct InterComm
        : public Comm
    {
        std::string   name;
        OTF2_GroupRef groupA;
        OTF2_GroupRef groupB;
        OTF2_CommRef  commonCommunicator;
        OTF2_CommFlag flags;
    };

    OTF2_CallbackCode
    HandleDefClockProperties( uint64_t timerResolution,
                              uint64_t globalOffset,
                              uint64_t traceLength,
                              uint64_t realtimeTimestamp );

    OTF2_CallbackCode
    HandleDefParadigm( OTF2_Paradigm      paradigm,
                       OTF2_StringRef     name,
                       OTF2_ParadigmClass paradigmClass );

    OTF2_CallbackCode
    HandleDefParadigmProperty( OTF2_Paradigm         paradigm,
                               OTF2_ParadigmProperty property,
                               OTF2_Type             type,
                               OTF2_AttributeValue   value );

    OTF2_CallbackCode
    HandleDefIoParadigm( OTF2_IoParadigmRef             self,
                         OTF2_StringRef                 identification,
                         OTF2_StringRef                 name,
                         OTF2_IoParadigmClass           ioParadigmClass,
                         OTF2_IoParadigmFlag            ioParadigmFlags,
                         uint8_t                        numberOfProperties,
                         const OTF2_IoParadigmProperty* properties,
                         const OTF2_Type*               types,
                         const OTF2_AttributeValue*     values );

    OTF2_CallbackCode
    HandleDefString( OTF2_StringRef self,
                     const char*    string );

    OTF2_CallbackCode
    HandleDefAttribute( OTF2_AttributeRef self,
                        OTF2_StringRef    name,
                        OTF2_StringRef    description,
                        OTF2_Type         type );

    OTF2_CallbackCode
    HandleDefSystemTreeNode( OTF2_SystemTreeNodeRef self,
                             OTF2_StringRef         name,
                             OTF2_StringRef         className,
                             OTF2_SystemTreeNodeRef parent );

    OTF2_CallbackCode
    HandleDefLocationGroup( OTF2_LocationGroupRef  self,
                            OTF2_StringRef         name,
                            OTF2_LocationGroupType locationGroupType,
                            OTF2_SystemTreeNodeRef systemTreeParent,
                            OTF2_LocationGroupRef  creatingLocationGroup );

    OTF2_CallbackCode
    HandleDefLocation( OTF2_LocationRef      self,
                       OTF2_StringRef        name,
                       OTF2_LocationType     locationType,
                       uint64_t              numberOfEvents,
                       OTF2_LocationGroupRef locationGroup );

    OTF2_CallbackCode
    HandleDefRegion( OTF2_RegionRef  self,
                     OTF2_StringRef  name,
                     OTF2_StringRef  canonicalName,
                     OTF2_StringRef  description,
                     OTF2_RegionRole regionRole,
                     OTF2_Paradigm   paradigm,
                     OTF2_RegionFlag regionFlags,
                     OTF2_StringRef  sourceFile,
                     uint32_t        beginLineNumber,
                     uint32_t        endLineNumber );

    OTF2_CallbackCode
    HandleDefCallsite( OTF2_CallsiteRef self,
                       OTF2_StringRef   sourceFile,
                       uint32_t         lineNumber,
                       OTF2_RegionRef   enteredRegion,
                       OTF2_RegionRef   leftRegion );

    OTF2_CallbackCode
    HandleDefCallpath( OTF2_CallpathRef self,
                       OTF2_CallpathRef parent,
                       OTF2_RegionRef   region );

    OTF2_CallbackCode
    HandleDefGroup( OTF2_GroupRef   self,
                    OTF2_StringRef  name,
                    OTF2_GroupType  groupType,
                    OTF2_Paradigm   paradigm,
                    OTF2_GroupFlag  groupFlags,
                    uint32_t        numberOfMembers,
                    const uint64_t* members );

    OTF2_CallbackCode
    HandleDefMetricMember( OTF2_MetricMemberRef self,
                           OTF2_StringRef       name,
                           OTF2_StringRef       description,
                           OTF2_MetricType      metricType,
                           OTF2_MetricMode      metricMode,
                           OTF2_Type            valueType,
                           OTF2_Base            base,
                           int64_t              exponent,
                           OTF2_StringRef       unit );

    OTF2_CallbackCode
    HandleDefMetricClass( OTF2_MetricRef              self,
                          uint8_t                     numberOfMetrics,
                          const OTF2_MetricMemberRef* metricMembers,
                          OTF2_MetricOccurrence       metricOccurrence,
                          OTF2_RecorderKind           recorderKind );

    OTF2_CallbackCode
    HandleDefMetricInstance( OTF2_MetricRef   self,
                             OTF2_MetricRef   metricClass,
                             OTF2_LocationRef recorder,
                             OTF2_MetricScope metricScope,
                             uint64_t         scope );

    OTF2_CallbackCode
    HandleDefComm( OTF2_CommRef   self,
                   OTF2_StringRef name,
                   OTF2_GroupRef  group,
                   OTF2_CommRef   parent,
                   OTF2_CommFlag  flags );

    OTF2_CallbackCode
    HandleDefParameter( OTF2_ParameterRef  self,
                        OTF2_StringRef     name,
                        OTF2_ParameterType parameterType );

    OTF2_CallbackCode
    HandleDefRmaWin( OTF2_RmaWinRef  self,
                     OTF2_StringRef  name,
                     OTF2_CommRef    comm,
                     OTF2_RmaWinFlag flags );

    OTF2_CallbackCode
    HandleDefMetricClassRecorder( OTF2_MetricRef   metric,
                                  OTF2_LocationRef recorder );

    OTF2_CallbackCode
    HandleDefSystemTreeNodeProperty( OTF2_SystemTreeNodeRef systemTreeNode,
                                     OTF2_StringRef         name,
                                     OTF2_Type              type,
                                     OTF2_AttributeValue    value );

    OTF2_CallbackCode
    HandleDefSystemTreeNodeDomain( OTF2_SystemTreeNodeRef systemTreeNode,
                                   OTF2_SystemTreeDomain  systemTreeDomain );

    OTF2_CallbackCode
    HandleDefLocationGroupProperty( OTF2_LocationGroupRef locationGroup,
                                    OTF2_StringRef        name,
                                    OTF2_Type             type,
                                    OTF2_AttributeValue   value );

    OTF2_CallbackCode
    HandleDefLocationProperty( OTF2_LocationRef    location,
                               OTF2_StringRef      name,
                               OTF2_Type           type,
                               OTF2_AttributeValue value );

    OTF2_CallbackCode
    HandleDefCartDimension( OTF2_CartDimensionRef self,
                            OTF2_StringRef        name,
                            uint32_t              size,
                            OTF2_CartPeriodicity  cartPeriodicity );

    OTF2_CallbackCode
    HandleDefCartTopology( OTF2_CartTopologyRef         self,
                           OTF2_StringRef               name,
                           OTF2_CommRef                 communicator,
                           uint8_t                      numberOfDimensions,
                           const OTF2_CartDimensionRef* cartDimensions );

    OTF2_CallbackCode
    HandleDefCartCoordinate( OTF2_CartTopologyRef cartTopology,
                             uint32_t             rank,
                             uint8_t              numberOfDimensions,
                             const uint32_t*      coordinates );

    OTF2_CallbackCode
    HandleDefSourceCodeLocation( OTF2_SourceCodeLocationRef self,
                                 OTF2_StringRef             file,
                                 uint32_t                   lineNumber );

    OTF2_CallbackCode
    HandleDefCallingContext( OTF2_CallingContextRef     self,
                             OTF2_RegionRef             region,
                             OTF2_SourceCodeLocationRef sourceCodeLocation,
                             OTF2_CallingContextRef     parent );

    OTF2_CallbackCode
    HandleDefCallingContextProperty( OTF2_CallingContextRef callingContext,
                                     OTF2_StringRef         name,
                                     OTF2_Type              type,
                                     OTF2_AttributeValue    value );

    OTF2_CallbackCode
    HandleDefInterruptGenerator( OTF2_InterruptGeneratorRef  self,
                                 OTF2_StringRef              name,
                                 OTF2_InterruptGeneratorMode interruptGeneratorMode,
                                 OTF2_Base                   base,
                                 int64_t                     exponent,
                                 uint64_t                    period );

    OTF2_CallbackCode
    HandleDefIoFileProperty( OTF2_IoFileRef      ioFile,
                             OTF2_StringRef      name,
                             OTF2_Type           type,
                             OTF2_AttributeValue value );

    OTF2_CallbackCode
    HandleDefIoRegularFile( OTF2_IoFileRef         self,
                            OTF2_StringRef         name,
                            OTF2_SystemTreeNodeRef scope );

    OTF2_CallbackCode
    HandleDefIoDirectory( OTF2_IoFileRef         self,
                          OTF2_StringRef         name,
                          OTF2_SystemTreeNodeRef scope );

    OTF2_CallbackCode
    HandleDefIoHandle( OTF2_IoHandleRef   self,
                       OTF2_StringRef     name,
                       OTF2_IoFileRef     file,
                       OTF2_IoParadigmRef ioParadigm,
                       OTF2_IoHandleFlag  ioHandleFlags,
                       OTF2_CommRef       comm,
                       OTF2_IoHandleRef   parent );

    OTF2_CallbackCode
    HandleDefIoPreCreatedHandleState( OTF2_IoHandleRef  ioHandle,
                                      OTF2_IoAccessMode mode,
                                      OTF2_IoStatusFlag statusFlags );

    OTF2_CallbackCode
    HandleDefCallpathParameter( OTF2_CallpathRef    callpath,
                                OTF2_ParameterRef   parameter,
                                OTF2_Type           type,
                                OTF2_AttributeValue value );

    OTF2_CallbackCode
    HandleDefInterComm( OTF2_CommRef   self,
                        OTF2_StringRef name,
                        OTF2_GroupRef  groupA,
                        OTF2_GroupRef  groupB,
                        OTF2_CommRef   commonCommunicator,
                        OTF2_CommFlag  flags );

private:
    OTF2_Reader* m_Reader;
};

OTF2_CallbackCode
Otf2Definitions::HandleDefString( OTF2_StringRef stringID,
                                  const char*    string )
{
    m_Strings[ stringID ] = std::string( string );

    return OTF2_CALLBACK_SUCCESS;
}


OTF2_CallbackCode
Otf2Definitions::HandleDefClockProperties( uint64_t timerResolution,
                                           uint64_t globalOffset,
                                           uint64_t traceLength,
                                           uint64_t realtimeTimestamp )
{
    ClockProperties& new_clock_properties = *( new ClockProperties );

    new_clock_properties.timerResolution   = timerResolution;
    new_clock_properties.globalOffset      = globalOffset;
    new_clock_properties.traceLength       = traceLength;
    new_clock_properties.realtimeTimestamp = realtimeTimestamp;

    m_ClockProperties.push_back( &new_clock_properties );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefParadigm( OTF2_Paradigm      paradigm,
                                    OTF2_StringRef     name,
                                    OTF2_ParadigmClass paradigmClass )
{
    Paradigm& new_paradigm = *( new Paradigm );

    new_paradigm.paradigm      = paradigm;
    new_paradigm.name          = m_Strings[ name ];
    new_paradigm.paradigmClass = paradigmClass;

    m_Paradigms.push_back( &new_paradigm );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefParadigmProperty( OTF2_Paradigm         paradigm,
                                            OTF2_ParadigmProperty property,
                                            OTF2_Type             type,
                                            OTF2_AttributeValue   value )
{
    ParadigmProperty& new_paradigm_property = *( new ParadigmProperty );

    new_paradigm_property.paradigm = paradigm;
    new_paradigm_property.property = property;
    new_paradigm_property.type     = type;
    new_paradigm_property.value    = value;

    m_ParadigmProperties.push_back( &new_paradigm_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefMetricClassRecorder( OTF2_MetricRef   metric,
                                               OTF2_LocationRef recorder )
{
    MetricIT             parent_it                 = m_Metrics.find( metric );
    MetricClassRecorder& new_metric_class_recorder = *( new MetricClassRecorder );

    new_metric_class_recorder.recorder = recorder;

    parent_it->second->metricClassRecorders.push_back( &new_metric_class_recorder );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefSystemTreeNodeProperty( OTF2_SystemTreeNodeRef systemTreeNode,
                                                  OTF2_StringRef         name,
                                                  OTF2_Type              type,
                                                  OTF2_AttributeValue    value )
{
    SystemTreeNodeIT        parent_it                     = m_SystemTreeNodes.find( systemTreeNode );
    SystemTreeNodeProperty& new_system_tree_node_property = *( new SystemTreeNodeProperty );

    new_system_tree_node_property.name  = name;
    new_system_tree_node_property.type  = type;
    new_system_tree_node_property.value = value;

    parent_it->second->systemTreeNodeProperties.push_back( &new_system_tree_node_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefSystemTreeNodeDomain( OTF2_SystemTreeNodeRef systemTreeNode,
                                                OTF2_SystemTreeDomain  systemTreeDomain )
{
    SystemTreeNodeIT      parent_it                   = m_SystemTreeNodes.find( systemTreeNode );
    SystemTreeNodeDomain& new_system_tree_node_domain = *( new SystemTreeNodeDomain );

    new_system_tree_node_domain.systemTreeDomain = systemTreeDomain;

    parent_it->second->systemTreeNodeDomains.push_back( &new_system_tree_node_domain );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefLocationGroupProperty( OTF2_LocationGroupRef locationGroup,
                                                 OTF2_StringRef        name,
                                                 OTF2_Type             type,
                                                 OTF2_AttributeValue   value )
{
    LocationGroupIT        parent_it                   = m_LocationGroups.find( locationGroup );
    LocationGroupProperty& new_location_group_property = *( new LocationGroupProperty );

    new_location_group_property.name  = name;
    new_location_group_property.type  = type;
    new_location_group_property.value = value;

    parent_it->second->locationGroupProperties.push_back( &new_location_group_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefLocationProperty( OTF2_LocationRef    location,
                                            OTF2_StringRef      name,
                                            OTF2_Type           type,
                                            OTF2_AttributeValue value )
{
    LocationIT        parent_it             = m_Locations.find( location );
    LocationProperty& new_location_property = *( new LocationProperty );

    new_location_property.name  = name;
    new_location_property.type  = type;
    new_location_property.value = value;

    parent_it->second->locationProperties.push_back( &new_location_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCartCoordinate( OTF2_CartTopologyRef cartTopology,
                                          uint32_t             rank,
                                          uint8_t              numberOfDimensions,
                                          const uint32_t*      coordinates )
{
    CartTopologyIT  parent_it           = m_CartTopologies.find( cartTopology );
    CartCoordinate& new_cart_coordinate = *( new CartCoordinate );

    new_cart_coordinate.rank = rank;
    std::vector< uint32_t > coordinates_vector( coordinates, coordinates + numberOfDimensions );
    new_cart_coordinate.coordinates = coordinates_vector;

    parent_it->second->cartCoordinates.push_back( &new_cart_coordinate );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCallingContextProperty( OTF2_CallingContextRef callingContext,
                                                  OTF2_StringRef         name,
                                                  OTF2_Type              type,
                                                  OTF2_AttributeValue    value )
{
    CallingContextIT        parent_it                    = m_CallingContexts.find( callingContext );
    CallingContextProperty& new_calling_context_property = *( new CallingContextProperty );

    new_calling_context_property.name  = name;
    new_calling_context_property.type  = type;
    new_calling_context_property.value = value;

    parent_it->second->callingContextProperties.push_back( &new_calling_context_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefIoFileProperty( OTF2_IoFileRef      ioFile,
                                          OTF2_StringRef      name,
                                          OTF2_Type           type,
                                          OTF2_AttributeValue value )
{
    IoFileIT        parent_it            = m_IoFiles.find( ioFile );
    IoFileProperty& new_io_file_property = *( new IoFileProperty );

    new_io_file_property.name  = name;
    new_io_file_property.type  = type;
    new_io_file_property.value = value;

    parent_it->second->ioFileProperties.push_back( &new_io_file_property );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefIoPreCreatedHandleState( OTF2_IoHandleRef  ioHandle,
                                                   OTF2_IoAccessMode mode,
                                                   OTF2_IoStatusFlag statusFlags )
{
    IoHandleIT               parent_it                       = m_IoHandles.find( ioHandle );
    IoPreCreatedHandleState& new_io_pre_created_handle_state = *( new IoPreCreatedHandleState );

    new_io_pre_created_handle_state.mode        = mode;
    new_io_pre_created_handle_state.statusFlags = statusFlags;

    parent_it->second->ioPreCreatedHandleStates.push_back( &new_io_pre_created_handle_state );

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCallpathParameter( OTF2_CallpathRef    callpath,
                                             OTF2_ParameterRef   parameter,
                                             OTF2_Type           type,
                                             OTF2_AttributeValue value )
{
    CallpathIT         parent_it              = m_Callpaths.find( callpath );
    CallpathParameter& new_callpath_parameter = *( new CallpathParameter );

    new_callpath_parameter.parameter = parameter;
    new_callpath_parameter.type      = type;
    new_callpath_parameter.value     = value;

    parent_it->second->callpathParameters.push_back( &new_callpath_parameter );

    return OTF2_CALLBACK_SUCCESS;
}


OTF2_CallbackCode
Otf2Definitions::HandleDefIoParadigm( OTF2_IoParadigmRef             self,
                                      OTF2_StringRef                 identification,
                                      OTF2_StringRef                 name,
                                      OTF2_IoParadigmClass           ioParadigmClass,
                                      OTF2_IoParadigmFlag            ioParadigmFlags,
                                      uint8_t                        numberOfProperties,
                                      const OTF2_IoParadigmProperty* properties,
                                      const OTF2_Type*               types,
                                      const OTF2_AttributeValue*     values )
{
    IoParadigm& new_io_paradigm = *( new IoParadigm );

    new_io_paradigm.identification  = m_Strings[ identification ];
    new_io_paradigm.name            = m_Strings[ name ];
    new_io_paradigm.ioParadigmClass = ioParadigmClass;
    new_io_paradigm.ioParadigmFlags = ioParadigmFlags;
    std::vector< OTF2_IoParadigmProperty > properties_vector( properties, properties + numberOfProperties );
    new_io_paradigm.properties = properties_vector;
    std::vector< OTF2_Type > types_vector( types, types + numberOfProperties );
    new_io_paradigm.types = types_vector;
    std::vector< OTF2_AttributeValue > values_vector( values, values + numberOfProperties );
    new_io_paradigm.values = values_vector;

    m_IoParadigms[ self ] = &new_io_paradigm;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefAttribute( OTF2_AttributeRef self,
                                     OTF2_StringRef    name,
                                     OTF2_StringRef    description,
                                     OTF2_Type         type )
{
    Attribute& new_attribute = *( new Attribute );

    new_attribute.name        = m_Strings[ name ];
    new_attribute.description = m_Strings[ description ];
    new_attribute.type        = type;

    m_Attributes[ self ] = &new_attribute;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefSystemTreeNode( OTF2_SystemTreeNodeRef self,
                                          OTF2_StringRef         name,
                                          OTF2_StringRef         className,
                                          OTF2_SystemTreeNodeRef parent )
{
    SystemTreeNode& new_system_tree_node = *( new SystemTreeNode );

    new_system_tree_node.name      = m_Strings[ name ];
    new_system_tree_node.className = m_Strings[ className ];
    new_system_tree_node.parent    = parent;

    m_SystemTreeNodes[ self ] = &new_system_tree_node;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefLocationGroup( OTF2_LocationGroupRef  self,
                                         OTF2_StringRef         name,
                                         OTF2_LocationGroupType locationGroupType,
                                         OTF2_SystemTreeNodeRef systemTreeParent,
                                         OTF2_LocationGroupRef  creatingLocationGroup )
{
    LocationGroup& new_location_group = *( new LocationGroup );

    new_location_group.name                  = m_Strings[ name ];
    new_location_group.locationGroupType     = locationGroupType;
    new_location_group.systemTreeParent      = systemTreeParent;
    new_location_group.creatingLocationGroup = creatingLocationGroup;

    m_LocationGroups[ self ] = &new_location_group;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefLocation( OTF2_LocationRef      self,
                                    OTF2_StringRef        name,
                                    OTF2_LocationType     locationType,
                                    uint64_t              numberOfEvents,
                                    OTF2_LocationGroupRef locationGroup )
{
    Location& new_location = *( new Location );

    new_location.name           = m_Strings[ name ];
    new_location.locationType   = locationType;
    new_location.numberOfEvents = numberOfEvents;
    new_location.locationGroup  = locationGroup;

    m_Locations[ self ] = &new_location;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefRegion( OTF2_RegionRef  self,
                                  OTF2_StringRef  name,
                                  OTF2_StringRef  canonicalName,
                                  OTF2_StringRef  description,
                                  OTF2_RegionRole regionRole,
                                  OTF2_Paradigm   paradigm,
                                  OTF2_RegionFlag regionFlags,
                                  OTF2_StringRef  sourceFile,
                                  uint32_t        beginLineNumber,
                                  uint32_t        endLineNumber )
{
    Region& new_region = *( new Region );

    new_region.name            = m_Strings[ name ];
    new_region.canonicalName   = m_Strings[ canonicalName ];
    new_region.description     = m_Strings[ description ];
    new_region.regionRole      = regionRole;
    new_region.paradigm        = paradigm;
    new_region.regionFlags     = regionFlags;
    new_region.sourceFile      = m_Strings[ sourceFile ];
    new_region.beginLineNumber = beginLineNumber;
    new_region.endLineNumber   = endLineNumber;

    m_Regions[ self ] = &new_region;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCallsite( OTF2_CallsiteRef self,
                                    OTF2_StringRef   sourceFile,
                                    uint32_t         lineNumber,
                                    OTF2_RegionRef   enteredRegion,
                                    OTF2_RegionRef   leftRegion )
{
    Callsite& new_callsite = *( new Callsite );

    new_callsite.sourceFile    = m_Strings[ sourceFile ];
    new_callsite.lineNumber    = lineNumber;
    new_callsite.enteredRegion = enteredRegion;
    new_callsite.leftRegion    = leftRegion;

    m_Callsites[ self ] = &new_callsite;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCallpath( OTF2_CallpathRef self,
                                    OTF2_CallpathRef parent,
                                    OTF2_RegionRef   region )
{
    Callpath& new_callpath = *( new Callpath );

    new_callpath.parent = parent;
    new_callpath.region = region;

    m_Callpaths[ self ] = &new_callpath;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefGroup( OTF2_GroupRef   self,
                                 OTF2_StringRef  name,
                                 OTF2_GroupType  groupType,
                                 OTF2_Paradigm   paradigm,
                                 OTF2_GroupFlag  groupFlags,
                                 uint32_t        numberOfMembers,
                                 const uint64_t* members )
{
    Group& new_group = *( new Group );

    new_group.name       = m_Strings[ name ];
    new_group.groupType  = groupType;
    new_group.paradigm   = paradigm;
    new_group.groupFlags = groupFlags;
    std::vector< uint64_t > members_vector( members, members + numberOfMembers );
    new_group.members = members_vector;

    m_Groups[ self ] = &new_group;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefMetricMember( OTF2_MetricMemberRef self,
                                        OTF2_StringRef       name,
                                        OTF2_StringRef       description,
                                        OTF2_MetricType      metricType,
                                        OTF2_MetricMode      metricMode,
                                        OTF2_Type            valueType,
                                        OTF2_Base            base,
                                        int64_t              exponent,
                                        OTF2_StringRef       unit )
{
    MetricMember& new_metric_member = *( new MetricMember );

    new_metric_member.name        = m_Strings[ name ];
    new_metric_member.description = m_Strings[ description ];
    new_metric_member.metricType  = metricType;
    new_metric_member.metricMode  = metricMode;
    new_metric_member.valueType   = valueType;
    new_metric_member.base        = base;
    new_metric_member.exponent    = exponent;
    new_metric_member.unit        = m_Strings[ unit ];

    m_MetricMembers[ self ] = &new_metric_member;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefMetricClass( OTF2_MetricRef              self,
                                       uint8_t                     numberOfMetrics,
                                       const OTF2_MetricMemberRef* metricMembers,
                                       OTF2_MetricOccurrence       metricOccurrence,
                                       OTF2_RecorderKind           recorderKind )
{
    MetricClass& new_metric_class = *( new MetricClass );

    new_metric_class.metricType = METRIC_CLASS;

    std::vector< OTF2_MetricMemberRef > metricMembers_vector( metricMembers, metricMembers + numberOfMetrics );
    new_metric_class.metricMembers    = metricMembers_vector;
    new_metric_class.metricOccurrence = metricOccurrence;
    new_metric_class.recorderKind     = recorderKind;

    m_Metrics[ self ] = &new_metric_class;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefMetricInstance( OTF2_MetricRef   self,
                                          OTF2_MetricRef   metricClass,
                                          OTF2_LocationRef recorder,
                                          OTF2_MetricScope metricScope,
                                          uint64_t         scope )
{
    MetricInstance& new_metric_instance = *( new MetricInstance );

    new_metric_instance.metricType = METRIC_INSTANCE;

    new_metric_instance.metricClass = metricClass;
    new_metric_instance.recorder    = recorder;
    new_metric_instance.metricScope = metricScope;
    new_metric_instance.scope       = scope;

    m_Metrics[ self ] = &new_metric_instance;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefComm( OTF2_CommRef   self,
                                OTF2_StringRef name,
                                OTF2_GroupRef  group,
                                OTF2_CommRef   parent,
                                OTF2_CommFlag  flags )
{
    Comm& new_comm = *( new Comm );

    new_comm.commType = COMM;

    new_comm.name   = m_Strings[ name ];
    new_comm.group  = group;
    new_comm.parent = parent;
    new_comm.flags  = flags;

    m_Comms[ self ] = &new_comm;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefParameter( OTF2_ParameterRef  self,
                                     OTF2_StringRef     name,
                                     OTF2_ParameterType parameterType )
{
    Parameter& new_parameter = *( new Parameter );

    new_parameter.name          = m_Strings[ name ];
    new_parameter.parameterType = parameterType;

    m_Parameters[ self ] = &new_parameter;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefRmaWin( OTF2_RmaWinRef  self,
                                  OTF2_StringRef  name,
                                  OTF2_CommRef    comm,
                                  OTF2_RmaWinFlag flags )
{
    RmaWin& new_rma_win = *( new RmaWin );

    new_rma_win.name  = m_Strings[ name ];
    new_rma_win.comm  = comm;
    new_rma_win.flags = flags;

    m_RmaWins[ self ] = &new_rma_win;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCartDimension( OTF2_CartDimensionRef self,
                                         OTF2_StringRef        name,
                                         uint32_t              size,
                                         OTF2_CartPeriodicity  cartPeriodicity )
{
    CartDimension& new_cart_dimension = *( new CartDimension );

    new_cart_dimension.name            = m_Strings[ name ];
    new_cart_dimension.size            = size;
    new_cart_dimension.cartPeriodicity = cartPeriodicity;

    m_CartDimensions[ self ] = &new_cart_dimension;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCartTopology( OTF2_CartTopologyRef         self,
                                        OTF2_StringRef               name,
                                        OTF2_CommRef                 communicator,
                                        uint8_t                      numberOfDimensions,
                                        const OTF2_CartDimensionRef* cartDimensions )
{
    CartTopology& new_cart_topology = *( new CartTopology );

    new_cart_topology.name         = m_Strings[ name ];
    new_cart_topology.communicator = communicator;
    std::vector< OTF2_CartDimensionRef > cartDimensions_vector( cartDimensions, cartDimensions + numberOfDimensions );
    new_cart_topology.cartDimensions = cartDimensions_vector;

    m_CartTopologies[ self ] = &new_cart_topology;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefSourceCodeLocation( OTF2_SourceCodeLocationRef self,
                                              OTF2_StringRef             file,
                                              uint32_t                   lineNumber )
{
    SourceCodeLocation& new_source_code_location = *( new SourceCodeLocation );

    new_source_code_location.file       = m_Strings[ file ];
    new_source_code_location.lineNumber = lineNumber;

    m_SourceCodeLocations[ self ] = &new_source_code_location;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefCallingContext( OTF2_CallingContextRef     self,
                                          OTF2_RegionRef             region,
                                          OTF2_SourceCodeLocationRef sourceCodeLocation,
                                          OTF2_CallingContextRef     parent )
{
    CallingContext& new_calling_context = *( new CallingContext );

    new_calling_context.region             = region;
    new_calling_context.sourceCodeLocation = sourceCodeLocation;
    new_calling_context.parent             = parent;

    m_CallingContexts[ self ] = &new_calling_context;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefInterruptGenerator( OTF2_InterruptGeneratorRef  self,
                                              OTF2_StringRef              name,
                                              OTF2_InterruptGeneratorMode interruptGeneratorMode,
                                              OTF2_Base                   base,
                                              int64_t                     exponent,
                                              uint64_t                    period )
{
    InterruptGenerator& new_interrupt_generator = *( new InterruptGenerator );

    new_interrupt_generator.name                   = m_Strings[ name ];
    new_interrupt_generator.interruptGeneratorMode = interruptGeneratorMode;
    new_interrupt_generator.base                   = base;
    new_interrupt_generator.exponent               = exponent;
    new_interrupt_generator.period                 = period;

    m_InterruptGenerators[ self ] = &new_interrupt_generator;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefIoRegularFile( OTF2_IoFileRef         self,
                                         OTF2_StringRef         name,
                                         OTF2_SystemTreeNodeRef scope )
{
    IoRegularFile& new_io_regular_file = *( new IoRegularFile );

    new_io_regular_file.ioFileType = IO_REGULAR_FILE;

    new_io_regular_file.name  = m_Strings[ name ];
    new_io_regular_file.scope = scope;

    m_IoFiles[ self ] = &new_io_regular_file;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefIoDirectory( OTF2_IoFileRef         self,
                                       OTF2_StringRef         name,
                                       OTF2_SystemTreeNodeRef scope )
{
    IoDirectory& new_io_directory = *( new IoDirectory );

    new_io_directory.ioFileType = IO_DIRECTORY;

    new_io_directory.name  = m_Strings[ name ];
    new_io_directory.scope = scope;

    m_IoFiles[ self ] = &new_io_directory;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefIoHandle( OTF2_IoHandleRef   self,
                                    OTF2_StringRef     name,
                                    OTF2_IoFileRef     file,
                                    OTF2_IoParadigmRef ioParadigm,
                                    OTF2_IoHandleFlag  ioHandleFlags,
                                    OTF2_CommRef       comm,
                                    OTF2_IoHandleRef   parent )
{
    IoHandle& new_io_handle = *( new IoHandle );

    new_io_handle.name          = m_Strings[ name ];
    new_io_handle.file          = file;
    new_io_handle.ioParadigm    = ioParadigm;
    new_io_handle.ioHandleFlags = ioHandleFlags;
    new_io_handle.comm          = comm;
    new_io_handle.parent        = parent;

    m_IoHandles[ self ] = &new_io_handle;

    return OTF2_CALLBACK_SUCCESS;
}

OTF2_CallbackCode
Otf2Definitions::HandleDefInterComm( OTF2_CommRef   self,
                                     OTF2_StringRef name,
                                     OTF2_GroupRef  groupA,
                                     OTF2_GroupRef  groupB,
                                     OTF2_CommRef   commonCommunicator,
                                     OTF2_CommFlag  flags )
{
    InterComm& new_inter_comm = *( new InterComm );

    new_inter_comm.commType = INTER_COMM;

    new_inter_comm.name               = m_Strings[ name ];
    new_inter_comm.groupA             = groupA;
    new_inter_comm.groupB             = groupB;
    new_inter_comm.commonCommunicator = commonCommunicator;
    new_inter_comm.flags              = flags;

    m_Comms[ self ] = &new_inter_comm;

    return OTF2_CALLBACK_SUCCESS;
}


extern "C" {
static OTF2_CallbackCode
clock_properties_forward_cb( void*    userData,
                             uint64_t timerResolution,
                             uint64_t globalOffset,
                             uint64_t traceLength,
                             uint64_t realtimeTimestamp )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefClockProperties( timerResolution,
                                             globalOffset,
                                             traceLength,
                                             realtimeTimestamp );
}


static OTF2_CallbackCode
paradigm_forward_cb( void*              userData,
                     OTF2_Paradigm      paradigm,
                     OTF2_StringRef     name,
                     OTF2_ParadigmClass paradigmClass )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefParadigm( paradigm,
                                      name,
                                      paradigmClass );
}


static OTF2_CallbackCode
paradigm_property_forward_cb( void*                 userData,
                              OTF2_Paradigm         paradigm,
                              OTF2_ParadigmProperty property,
                              OTF2_Type             type,
                              OTF2_AttributeValue   value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefParadigmProperty( paradigm,
                                              property,
                                              type,
                                              value );
}


static OTF2_CallbackCode
io_paradigm_forward_cb( void*                          userData,
                        OTF2_IoParadigmRef             self,
                        OTF2_StringRef                 identification,
                        OTF2_StringRef                 name,
                        OTF2_IoParadigmClass           ioParadigmClass,
                        OTF2_IoParadigmFlag            ioParadigmFlags,
                        uint8_t                        numberOfProperties,
                        const OTF2_IoParadigmProperty* properties,
                        const OTF2_Type*               types,
                        const OTF2_AttributeValue*     values )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoParadigm( self,
                                        identification,
                                        name,
                                        ioParadigmClass,
                                        ioParadigmFlags,
                                        numberOfProperties,
                                        properties,
                                        types,
                                        values );
}


static OTF2_CallbackCode
string_forward_cb( void*          userData,
                   OTF2_StringRef self,
                   const char*    string )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefString( self,
                                    string );
}


static OTF2_CallbackCode
attribute_forward_cb( void*             userData,
                      OTF2_AttributeRef self,
                      OTF2_StringRef    name,
                      OTF2_StringRef    description,
                      OTF2_Type         type )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefAttribute( self,
                                       name,
                                       description,
                                       type );
}


static OTF2_CallbackCode
system_tree_node_forward_cb( void*                  userData,
                             OTF2_SystemTreeNodeRef self,
                             OTF2_StringRef         name,
                             OTF2_StringRef         className,
                             OTF2_SystemTreeNodeRef parent )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefSystemTreeNode( self,
                                            name,
                                            className,
                                            parent );
}


static OTF2_CallbackCode
location_group_forward_cb( void*                  userData,
                           OTF2_LocationGroupRef  self,
                           OTF2_StringRef         name,
                           OTF2_LocationGroupType locationGroupType,
                           OTF2_SystemTreeNodeRef systemTreeParent,
                           OTF2_LocationGroupRef  creatingLocationGroup )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefLocationGroup( self,
                                           name,
                                           locationGroupType,
                                           systemTreeParent,
                                           creatingLocationGroup );
}


static OTF2_CallbackCode
location_forward_cb( void*                 userData,
                     OTF2_LocationRef      self,
                     OTF2_StringRef        name,
                     OTF2_LocationType     locationType,
                     uint64_t              numberOfEvents,
                     OTF2_LocationGroupRef locationGroup )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefLocation( self,
                                      name,
                                      locationType,
                                      numberOfEvents,
                                      locationGroup );
}


static OTF2_CallbackCode
region_forward_cb( void*           userData,
                   OTF2_RegionRef  self,
                   OTF2_StringRef  name,
                   OTF2_StringRef  canonicalName,
                   OTF2_StringRef  description,
                   OTF2_RegionRole regionRole,
                   OTF2_Paradigm   paradigm,
                   OTF2_RegionFlag regionFlags,
                   OTF2_StringRef  sourceFile,
                   uint32_t        beginLineNumber,
                   uint32_t        endLineNumber )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefRegion( self,
                                    name,
                                    canonicalName,
                                    description,
                                    regionRole,
                                    paradigm,
                                    regionFlags,
                                    sourceFile,
                                    beginLineNumber,
                                    endLineNumber );
}


static OTF2_CallbackCode
callsite_forward_cb( void*            userData,
                     OTF2_CallsiteRef self,
                     OTF2_StringRef   sourceFile,
                     uint32_t         lineNumber,
                     OTF2_RegionRef   enteredRegion,
                     OTF2_RegionRef   leftRegion )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCallsite( self,
                                      sourceFile,
                                      lineNumber,
                                      enteredRegion,
                                      leftRegion );
}


static OTF2_CallbackCode
callpath_forward_cb( void*            userData,
                     OTF2_CallpathRef self,
                     OTF2_CallpathRef parent,
                     OTF2_RegionRef   region )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCallpath( self,
                                      parent,
                                      region );
}


static OTF2_CallbackCode
group_forward_cb( void*           userData,
                  OTF2_GroupRef   self,
                  OTF2_StringRef  name,
                  OTF2_GroupType  groupType,
                  OTF2_Paradigm   paradigm,
                  OTF2_GroupFlag  groupFlags,
                  uint32_t        numberOfMembers,
                  const uint64_t* members )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefGroup( self,
                                   name,
                                   groupType,
                                   paradigm,
                                   groupFlags,
                                   numberOfMembers,
                                   members );
}


static OTF2_CallbackCode
metric_member_forward_cb( void*                userData,
                          OTF2_MetricMemberRef self,
                          OTF2_StringRef       name,
                          OTF2_StringRef       description,
                          OTF2_MetricType      metricType,
                          OTF2_MetricMode      metricMode,
                          OTF2_Type            valueType,
                          OTF2_Base            base,
                          int64_t              exponent,
                          OTF2_StringRef       unit )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefMetricMember( self,
                                          name,
                                          description,
                                          metricType,
                                          metricMode,
                                          valueType,
                                          base,
                                          exponent,
                                          unit );
}


static OTF2_CallbackCode
metric_class_forward_cb( void*                       userData,
                         OTF2_MetricRef              self,
                         uint8_t                     numberOfMetrics,
                         const OTF2_MetricMemberRef* metricMembers,
                         OTF2_MetricOccurrence       metricOccurrence,
                         OTF2_RecorderKind           recorderKind )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefMetricClass( self,
                                         numberOfMetrics,
                                         metricMembers,
                                         metricOccurrence,
                                         recorderKind );
}


static OTF2_CallbackCode
metric_instance_forward_cb( void*            userData,
                            OTF2_MetricRef   self,
                            OTF2_MetricRef   metricClass,
                            OTF2_LocationRef recorder,
                            OTF2_MetricScope metricScope,
                            uint64_t         scope )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefMetricInstance( self,
                                            metricClass,
                                            recorder,
                                            metricScope,
                                            scope );
}


static OTF2_CallbackCode
comm_forward_cb( void*          userData,
                 OTF2_CommRef   self,
                 OTF2_StringRef name,
                 OTF2_GroupRef  group,
                 OTF2_CommRef   parent,
                 OTF2_CommFlag  flags )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefComm( self,
                                  name,
                                  group,
                                  parent,
                                  flags );
}


static OTF2_CallbackCode
parameter_forward_cb( void*              userData,
                      OTF2_ParameterRef  self,
                      OTF2_StringRef     name,
                      OTF2_ParameterType parameterType )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefParameter( self,
                                       name,
                                       parameterType );
}


static OTF2_CallbackCode
rma_win_forward_cb( void*           userData,
                    OTF2_RmaWinRef  self,
                    OTF2_StringRef  name,
                    OTF2_CommRef    comm,
                    OTF2_RmaWinFlag flags )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefRmaWin( self,
                                    name,
                                    comm,
                                    flags );
}


static OTF2_CallbackCode
metric_class_recorder_forward_cb( void*            userData,
                                  OTF2_MetricRef   metric,
                                  OTF2_LocationRef recorder )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefMetricClassRecorder( metric,
                                                 recorder );
}


static OTF2_CallbackCode
system_tree_node_property_forward_cb( void*                  userData,
                                      OTF2_SystemTreeNodeRef systemTreeNode,
                                      OTF2_StringRef         name,
                                      OTF2_Type              type,
                                      OTF2_AttributeValue    value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefSystemTreeNodeProperty( systemTreeNode,
                                                    name,
                                                    type,
                                                    value );
}


static OTF2_CallbackCode
system_tree_node_domain_forward_cb( void*                  userData,
                                    OTF2_SystemTreeNodeRef systemTreeNode,
                                    OTF2_SystemTreeDomain  systemTreeDomain )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefSystemTreeNodeDomain( systemTreeNode,
                                                  systemTreeDomain );
}


static OTF2_CallbackCode
location_group_property_forward_cb( void*                 userData,
                                    OTF2_LocationGroupRef locationGroup,
                                    OTF2_StringRef        name,
                                    OTF2_Type             type,
                                    OTF2_AttributeValue   value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefLocationGroupProperty( locationGroup,
                                                   name,
                                                   type,
                                                   value );
}


static OTF2_CallbackCode
location_property_forward_cb( void*               userData,
                              OTF2_LocationRef    location,
                              OTF2_StringRef      name,
                              OTF2_Type           type,
                              OTF2_AttributeValue value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefLocationProperty( location,
                                              name,
                                              type,
                                              value );
}


static OTF2_CallbackCode
cart_dimension_forward_cb( void*                 userData,
                           OTF2_CartDimensionRef self,
                           OTF2_StringRef        name,
                           uint32_t              size,
                           OTF2_CartPeriodicity  cartPeriodicity )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCartDimension( self,
                                           name,
                                           size,
                                           cartPeriodicity );
}


static OTF2_CallbackCode
cart_topology_forward_cb( void*                        userData,
                          OTF2_CartTopologyRef         self,
                          OTF2_StringRef               name,
                          OTF2_CommRef                 communicator,
                          uint8_t                      numberOfDimensions,
                          const OTF2_CartDimensionRef* cartDimensions )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCartTopology( self,
                                          name,
                                          communicator,
                                          numberOfDimensions,
                                          cartDimensions );
}


static OTF2_CallbackCode
cart_coordinate_forward_cb( void*                userData,
                            OTF2_CartTopologyRef cartTopology,
                            uint32_t             rank,
                            uint8_t              numberOfDimensions,
                            const uint32_t*      coordinates )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCartCoordinate( cartTopology,
                                            rank,
                                            numberOfDimensions,
                                            coordinates );
}


static OTF2_CallbackCode
source_code_location_forward_cb( void*                      userData,
                                 OTF2_SourceCodeLocationRef self,
                                 OTF2_StringRef             file,
                                 uint32_t                   lineNumber )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefSourceCodeLocation( self,
                                                file,
                                                lineNumber );
}


static OTF2_CallbackCode
calling_context_forward_cb( void*                      userData,
                            OTF2_CallingContextRef     self,
                            OTF2_RegionRef             region,
                            OTF2_SourceCodeLocationRef sourceCodeLocation,
                            OTF2_CallingContextRef     parent )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCallingContext( self,
                                            region,
                                            sourceCodeLocation,
                                            parent );
}


static OTF2_CallbackCode
calling_context_property_forward_cb( void*                  userData,
                                     OTF2_CallingContextRef callingContext,
                                     OTF2_StringRef         name,
                                     OTF2_Type              type,
                                     OTF2_AttributeValue    value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCallingContextProperty( callingContext,
                                                    name,
                                                    type,
                                                    value );
}


static OTF2_CallbackCode
interrupt_generator_forward_cb( void*                       userData,
                                OTF2_InterruptGeneratorRef  self,
                                OTF2_StringRef              name,
                                OTF2_InterruptGeneratorMode interruptGeneratorMode,
                                OTF2_Base                   base,
                                int64_t                     exponent,
                                uint64_t                    period )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefInterruptGenerator( self,
                                                name,
                                                interruptGeneratorMode,
                                                base,
                                                exponent,
                                                period );
}


static OTF2_CallbackCode
io_file_property_forward_cb( void*               userData,
                             OTF2_IoFileRef      ioFile,
                             OTF2_StringRef      name,
                             OTF2_Type           type,
                             OTF2_AttributeValue value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoFileProperty( ioFile,
                                            name,
                                            type,
                                            value );
}


static OTF2_CallbackCode
io_regular_file_forward_cb( void*                  userData,
                            OTF2_IoFileRef         self,
                            OTF2_StringRef         name,
                            OTF2_SystemTreeNodeRef scope )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoRegularFile( self,
                                           name,
                                           scope );
}


static OTF2_CallbackCode
io_directory_forward_cb( void*                  userData,
                         OTF2_IoFileRef         self,
                         OTF2_StringRef         name,
                         OTF2_SystemTreeNodeRef scope )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoDirectory( self,
                                         name,
                                         scope );
}


static OTF2_CallbackCode
io_handle_forward_cb( void*              userData,
                      OTF2_IoHandleRef   self,
                      OTF2_StringRef     name,
                      OTF2_IoFileRef     file,
                      OTF2_IoParadigmRef ioParadigm,
                      OTF2_IoHandleFlag  ioHandleFlags,
                      OTF2_CommRef       comm,
                      OTF2_IoHandleRef   parent )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoHandle( self,
                                      name,
                                      file,
                                      ioParadigm,
                                      ioHandleFlags,
                                      comm,
                                      parent );
}


static OTF2_CallbackCode
io_pre_created_handle_state_forward_cb( void*             userData,
                                        OTF2_IoHandleRef  ioHandle,
                                        OTF2_IoAccessMode mode,
                                        OTF2_IoStatusFlag statusFlags )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefIoPreCreatedHandleState( ioHandle,
                                                     mode,
                                                     statusFlags );
}


static OTF2_CallbackCode
callpath_parameter_forward_cb( void*               userData,
                               OTF2_CallpathRef    callpath,
                               OTF2_ParameterRef   parameter,
                               OTF2_Type           type,
                               OTF2_AttributeValue value )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefCallpathParameter( callpath,
                                               parameter,
                                               type,
                                               value );
}


static OTF2_CallbackCode
inter_comm_forward_cb( void*          userData,
                       OTF2_CommRef   self,
                       OTF2_StringRef name,
                       OTF2_GroupRef  groupA,
                       OTF2_GroupRef  groupB,
                       OTF2_CommRef   commonCommunicator,
                       OTF2_CommFlag  flags )
{
    Otf2Definitions* p_this = ( Otf2Definitions* )userData;

    return p_this->HandleDefInterComm( self,
                                       name,
                                       groupA,
                                       groupB,
                                       commonCommunicator,
                                       flags );
}
} // extern "C"

Otf2Definitions::Otf2Definitions( OTF2_Reader* reader ) :
    m_Reader( reader )
{
    OTF2_GlobalDefReader* def_reader = OTF2_Reader_GetGlobalDefReader( m_Reader );

    OTF2_GlobalDefReaderCallbacks* def_callbacks = OTF2_GlobalDefReaderCallbacks_New();

    OTF2_GlobalDefReaderCallbacks_SetClockPropertiesCallback( def_callbacks, clock_properties_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetParadigmCallback( def_callbacks, paradigm_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetParadigmPropertyCallback( def_callbacks, paradigm_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoParadigmCallback( def_callbacks, io_paradigm_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetStringCallback( def_callbacks, string_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetAttributeCallback( def_callbacks, attribute_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetSystemTreeNodeCallback( def_callbacks, system_tree_node_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetLocationGroupCallback( def_callbacks, location_group_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetLocationCallback( def_callbacks, location_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetRegionCallback( def_callbacks, region_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCallsiteCallback( def_callbacks, callsite_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCallpathCallback( def_callbacks, callpath_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetGroupCallback( def_callbacks, group_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetMetricMemberCallback( def_callbacks, metric_member_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetMetricClassCallback( def_callbacks, metric_class_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetMetricInstanceCallback( def_callbacks, metric_instance_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCommCallback( def_callbacks, comm_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetParameterCallback( def_callbacks, parameter_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetRmaWinCallback( def_callbacks, rma_win_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetMetricClassRecorderCallback( def_callbacks, metric_class_recorder_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetSystemTreeNodePropertyCallback( def_callbacks, system_tree_node_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetSystemTreeNodeDomainCallback( def_callbacks, system_tree_node_domain_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetLocationGroupPropertyCallback( def_callbacks, location_group_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetLocationPropertyCallback( def_callbacks, location_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCartDimensionCallback( def_callbacks, cart_dimension_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCartTopologyCallback( def_callbacks, cart_topology_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCartCoordinateCallback( def_callbacks, cart_coordinate_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetSourceCodeLocationCallback( def_callbacks, source_code_location_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCallingContextCallback( def_callbacks, calling_context_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCallingContextPropertyCallback( def_callbacks, calling_context_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetInterruptGeneratorCallback( def_callbacks, interrupt_generator_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoFilePropertyCallback( def_callbacks, io_file_property_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoRegularFileCallback( def_callbacks, io_regular_file_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoDirectoryCallback( def_callbacks, io_directory_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoHandleCallback( def_callbacks, io_handle_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetIoPreCreatedHandleStateCallback( def_callbacks, io_pre_created_handle_state_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetCallpathParameterCallback( def_callbacks, callpath_parameter_forward_cb );
    OTF2_GlobalDefReaderCallbacks_SetInterCommCallback( def_callbacks, inter_comm_forward_cb );

    OTF2_Reader_RegisterGlobalDefCallbacks( m_Reader, def_reader, def_callbacks, this );

    uint64_t definitions_read = 0;
    OTF2_Reader_ReadAllGlobalDefinitions( m_Reader, def_reader, &definitions_read );

    OTF2_GlobalDefReaderCallbacks_Delete( def_callbacks );

    OTF2_Reader_CloseGlobalDefReader( m_Reader,
                                      def_reader );
}

Otf2Definitions::~Otf2Definitions()
{
    for ( ClockPropertiesIT it = m_ClockProperties.begin();
          it != m_ClockProperties.end();
          it++ )
    {
        delete *it;
    }

    for ( ParadigmIT it = m_Paradigms.begin();
          it != m_Paradigms.end();
          it++ )
    {
        delete *it;
    }

    for ( ParadigmPropertyIT it = m_ParadigmProperties.begin();
          it != m_ParadigmProperties.end();
          it++ )
    {
        delete *it;
    }

    for ( IoParadigmIT it = m_IoParadigms.begin();
          it != m_IoParadigms.end();
          it++ )
    {
        delete it->second;
    }

    for ( AttributeIT it = m_Attributes.begin();
          it != m_Attributes.end();
          it++ )
    {
        delete it->second;
    }

    for ( SystemTreeNodeIT it = m_SystemTreeNodes.begin();
          it != m_SystemTreeNodes.end();
          it++ )
    {
        for ( SystemTreeNodePropertyIT sit = it->second->systemTreeNodeProperties.begin();
              sit != it->second->systemTreeNodeProperties.end();
              sit++ )
        {
            delete *sit;
        }
        for ( SystemTreeNodeDomainIT sit = it->second->systemTreeNodeDomains.begin();
              sit != it->second->systemTreeNodeDomains.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( LocationGroupIT it = m_LocationGroups.begin();
          it != m_LocationGroups.end();
          it++ )
    {
        for ( LocationGroupPropertyIT sit = it->second->locationGroupProperties.begin();
              sit != it->second->locationGroupProperties.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( LocationIT it = m_Locations.begin();
          it != m_Locations.end();
          it++ )
    {
        for ( LocationPropertyIT sit = it->second->locationProperties.begin();
              sit != it->second->locationProperties.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( RegionIT it = m_Regions.begin();
          it != m_Regions.end();
          it++ )
    {
        delete it->second;
    }

    for ( CallsiteIT it = m_Callsites.begin();
          it != m_Callsites.end();
          it++ )
    {
        delete it->second;
    }

    for ( CallpathIT it = m_Callpaths.begin();
          it != m_Callpaths.end();
          it++ )
    {
        for ( CallpathParameterIT sit = it->second->callpathParameters.begin();
              sit != it->second->callpathParameters.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( GroupIT it = m_Groups.begin();
          it != m_Groups.end();
          it++ )
    {
        delete it->second;
    }

    for ( MetricMemberIT it = m_MetricMembers.begin();
          it != m_MetricMembers.end();
          it++ )
    {
        delete it->second;
    }

    for ( MetricIT it = m_Metrics.begin();
          it != m_Metrics.end();
          it++ )
    {
        for ( MetricClassRecorderIT sit = it->second->metricClassRecorders.begin();
              sit != it->second->metricClassRecorders.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( CommIT it = m_Comms.begin();
          it != m_Comms.end();
          it++ )
    {
        delete it->second;
    }

    for ( ParameterIT it = m_Parameters.begin();
          it != m_Parameters.end();
          it++ )
    {
        delete it->second;
    }

    for ( RmaWinIT it = m_RmaWins.begin();
          it != m_RmaWins.end();
          it++ )
    {
        delete it->second;
    }

    for ( CartDimensionIT it = m_CartDimensions.begin();
          it != m_CartDimensions.end();
          it++ )
    {
        delete it->second;
    }

    for ( CartTopologyIT it = m_CartTopologies.begin();
          it != m_CartTopologies.end();
          it++ )
    {
        for ( CartCoordinateIT sit = it->second->cartCoordinates.begin();
              sit != it->second->cartCoordinates.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( SourceCodeLocationIT it = m_SourceCodeLocations.begin();
          it != m_SourceCodeLocations.end();
          it++ )
    {
        delete it->second;
    }

    for ( CallingContextIT it = m_CallingContexts.begin();
          it != m_CallingContexts.end();
          it++ )
    {
        for ( CallingContextPropertyIT sit = it->second->callingContextProperties.begin();
              sit != it->second->callingContextProperties.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( InterruptGeneratorIT it = m_InterruptGenerators.begin();
          it != m_InterruptGenerators.end();
          it++ )
    {
        delete it->second;
    }

    for ( IoFileIT it = m_IoFiles.begin();
          it != m_IoFiles.end();
          it++ )
    {
        for ( IoFilePropertyIT sit = it->second->ioFileProperties.begin();
              sit != it->second->ioFileProperties.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }

    for ( IoHandleIT it = m_IoHandles.begin();
          it != m_IoHandles.end();
          it++ )
    {
        for ( IoPreCreatedHandleStateIT sit = it->second->ioPreCreatedHandleStates.begin();
              sit != it->second->ioPreCreatedHandleStates.end();
              sit++ )
        {
            delete *sit;
        }
        delete it->second;
    }
}