-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLexiQueue.h
More file actions
45 lines (39 loc) · 888 Bytes
/
LexiQueue.h
File metadata and controls
45 lines (39 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef LEXIQUEUE_H_
#define LEXIQUEUE_H_
#pragma once
#include "MessageFormat.h"
#include <cstdlib>
#include <queue>
#include<iostream>
#include<stdio.h>
using namespace std;
class CompareMessages{
public:
bool operator()(Packet& m1,Packet& m2){
if(m2.SEQ < m1.SEQ) return true;
if(m2.SEQ == m1.SEQ && m2.ORIGIN < m1.ORIGIN) return true;
return false;
}
};
class LexiQueue
{
protected:
priority_queue<Packet, vector<Packet>, CompareMessages> pq;
priority_queue<Packet, vector<Packet>, CompareMessages> tempq;
public:
LexiQueue(void);
~LexiQueue(void);
Packet top();
Packet remove(int origin);
Packet remove(int origin,long seq);
bool add(Packet in);
int size();
bool isEmpty();
bool updateTorumQ(int **quorum,int qsize,int ID);
bool equalsTo(Packet m1, Packet m2);
bool contains(int origin,long seq);
void displayContents();
};
class BlockingQueue{
};
#endif