view src/synchronizedQueue/synchronizedQueueContext.h @ 36:240c045ebab2

Add normal queue
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Fri, 15 May 2015 19:17:23 +0900
parents 5d9f74220506
children ce9fde200f3e
line wrap: on
line source

/* Context definition for  list example */

#define ALLOCATE_SIZE 100

enum Code {
    Code1,
    Code2,
    Code3,
    Code4,
    Code5,
    Code6,
    Allocator,
    Put,
    Traverse,
    Get,
    Exit,
};

enum UniqueData {
    Allocate,
    Queue,
};

struct Context {
    int codeNum;
    __code (**code) (struct Context *);
    void* heap_start;
    void* heap;
    long dataSize;
    int dataNum;
    union Data* head;
    union Data** data;
};

union Data {
    long count;
    struct Queue {
        union Data* head;
        union Data* tail;
        union Data* current;
        int   dataSize;
    } queue;
    struct Element {
        int value;
        union Data* next;
    } element;
    struct Allocate {
        long size;
        enum Code next;
        enum Code after_put;
        enum Code after_get;
        enum Code after_traverse;
    } allocate;
};