|##########|
|#MAGIC   #|CKOLFLFN
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x--x----xx-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x----xxxxx-xx---
|##########|
DEFINITION MODULE OBuffers;

FROM Resources IMPORT ContextPtr;

  TYPE
    BuffNodePtr  = HIDDEN;

  PROCEDURE CleanUp;

  EXCEPTION BufferEmpty : "Buffer allready empty";

  DEFINITION MODULE Queues(type : ANYPTR);

  TYPE
    Condition = PROCEDURE(n : type):BOOLEAN;
    Destructor= PROCEDURE(n : type);

    Queue     = POINTER TO OBJECT
                  first : BuffNodePtr;
                  num   : INTEGER;

                  CONSTRUCTOR Create(con : ContextPtr := NIL);
                  DESTRUCTOR Delete;

                  METHOD Put(n : type);
                  METHOD Get():type;

                  METHOD Destruct;

                  METHOD RemoveAll(des : Destructor := NIL);

                  METHOD RemoveIF(if : Condition;des : Destructor := NIL);

                  METHOD Remove(n : type);

                  METHOD empty():BOOLEAN;
                END;

  END Queues;

  DEFINITION MODULE Stacks(type : ANYPTR);

  TYPE
    Condition = PROCEDURE(n : type):BOOLEAN;
    Destructor= PROCEDURE(n : type);

    StackNode = HIDDEN;
    Stack     = POINTER TO OBJECT
                  first : BuffNodePtr;
                  num   : INTEGER;

                  CONSTRUCTOR Create(con : ContextPtr := NIL);
                  DESTRUCTOR Delete;

                  METHOD Put(n : type);
                  METHOD Get():type;

                  METHOD Destruct;

                  METHOD RemoveAll(des : Destructor := NIL);

                  METHOD RemoveIF(if : Condition;des : Destructor := NIL);

                  METHOD Remove(n : type);

                  METHOD empty():BOOLEAN;
                END;

  END Stacks;

END OBuffers.

