60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
#ifndef IMAGE_LIST_H_
|
|
#define IMAGE_LIST_H_
|
|
|
|
#include "btree.h"
|
|
#include "queue.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
#define IMAGE_NAME_MAX 256
|
|
|
|
enum image_list_entry_type {
|
|
IMAGE_LIST_ENTRY_NONE = 0,
|
|
IMAGE_LIST_ENTRY_LEAF,
|
|
IMAGE_LIST_ENTRY_BUCKET,
|
|
};
|
|
|
|
struct image_list_entry {
|
|
enum image_list_entry_type e_type;
|
|
uint64_t e_hash;
|
|
union {
|
|
struct btree_node e_node;
|
|
struct queue_entry e_entry;
|
|
};
|
|
};
|
|
|
|
struct image_list_bucket {
|
|
struct image_list_entry b_base;
|
|
struct queue b_items;
|
|
};
|
|
|
|
struct image_list_leaf {
|
|
struct image_list_entry l_base;
|
|
char l_name[IMAGE_NAME_MAX];
|
|
};
|
|
|
|
struct image_list {
|
|
struct btree l_items;
|
|
};
|
|
|
|
struct image_list_iterator {
|
|
struct image_list_entry *it_cur;
|
|
struct image_list_leaf *it_leaf;
|
|
};
|
|
|
|
extern void image_list_init(struct image_list *list);
|
|
extern void image_list_cleanup(struct image_list *list);
|
|
|
|
extern void image_list_put(
|
|
struct image_list *list,
|
|
struct image_list_leaf *item);
|
|
extern struct image_list_leaf *image_list_get(
|
|
struct image_list *list,
|
|
const char *name);
|
|
|
|
extern void image_list_iterator_begin(
|
|
struct image_list_iterator *it,
|
|
struct image_list *list);
|
|
extern void image_list_iterator_move_next(struct image_list_iterator *it);
|
|
#endif
|