diff src/llrb/llrbContext.h @ 19:9302b1a48008

add llrb
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 21 Apr 2015 22:36:23 +0900
parents
children 324c44f2076f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/llrb/llrbContext.h	Tue Apr 21 22:36:23 2015 +0900
@@ -0,0 +1,41 @@
+/* Context definition for llrb example */
+
+enum Code {
+    Code1,
+    Code2,
+    Allocate,
+    Put,
+    Insert,
+    Exit,
+};
+
+enum Color {
+    Red,
+    Black,
+};
+
+struct Context {
+    int codeSize;
+    __code (**code) (struct Context *);
+    void* heap;
+    union Data* root;
+    int dataSize;
+    union Data **data;
+};
+
+union Data {
+    struct Node {
+        int key;
+        int value;
+        enum Color color;
+        union Data* left;
+        union Data* right;
+    } node;
+    struct Allocate {
+        long size;
+        enum Code next;
+        enum Code after_put;
+        int key;
+        int value;
+    } allocate;
+};