line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#include |
2
|
|
|
|
|
|
|
#include |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#if _MSC_VER >= 1800 || __cplusplus > 199711L |
5
|
|
|
|
|
|
|
#define HAVE_UNORDERED_MAP |
6
|
|
|
|
|
|
|
#include |
7
|
|
|
|
|
|
|
#else |
8
|
|
|
|
|
|
|
#include |
9
|
|
|
|
|
|
|
#endif |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#include "eventmap.h" |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
namespace |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#ifdef HAVE_UNORDERED_MAP |
18
|
|
|
|
|
|
|
typedef std::unordered_map DataMap; |
19
|
|
|
|
|
|
|
#else |
20
|
|
|
|
|
|
|
typedef std::map DataMap; |
21
|
|
|
|
|
|
|
#endif |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
40
|
|
|
|
|
|
struct zmq_raw_event_map: public DataMap |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
|
struct zmq_raw_event_map_iterator |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
DataMap *map; |
33
|
|
|
|
|
|
|
DataMap::iterator it; |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
|
zmq_raw_event_map *zmq_raw_event_map_create() |
38
|
|
|
|
|
|
|
{ |
39
|
10
|
50
|
|
|
|
|
return new (std::nothrow) zmq_raw_event_map(); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
10
|
|
|
|
|
|
void zmq_raw_event_map_destroy (zmq_raw_event_map *map) |
43
|
|
|
|
|
|
|
{ |
44
|
10
|
50
|
|
|
|
|
delete map; |
45
|
10
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
178
|
|
|
|
|
|
void zmq_raw_event_map_add (zmq_raw_event_map *map, void *ptr, short value) |
48
|
|
|
|
|
|
|
{ |
49
|
178
|
50
|
|
|
|
|
assert (map); |
50
|
|
|
|
|
|
|
|
51
|
178
|
50
|
|
|
|
|
map->insert (std::make_pair (ptr, value)); |
52
|
178
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
109
|
|
|
|
|
|
void zmq_raw_event_map_remove (zmq_raw_event_map *map, void *ptr) |
55
|
|
|
|
|
|
|
{ |
56
|
109
|
50
|
|
|
|
|
assert (map); |
57
|
|
|
|
|
|
|
|
58
|
109
|
50
|
|
|
|
|
DataMap::iterator it = map->find (ptr); |
59
|
109
|
50
|
|
|
|
|
if (it != map->end()) |
60
|
|
|
|
|
|
|
{ |
61
|
109
|
50
|
|
|
|
|
map->erase (it); |
62
|
|
|
|
|
|
|
} |
63
|
109
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
639
|
|
|
|
|
|
const short *zmq_raw_event_map_get (zmq_raw_event_map *map, void *ptr) |
66
|
|
|
|
|
|
|
{ |
67
|
639
|
50
|
|
|
|
|
assert (map); |
68
|
|
|
|
|
|
|
|
69
|
639
|
50
|
|
|
|
|
DataMap::const_iterator it = map->find (ptr); |
70
|
639
|
100
|
|
|
|
|
if (it == map->end()) |
71
|
332
|
|
|
|
|
|
return NULL; |
72
|
|
|
|
|
|
|
|
73
|
639
|
|
|
|
|
|
return &it->second; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
81
|
|
|
|
|
|
void zmq_raw_event_map_clear (zmq_raw_event_map *map) |
77
|
|
|
|
|
|
|
{ |
78
|
81
|
50
|
|
|
|
|
assert (map); |
79
|
81
|
|
|
|
|
|
map->clear(); |
80
|
81
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
5
|
|
|
|
|
|
zmq_raw_event_map_iterator *zmq_raw_event_map_iterator_create (zmq_raw_event_map *map) |
83
|
|
|
|
|
|
|
{ |
84
|
5
|
50
|
|
|
|
|
assert (map); |
85
|
|
|
|
|
|
|
|
86
|
5
|
100
|
|
|
|
|
if (map->empty()) |
87
|
4
|
|
|
|
|
|
return NULL; |
88
|
|
|
|
|
|
|
|
89
|
1
|
50
|
|
|
|
|
zmq_raw_event_map_iterator *iterator = new (std::nothrow) zmq_raw_event_map_iterator(); |
90
|
1
|
50
|
|
|
|
|
if (iterator) |
91
|
|
|
|
|
|
|
{ |
92
|
1
|
|
|
|
|
|
iterator->map = map; |
93
|
1
|
|
|
|
|
|
iterator->it = iterator->map->begin(); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
|
|
|
return iterator; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
1
|
|
|
|
|
|
void zmq_raw_event_map_iterator_destroy (zmq_raw_event_map_iterator *iterator) |
100
|
|
|
|
|
|
|
{ |
101
|
1
|
|
|
|
|
|
delete iterator; |
102
|
1
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
2
|
|
|
|
|
|
void *zmq_raw_event_map_iterator_next (zmq_raw_event_map_iterator *iterator) |
105
|
|
|
|
|
|
|
{ |
106
|
2
|
100
|
|
|
|
|
if (++iterator->it == iterator->map->end()) |
107
|
1
|
|
|
|
|
|
return NULL; |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
|
return iterator->it->first; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
2
|
|
|
|
|
|
void *zmq_raw_event_map_iterator_key (zmq_raw_event_map_iterator *iterator) |
113
|
|
|
|
|
|
|
{ |
114
|
2
|
50
|
|
|
|
|
assert (iterator); |
115
|
2
|
|
|
|
|
|
return iterator->it->first; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|