mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-23 23:21:46 +00:00
34 lines
1.3 KiB
C
34 lines
1.3 KiB
C
|
// Copyright 2022, Collabora, Ltd.
|
||
|
// SPDX-License-Identifier: BSL-1.0
|
||
|
/*!
|
||
|
* @file
|
||
|
* @brief Expose std::vector to C
|
||
|
* @author Mateo de Mayo <mateo.demayo@collabora.com>
|
||
|
* @ingroup aux_util
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include <stddef.h>
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#define U_VECTOR_DECLARATION(TYPE) \
|
||
|
struct u_vector_##TYPE \
|
||
|
{ \
|
||
|
void *ptr; \
|
||
|
}; \
|
||
|
struct u_vector_##TYPE u_vector_##TYPE##_create(); \
|
||
|
void u_vector_##TYPE##_push_back(struct u_vector_##TYPE uv, TYPE e); \
|
||
|
TYPE u_vector_##TYPE##_at(struct u_vector_##TYPE uv, size_t i); \
|
||
|
void u_vector_##TYPE##_destroy(struct u_vector_##TYPE *uv);
|
||
|
|
||
|
U_VECTOR_DECLARATION(int)
|
||
|
U_VECTOR_DECLARATION(float)
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|