Minor fixes

Dependencies:   LPS25H hts221

Fork of Coursework by Group PAG

Queue.cpp

Committer:
pburtenshaw
Date:
2017-05-04
Revision:
43:4ddc392dd0cc
Parent:
42:4e0a96b52e65

File content as of revision 43:4ddc392dd0cc:

#include "Queue.h"

Queue::Queue(int i){
    front = 0;
    back = 0;
    isFull = false;
    storage = new Measure[i];
    }
    
Queue::Queue(){
    front = 0;
    back = 0;
    isFull = false;
    storage = new Measure[maxSize];
}
    
void Queue::push(Reading r){
    //if it is full then the front must move. if front is max then it must become 0
    if (isFull == true){
        if (front == maxSize-1){
            front = 0;
            }
        else{
            front = front +1; 
            }
        
    }
    back = back +1;
    storage[back] = r;
    //otherwise the queue is full
    else{
        
    }
}
void Queue::read(int nR){// where nR is the number to read, if REAL ALL is typed then the method will be called by something like queue.read(Queue.count).
        if (front>back){
          for( int a = back; a >=0; a = a - 1 ) {
          //print or cout? do until end of loop - think about how to loop over
            }
        }
        for( int a = maxSize-1; a >front; a = a + 1 ) {
          //print or cout? do until end of loop - think about how to loop over
            }
        
        
    
}
void Queue::deleteRecords(int nD){ //as above but nD is number to delete
    
    
}