-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathByteQueue.h
More file actions
30 lines (24 loc) · 819 Bytes
/
ByteQueue.h
File metadata and controls
30 lines (24 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef ByteQueue_H
#define ByteQueue_H
#include <stdint.h>
typedef struct ByteQueue {
struct ByteQueue_node* right;
struct ByteQueue_node* left;
uint64_t size;
void (*append_right)(struct ByteQueue* self, uint8_t value);
void (*append_left)(struct ByteQueue* self, uint8_t value);
uint8_t (*pop_right)(struct ByteQueue* self);
uint8_t (*pop_left)(struct ByteQueue* self);
uint8_t (*peek_right)(struct ByteQueue* self);
uint8_t (*peek_left)(struct ByteQueue* self);
void (*free)(struct ByteQueue* self);
void (*print)(struct ByteQueue* self);
void (*print_hex)(struct ByteQueue* self);
} ByteQueue;
typedef struct ByteQueue_node {
uint8_t value;
struct ByteQueue_node* right;
struct ByteQueue_node* left;
} ByteQueue_node;
ByteQueue Byte_Queue();
#endif