source: lib/data-struct/vector.h @ 322c516

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 322c516 was 6a082f8, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Move parallel API functions to libtrace_parallel.h

Also started the process of updating the documentation

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#include <pthread.h>
2/* Need libtrace.h for DLLEXPORT defines */
3#include "../libtrace.h"
4
5#ifndef LIBTRACE_VECTOR_H
6#define LIBTRACE_VECTOR_H
7
8typedef void (*vector_data_fn)(void *data);
9typedef struct libtrace_vector {
10        size_t max_size;
11        size_t size;
12        size_t element_size;
13        char *elements; // Means we can use array indexing
14        pthread_mutex_t lock;
15} libtrace_vector_t;
16
17DLLEXPORT void libtrace_vector_init(libtrace_vector_t *v, size_t element_size);
18DLLEXPORT void libtrace_vector_push_back(libtrace_vector_t *v, void *d);
19DLLEXPORT size_t libtrace_vector_get_size(libtrace_vector_t *v);
20DLLEXPORT int libtrace_vector_get(libtrace_vector_t *v, size_t location, void *d);
21DLLEXPORT void libtrace_vector_append(libtrace_vector_t *dest, libtrace_vector_t *src);
22DLLEXPORT void libtrace_vector_destroy(libtrace_vector_t *v);
23DLLEXPORT void libtrace_zero_vector(libtrace_vector_t *v);
24DLLEXPORT int libtrace_vector_remove_front(libtrace_vector_t *v);
25DLLEXPORT void libtrace_vector_empty(libtrace_vector_t *v);
26
27// For now this is a special case and this doesn't really belong
28// here, but to do this properly a full lock is required as
29// multiple items are changed
30DLLEXPORT void libtrace_vector_apply_function(libtrace_vector_t *v, vector_data_fn fn);
31
32// Sort the vector using qsort
33DLLEXPORT void libtrace_vector_qsort(libtrace_vector_t *v, int (*compar)(const void *, const void*));
34#endif
Note: See TracBrowser for help on using the repository browser.