#include <iostream>
#include <assert.h>
#include "coda.h"
using namespace std;
Coda::Coda(){
creaCoda();
}
Coda::~Coda(){
}
void Coda::creaCoda(){
testa = 0;
lunghezza = 0;
}
boolean Coda::codaVuota(){
return (lunghezza==0);
}
tipoelem Coda::leggiCoda(){
assert(!codaVuota());
return (elementi[testa]);
}
void Coda::fuoriCoda(){
if (!codaVuota()){
testa = (testa + 1) % maxlungcoda;
lunghezza--;
}
}
void Coda::inCoda(tipoelem dato){
if (lunghezza<maxlungcoda){
elementi[(testa+lunghezza) % maxlungcoda] = dato;
lunghezza++;
}
}