blob: f0df9563f88ff30c24afc725d1bbbef7801e3328 (
plain)
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
|
#ifndef _MAP_VALUES_C_ /* -*- linux-c -*- */
#define _MAP_VALUES_C_
/** @file map-values.c
* @brief Includes the proper value functions for maps.
*/
#include "map.h"
#if !defined(NEED_STRING_VALS) && !defined(NEED_INT64_VALS) && !defined(NEED_STAT_VALS)
#error Need to define at least one of NEED_STRING_VALS, NEED_INT64_VALS and NEED_STAT_VALS
#endif
#ifdef NEED_STRING_VALS
#include "map-str.c"
#endif
#ifdef NEED_STAT_VALS
#include "map-stat.c"
#endif
#ifdef NEED_INT64_VALS
#include "map-int.c"
#endif
#if defined(NEED_INT64_VALS) || defined (NEED_STAT_VALS)
/** Adds an int64 to the current element's value.
* This adds an int64 to the current element's value. The map must have been created
* to hold int64s or stats.
*
* If the element doesn't exist, it is created. If no current element (key)
* is set for the map, this function does nothing.
* @param map
* @param val value
* @ingroup map_set
*/
void _stp_map_add_int64 (MAP map, int64_t val)
{
if (map == NULL)
return;
#ifdef NEED_INT64_VALS
if (map->type == INT64)
__stp_map_set_int64 (map, val, 1);
#endif
#ifdef NEED_STAT_VALS
if (map->type == STAT)
_stp_map_add_stat (map, val);
#endif
}
#endif
#endif /* _MAP_VALUES_C_ */
|