40 #ifndef picox_container_xintrusive_list_h_ 41 #define picox_container_xintrusive_list_h_ 117 #define xnode_entry(ptr, type, member) X_CONTAINER_OF(ptr, type, member) 128 node->next->prev = node->prev;
129 node->prev->next = node->next;
190 self->head.next =
self->head.prev = &
self->head;
220 return self->head.next == &
self->head;
240 return self->head.next;
262 return self->head.prev;
332 #define xilist_foreach(list, ite) \ 333 for (ite = xilist_front(list); \ 334 ite != xilist_end(list); \ 342 #define xilist_rforeach(list, ite) \ 343 for (ite = xilist_back(list); \ 344 ite != xilist_end(list); \ 489 self->head.next->prev =
self->head.prev->next = &(
self->head);
494 other->head.next->prev = other->head.prev->next = &(other->head);
514 pos->next =
self->head.next;
515 self->head.next = other->head.next;
516 self->head.next->prev = &
self->head;
517 self->head.prev = pos;
518 other->head.next = new_first;
519 new_first->prev = &other->head;
539 pos->next = &
self->head;
540 pos->prev =
self->head.prev;
541 self->head.prev->next = other->head.next;
542 self->head.prev = pos;
543 other->head.next = new_first;
544 new_first->prev = &other->head;
550 #endif // __cplusplus 558 #endif // picox_container_xintrusive_list_h_ static bool xilist_empty(const XIntrusiveList *self)
コンテナが空かどうかを返します
Definition: xintrusive_list.h:217
static void xilist_splice_front(XIntrusiveList *self, XIntrusiveList *other)
otherを先頭に連結します
Definition: xintrusive_list.h:437
#define X_SWAP(x, y, T)
型Tの変数として、x, yを交換します。
Definition: xutils.h:90
リストノードデータを格納するコンテナ
Definition: xintrusive_list.h:96
static XIntrusiveNode * xilist_front(const XIntrusiveList *self)
コンテナの先頭ノードを返します
Definition: xintrusive_list.h:237
static void xilist_init(XIntrusiveList *self)
コンテナを初期化します
Definition: xintrusive_list.h:187
双方向リンリストリストノード
Definition: xintrusive_list.h:87
static void xilist_transfer_back(XIntrusiveList *self, XIntrusiveList *other, XIntrusiveNode *pos)
末尾にotherの先頭要素からpos(pos自身も含む)までを転送します
Definition: xintrusive_list.h:531
static void xnode_unlink(XIntrusiveNode *node)
ノードのリンクを解除します
Definition: xintrusive_list.h:126
static void xilist_transfer_front(XIntrusiveList *self, XIntrusiveList *other, XIntrusiveNode *pos)
先頭にotherの先頭要素からpos(pos自身も含む)までを転送します
Definition: xintrusive_list.h:506
static void xnode_splice(XIntrusiveNode *prev, XIntrusiveNode *next, XIntrusiveList *list)
prev, next間にlistを連結します
Definition: xintrusive_list.h:172
static void xilist_push_front(XIntrusiveList *self, XIntrusiveNode *node)
ノードを先頭に追加します
Definition: xintrusive_list.h:379
static void xilist_move_back(XIntrusiveList *self, XIntrusiveNode *node)
ノードのリンクを解除してから末尾に追加します
Definition: xintrusive_list.h:422
static void xilist_clear(XIntrusiveList *self)
コンテナを空にします
Definition: xintrusive_list.h:207
static XIntrusiveNode * xilist_pop_front(const XIntrusiveList *self)
先頭ノードをコンテナから除去して返します
Definition: xintrusive_list.h:247
static void xnode_insert_next(XIntrusiveNode *p1, XIntrusiveNode *p2)
p1の前にp2を挿入します
Definition: xintrusive_list.h:148
static void xilist_splice_back(XIntrusiveList *self, XIntrusiveList *other)
otherを末尾に連結します
Definition: xintrusive_list.h:455
static void xilist_swap(XIntrusiveList *self, XIntrusiveList *other)
2つのリストの中身を入れ替えます
Definition: xintrusive_list.h:473
static void xilist_push_back(XIntrusiveList *self, XIntrusiveNode *node)
ノードを末尾に追加します
Definition: xintrusive_list.h:393
static size_t xilist_size(const XIntrusiveList *self)
ノード数を返します
Definition: xintrusive_list.h:351
static XIntrusiveNode * xilist_pop_back(const XIntrusiveList *self)
末尾ノードをコンテナから除去して返します
Definition: xintrusive_list.h:269
static XIntrusiveNode * xilist_back(const XIntrusiveList *self)
コンテナの末尾ノードを返します
Definition: xintrusive_list.h:259
#define xilist_foreach(list, ite)
コンテナ先頭から順方向走査します
Definition: xintrusive_list.h:332
static XIntrusiveNode * xilist_end(const XIntrusiveList *self)
コンテナの終端を指すノードを返します
Definition: xintrusive_list.h:227
static void xnode_insert_prev(XIntrusiveNode *p1, XIntrusiveNode *p2)
p1の後ろにp2を挿入します
Definition: xintrusive_list.h:136
static void xnode_replace(XIntrusiveNode *p1, XIntrusiveNode *p2)
p1のリンクをにp2に置換えます
Definition: xintrusive_list.h:160
static bool xilist_is_singular(const XIntrusiveList *self)
ノード数が1つかどうかを返します
Definition: xintrusive_list.h:366
static XIntrusiveNode * xilist_head(XIntrusiveList *self)
コンテナのルートノードのポインタを返します
Definition: xintrusive_list.h:197
static void xilist_move_front(XIntrusiveList *self, XIntrusiveNode *node)
ノードのリンクを解除してから先頭に追加しま。
Definition: xintrusive_list.h:407