File: future-value.c.template

package info (click to toggle)
libmongoc 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,824 kB
  • ctags: 4,501
  • sloc: ansic: 57,956; makefile: 717; python: 502; sh: 54
file content (37 lines) | stat: -rw-r--r-- 767 bytes parent folder | download
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)
{
    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->{{ T }}_value = value;
}

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