#include <iostream>
#include <mutex>
+#include "IoTRMIUtil.hpp"
+
/** Class ConcurrentLinkedListQueue is a queue that can handle
* concurrent requests and packets for IoT communication via socket.
* <p>
- * It stores object through a void pointer.
+ * It stores object through a char pointer.
*
* @author Rahmadi Trimananda <rtrimana @ uci.edu>
* @version 1.0
using namespace std;
-mutex mtx;
+mutex queueMutex;
class Node {
private:
Node* next;
- void* value;
+ char* value;
+ int length;
public:
- Node(void* val);
+ Node(char* val, int len);
~Node();
- void* getValue();
+ char* getValue();
+ int getLength();
Node* getNext();
void setNext(Node* nxt);
public:
ConcurrentLinkedListQueue();
~ConcurrentLinkedListQueue();
- void enqueue(void* value); // Enqueue to tail
- void* dequeue(); // Dequeue from tail
+ void enqueue(char* value, int length); // Enqueue to tail
+ char* dequeue(); // Dequeue from tail
+ char* deQAndGetLength(int* length); // Dequeue from tail and return length
};
#endif