diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-19 22:43:32 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-19 22:43:32 +0200 |
commit | 6a1589a2a4549287b6186cdfc0e62a6b0f54603b (patch) | |
tree | e15d00262515727fca6ad72e409a7b6511c87f04 /src/mds-colour.h | |
parent | m (diff) | |
download | mds-6a1589a2a4549287b6186cdfc0e62a6b0f54603b.tar.gz mds-6a1589a2a4549287b6186cdfc0e62a6b0f54603b.tar.bz2 mds-6a1589a2a4549287b6186cdfc0e62a6b0f54603b.tar.xz |
work on mds-colour and list alternative to hash table
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-colour.h | 71 |
1 files changed, 68 insertions, 3 deletions
diff --git a/src/mds-colour.h b/src/mds-colour.h index 7820c76..49b07ec 100644 --- a/src/mds-colour.h +++ b/src/mds-colour.h @@ -21,6 +21,74 @@ #include "mds-base.h" +#include <stdint.h> + + + +/** + * Data structure for colour + */ +typedef struct colour +{ + /** + * The value of the red channel + */ + uint64_t red; + + /** + * The value of the green channel + */ + uint64_t green; + + /** + * The value of the blue channel + */ + uint64_t blue; + + /** + * The number of bytes with which + * each channel is encoded + */ + int bytes; + +} colour_t; + + +/** + * Slot for a colour in a list of colours + */ +typedef struct colour_slot +{ + /** + * The name of the colour, `NULL` if the slot is unused + */ + char* name; + + /** + * The index of the next unused slot, + * only used on unused slot + */ + size_t next_unused; + + /** + * The index of the previous unused slot, + * only used on unused slot + */ + size_t prev_unused; + + /** + * The hash of `name` + */ + size_t name_hash; + + /** + * The value of the colour + */ + colour_t colour; + +} colour_slot_t; + + /** * Handle the received message @@ -29,7 +97,6 @@ */ int handle_message(void); - /** * Handle the received message after it has been * identified to contain `Command: list-colours` @@ -42,7 +109,6 @@ int handle_message(void); int handle_list_colours(const char* recv_client_id, const char* recv_message_id, const char* recv_include_values); - /** * Handle the received message after it has been * identified to contain `Command: get-colour` @@ -54,7 +120,6 @@ int handle_list_colours(const char* recv_client_id, const char* recv_message_id, */ int handle_get_colour(const char* recv_client_id, const char* recv_message_id, const char* recv_name); - /** * Handle the received message after it has been * identified to contain `Command: set-colour` |