Fixed compiler for Java code generation (not heavily tested yet, but fixes include...
[iot2.git] / iotjava / iotrmi / C++ / ConcurrentLinkedListQueue.hpp
index e18e5e44f4991da763655a996dc2ae1b529438bf..20073236b629d05d70ed2b27a975d11a37f0b114 100644 (file)
@@ -3,10 +3,12 @@
 #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);
 
@@ -42,7 +46,8 @@ class ConcurrentLinkedListQueue {
        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