#include "future-value.h"

{{ header_comment }}

future_value_t *
future_value_new (void)
{
   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 %}
