Group PAG / Mbed OS PAG-CourseWork-NicksEdits

Dependencies:   LPS25H hts221

Fork of Coursework by Group PAG

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MyQueue.cpp Source File

MyQueue.cpp

00001 #include "MyQueue.h"
00002 
00003 
00004 MyQueue::MyQueue(){
00005     maxSize = 120;
00006     front = 0;
00007     back = 0;
00008     isFull = false;
00009     storage = new Reading[maxSize];
00010 }
00011     
00012 void MyQueue::push(Reading r){
00013     //if it is full then the front must move. if front is max then it must become 0
00014     if (isFull == true){
00015         if (front == maxSize-1){
00016             front = 0;
00017             }
00018         else{
00019             front = front +1; 
00020             }
00021         back = back +1;
00022         storage[back] = r;        
00023     }
00024 
00025     //otherwise the MyQueue is full
00026     else {
00027         
00028     }
00029 }
00030 void MyQueue::read(int nR){// where nR is the number to read, if REAL ALL is typed then the method will be called by something like MyQueue.read(MyQueue.count).
00031         if (front>back){
00032           for( int a = back; a >=0; a = a - 1 ) {
00033           //print or cout? do until end of loop - think about how to loop over
00034            }
00035         }
00036         for( int a = maxSize-1; a >front; a = a + 1 ) {
00037           //print or cout? do until end of loop - think about how to loop over
00038         }
00039 }
00040 
00041 void MyQueue::deleteRecords(int nD){ //as above but nD is number to delete
00042     
00043     
00044 }