// ========================================= // | SilverMUD Server - queues.h | // | Copyright (C) 2023, Barra Ó Catháin | // | See end of file for copyright notice. | // ========================================= #ifndef QUEUES_H #define QUEUES_H #include "data-type.h" #include struct Queue { size_t itemCount; enum DataType type; struct QueueNode * front; struct QueueNode * back; }; struct QueueNode { struct QueueNode * next; void * data; }; // Functions: // ========== struct Queue * createQueue(enum DataType type); int destroyQueue(struct Queue * queue); int destroyQueueAndContents(void (*deallocationFunction)(void *), struct Queue * queue); void * peekFromQueue(struct Queue * queue); size_t popFromQueue(struct Queue * queue); size_t pushToQueue(enum DataType type, void * data, struct Queue * queue); size_t popFromQueueAndDestroy(void (*deallocationFunction)(void *), struct Queue * queue); #endif // ============================================== // | End of queues.h, copyright notice follows. | // ============================================== // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see .