#include <stdio.h>#include "base.h"#include "icommand.h"#include "iqueue.h"#include "linkedlist.h"#include "linkedqueue.h"static void LinkedQueue_push(IQueue*, ICommand*);static ICommand* LinkedQueue_pop(IQueue*);static int LinkedQueue_empty(IQueue*);LinkedQueue* LinkedQueue_construct(void* addr){if (addr == NULL) {return NULL;}LinkedQueue* linkedQueue = addr;linkedQueue->list = &new(LinkedList)->ilist;linkedQueue->push = LinkedQueue_push;linkedQueue->pop = LinkedQueue_pop;linkedQueue->empty = LinkedQueue_empty;return linkedQueue;}void LinkedQueue_destruct(LinkedQueue* linkedQueue){LinkedList* linkedList =container_of(linkedQueue->list, LinkedList, ilist);delete(LinkedList, linkedList);}void LinkedQueue_push(IQueue* iqueue, ICommand* command){LinkedQueue* linkedQueue = container_of(iqueue, LinkedQueue, iqueue);linkedQueue->list->push(linkedQueue->list, command);}ICommand* LinkedQueue_pop(IQueue* iqueue){LinkedQueue* linkedQueue = container_of(iqueue, LinkedQueue, iqueue);return linkedQueue->list->pop(linkedQueue->list);}int LinkedQueue_empty(IQueue* iqueue){LinkedQueue* linkedQueue = container_of(iqueue, LinkedQueue, iqueue);return linkedQueue->list->empty(linkedQueue->list);}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。