Skip to content

Commit

Permalink
feat: svec functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 2, 2024
1 parent adc2e35 commit e267b08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/zenoh-pico/collections/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ bool _z_svec_is_empty(const _z_svec_t *v);
z_result_t _z_svec_expand(_z_svec_t *v, z_element_move_f move, size_t element_size);
z_result_t _z_svec_append(_z_svec_t *v, const void *e, z_element_move_f m, size_t element_size);
void *_z_svec_get(const _z_svec_t *v, size_t pos, size_t element_size);
void *_z_svec_get_mut(_z_svec_t *v, size_t i, size_t element_size);
void _z_svec_set(_z_svec_t *sv, size_t pos, void *e, z_element_clear_f f, size_t element_size);
void _z_svec_remove(_z_svec_t *sv, size_t pos, z_element_clear_f f, z_element_move_f m, size_t element_size);

Expand All @@ -101,6 +102,7 @@ void _z_svec_release(_z_svec_t *v);

#define _Z_SVEC_DEFINE(name, type) \
typedef _z_svec_t name##_svec_t; \
static inline name##_svec_t name##_svec_null(void) { return _z_svec_null(); } \
static inline name##_svec_t name##_svec_make(size_t capacity) { return _z_svec_make(capacity, sizeof(type)); } \
static inline size_t name##_svec_len(const name##_svec_t *v) { return _z_svec_len(v); } \
static inline bool name##_svec_is_empty(const name##_svec_t *v) { return _z_svec_is_empty(v); } \
Expand All @@ -113,6 +115,9 @@ void _z_svec_release(_z_svec_t *v);
static inline type *name##_svec_get(const name##_svec_t *v, size_t pos) { \
return (type *)_z_svec_get(v, pos, sizeof(type)); \
} \
static inline type *name##_svec_get_mut(name##_svec_t *v, size_t pos) { \
return (type *)_z_svec_get_mut(v, pos, sizeof(type)); \
} \
static inline void name##_svec_set(name##_svec_t *v, size_t pos, type *e) { \
_z_svec_set(v, pos, e, name##_elem_clear, sizeof(type)); \
} \
Expand Down

0 comments on commit e267b08

Please sign in to comment.