File: future-value.c.template

package info (click to toggle)
mongo-c-driver 1.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,116 kB
  • sloc: ansic: 124,705; python: 2,971; sh: 138; makefile: 23
file content (37 lines) | stat: -rw-r--r-- 792 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
#include "future-value.h"

{{ header_comment }}

future_value_t *
future_value_new ()
{
   return (future_value_t *) bson_malloc0 (sizeof (future_value_t));
}

void
future_value_set_void (future_value_t *future_value)
{
   future_value->type = future_value_void_type;
}

void
future_value_get_void (future_value_t *future_value)
{
   BSON_ASSERT (future_value->type == future_value_void_type);
}

{% for T in type_list %}
void
future_value_set_{{ T }} (future_value_t *future_value, {{ T }} value)
{
   future_value->type = future_value_{{ T }}_type;
   future_value->value.{{ T }}_value = value;
}

{{ T }}
future_value_get_{{ T }} (future_value_t *future_value)
{
   BSON_ASSERT (future_value->type == future_value_{{ T }}_type);
   return future_value->value.{{ T }}_value;
}
{% endfor %}