#include <stddef.h>
#include <stdint.h>
#include <derive-c/core.h>
#include <derive-c/panic.h>
#include <derive-c/self.h>
Go to the source code of this file.
◆ INPLACE_CAPACITY
#define INPLACE_CAPACITY 8 |
◆ INPLACE_TYPE
#define INPLACE_TYPE uint8_t |
#define T derive_c_parameter_t |
◆ T_DELETE
#define T_DELETE derive_c_parameter_t_delete |
◆ delete()
void delete |
( |
SELF * | self | ) |
|
|
static |
Definition at line 129 of file template.h.
129 {
133 }
134}
#define DEBUG_ASSERT(expr)
◆ empty() [1/2]
bool empty |
( |
ITER const * | iter | ) |
|
|
static |
Definition at line 158 of file template.h.
158 {
160 return iter->pos >= iter->vec->size;
161}
◆ empty() [2/2]
bool empty |
( |
ITER_CONST const * | iter | ) |
|
|
static |
Definition at line 195 of file template.h.
195 {
197 return iter->pos >= iter->vec->size;
198}
◆ get_iter()
ITER get_iter |
( |
SELF * | self | ) |
|
|
static |
Definition at line 163 of file template.h.
163 {
165 return (ITER){
166 .vec = self,
167 .pos = 0,
168 };
169}
◆ get_iter_const()
ITER_CONST get_iter_const |
( |
SELF const * | self | ) |
|
|
static |
Definition at line 200 of file template.h.
200 {
202 return (ITER_CONST){
203 .vec = self,
204 .pos = 0,
205 };
206}
◆ new()
◆ next() [1/2]
Definition at line 143 of file template.h.
143 {
145 if (iter->pos < iter->vec->size) {
146 T* item = &iter->vec->data[iter->pos];
147 iter->pos++;
148 return item;
149 }
150 return NULL;
151}
◆ next() [2/2]
T const * next |
( |
ITER_CONST * | iter | ) |
|
|
static |
Definition at line 180 of file template.h.
180 {
182 if (iter->pos < iter->vec->size) {
183 T const* item = &iter->vec->data[iter->pos];
184 iter->pos++;
185 return item;
186 }
187 return NULL;
188}
◆ pop()
Definition at line 118 of file template.h.
118 {
121 return entry;
122}
static bool try_pop(SELF *self, T *destination)
◆ position() [1/2]
size_t position |
( |
ITER const * | iter | ) |
|
|
static |
Definition at line 153 of file template.h.
153 {
155 return iter->pos;
156}
◆ position() [2/2]
size_t position |
( |
ITER_CONST const * | iter | ) |
|
|
static |
Definition at line 190 of file template.h.
190 {
192 return iter->pos;
193}
◆ push()
T * push |
( |
SELF * | self, |
|
|
T | value ) |
|
static |
Definition at line 102 of file template.h.
102 {
105 return slot;
106}
static T * try_push(SELF *self, T value)
◆ read()
Definition at line 71 of file template.h.
71 {
74 return value;
75}
static V const * try_read(SELF const *self, INDEX index)
◆ shallow_clone()
Definition at line 51 of file template.h.
51 {
53 new_self.
size = self->size;
54
55
56
58 new_self.
data[i] = self->data[i];
59 }
60 return new_self;
61}
◆ size()
size_t size |
( |
SELF const * | self | ) |
|
|
static |
Definition at line 124 of file template.h.
124 {
126 return self->size;
127}
◆ try_pop()
bool try_pop |
( |
SELF * | self, |
|
|
T * | destination ) |
|
static |
Definition at line 108 of file template.h.
108 {
112 *destination = self->
data[self->
size];
113 return true;
114 }
115 return false;
116}
◆ try_push()
T * try_push |
( |
SELF * | self, |
|
|
T | value ) |
|
static |
Definition at line 91 of file template.h.
91 {
95 *slot = value;
97 return slot;
98 }
99 return NULL;
100}
◆ try_read()
Definition at line 63 of file template.h.
63 {
66 return &self->data[index];
67 }
68 return NULL;
69}
static INDEX_TYPE size(SELF const *self)
◆ try_write()
Definition at line 77 of file template.h.
77 {
80 return &self->
data[index];
81 }
82 return NULL;
83}
◆ write()
Definition at line 85 of file template.h.
85 {
88 return value;
89}
static V * try_write(SELF *self, INDEX index)