diff src/parallel_execution/context.h @ 130:2bb5e4f0fd35

Stackinterface
author ikkun
date Mon, 10 Oct 2016 20:19:26 +0900
parents 36ac17d37be4
children a4507906938c
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Fri Sep 30 17:50:27 2016 +0900
+++ b/src/parallel_execution/context.h	Mon Oct 10 20:19:26 2016 +0900
@@ -84,7 +84,7 @@
     LT,
 };
 
-enum UniqueData {
+enum DataType {
     Worker,
     Allocate,
     Tree,
@@ -113,7 +113,20 @@
     union Data **data;
 };
 
+struct QueueInterface {
+    enum Code put;
+    enum Code get;
+    enum Code isEmpty;
+};
+
+struct StackInterface {
+    enum Code push;
+    enum Code pop;
+    enum Code isEmpty;
+};
+
 union Data {
+    enum DataType type;
     struct Time {
         enum Code next;
         double time;
@@ -145,7 +158,28 @@
         struct Element* first;
         struct Element* last;
         int count;
+        struct QueueInterface* i;
+        enum Code next;
     } queue;
+    struct Stack {
+        union StackSelf* stack;
+        union Data* data;
+        enum Code push;
+        enum Code pop;
+        enum Code isEmpty;
+        enum Code next;
+    };
+    union StackSelf {
+        struct SingleLinkedStack {
+            struct Stack i;
+            struct Element* top;
+        } singleLinekedStack;
+        struct ArrayStack {
+            int size;
+            int limit;
+            struct Element* array;
+        }
+    };
     struct Element {
         union Data* data;
         struct Element* next;
@@ -167,8 +201,6 @@
         int result;
     } traverse;
     struct Node {
-        // need to tree
-        enum Code next;
         int key; // comparable data segment
         union Data* value;
         struct Node* left;