cvx
Loading...
Searching...
No Matches
deque_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/deque_cast.h requires INTERFACE to be defined (the struct name, e.g. #define INTERFACE my_deque)"
6#endif
7#ifndef IMPL_DROP
8#error "cvx/interface/deque_cast.h requires IMPL_DROP to be defined"
9#endif
10#ifndef IMPL_PUSH_FRONT
11#error "cvx/interface/deque_cast.h requires IMPL_PUSH_FRONT to be defined"
12#endif
13#ifndef IMPL_PUSH_BACK
14#error "cvx/interface/deque_cast.h requires IMPL_PUSH_BACK to be defined"
15#endif
16#ifndef IMPL_POP_FRONT
17#error "cvx/interface/deque_cast.h requires IMPL_POP_FRONT to be defined"
18#endif
19#ifndef IMPL_POP_BACK
20#error "cvx/interface/deque_cast.h requires IMPL_POP_BACK to be defined"
21#endif
22#ifndef IMPL_PEEK_FRONT
23#error "cvx/interface/deque_cast.h requires IMPL_PEEK_FRONT to be defined"
24#endif
25#ifndef IMPL_PEEK_BACK
26#error "cvx/interface/deque_cast.h requires IMPL_PEEK_BACK to be defined"
27#endif
28#ifndef IMPL_COUNT
29#error "cvx/interface/deque_cast.h requires IMPL_COUNT to be defined"
30#endif
31// clang-format on
32
33#include "cvx/core.h"
34
35struct VTABLE(INTERFACE) GLOBAL_VTABLE(SNAME, _as_, INTERFACE) = {
36 .drop = IMPL_DROP,
37 .push_front = IMPL_PUSH_FRONT,
38 .push_back = IMPL_PUSH_BACK,
39 .pop_front = IMPL_POP_FRONT,
40 .pop_back = IMPL_POP_BACK,
41 .peek_front = IMPL_PEEK_FRONT,
42 .peek_back = IMPL_PEEK_BACK,
43 .count = IMPL_COUNT,
44};
45
46struct INTERFACE FUNC(CVX_(_as_, INTERFACE))(cvx_container *_instance_)
47{
48 return (struct INTERFACE){
49 .vtable = &GLOBAL_VTABLE(SNAME, _as_, INTERFACE),
50 .instance = _instance_,
51 };
52}
53
54#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