cvx
Loading...
Searching...
No Matches
queue_cast.h
Go to the documentation of this file.
1#include "cvx/fallback.h"
2
3// clang-format off
4#ifndef INTERFACE
5#error "cvx/interface/queue_cast.h requires INTERFACE to be defined (the struct name, e.g. #define INTERFACE my_queue)"
6#endif
7#ifndef IMPL_DROP
8#error "cvx/interface/queue_cast.h requires IMPL_DROP to be defined"
9#endif
10#ifndef IMPL_ENQUEUE
11#error "cvx/interface/queue_cast.h requires IMPL_ENQUEUE to be defined"
12#endif
13#ifndef IMPL_DEQUEUE
14#error "cvx/interface/queue_cast.h requires IMPL_DEQUEUE to be defined"
15#endif
16#ifndef IMPL_COUNT
17#error "cvx/interface/queue_cast.h requires IMPL_COUNT to be defined"
18#endif
19// clang-format on
20
21#include "cvx/core.h"
22
23struct VTABLE(INTERFACE) GLOBAL_VTABLE(SNAME, _as_, INTERFACE) = {
24 .drop = IMPL_DROP,
25 .enqueue = IMPL_ENQUEUE,
26 .dequeue = IMPL_DEQUEUE,
27 .count = IMPL_COUNT,
28};
29
30struct INTERFACE FUNC(CVX_(_as_, INTERFACE))(cvx_container *instance)
31{
32 return (struct INTERFACE){
33 .vtable = &GLOBAL_VTABLE(SNAME, _as_, INTERFACE),
34 .instance = instance,
35 };
36}
37
38#undef INTERFACE
#define CVX_(A, B)
Definition core.h:10
#define GLOBAL_VTABLE(SNAME, X, NAME)
Definition core.h:13
Definition deque.h:30
struct INTERFACE_vtable * vtable
Definition deque.h:32
Definition binary_heap.h:135