Queue

Revision:
0:a09b38fe65c9
diff -r 000000000000 -r a09b38fe65c9 Queue.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Queue.cpp	Tue Jun 04 19:31:36 2019 +0000
@@ -0,0 +1,61 @@
+#include "Queue.h"
+
+int     PositionRead=0;
+int     PositionPlace=0;
+char    Queue[2000];
+char    Output;
+ 
+QUEUE::QUEUE()
+{
+    
+}
+ 
+bool QUEUE::Put(char Input)
+{
+    if(PositionPlace<1000){
+        Queue[PositionPlace]=Input;
+        PositionPlace++;
+        return true;
+    } else {
+        return false;
+    }
+}
+
+bool QUEUE::Available()
+{
+    if(PositionPlace>PositionRead){
+        return true;
+    } else {
+        return false;
+    }
+}
+
+void QUEUE::Flush()
+{
+    for(int i=0;i<1000;i++){
+        Queue[i]=0x00;
+    }
+    PositionPlace=0;
+    PositionRead=0;  
+}
+ 
+char QUEUE::Get()
+{
+    if(PositionPlace>PositionRead){
+        Output=Queue[PositionRead];  
+        PositionRead++;  
+        return Output; 
+    } else {
+        return 0x00;
+    }
+}
+
+int QUEUE::Number()
+{
+    return(PositionPlace-PositionRead);
+}
+ 
+
+
+ 
+ 
\ No newline at end of file