c++ 循环队列

x33g5p2x  于2022-01-09 转载在 C/C++  
字(0.8k)|赞(0)|评价(0)|浏览(229)
#ifndef __CIRCLEQUEUE_H__
#define __CIRCLEQUEUE_H__
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

#undef CIRCLEQUEUE_DEBUG

#include <android/log.h>
#define TRANSFER_LOG_TAG "CIRCLEQUEUE"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TRANSFER_LOG_TAG,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TRANSFER_LOG_TAG,__VA_ARGS__)

template <typename ElemType>
class CircleQueue {
public:
   CircleQueue(int capacity, const char *name, bool circulation);
   ~CircleQueue();
   bool isQueueFull();
   bool isQueueEmpty();
   bool enQueue(ElemType element);
   bool deQueue(ElemType &element);
   bool getLastQueue(ElemType &element);
   void Lock();
   void unLock();
   int getLength();
   int getCapacity();

private:
   char queue_name[128];
   ElemType *data;
   int m_queueCapacity;
   int m_queueLength;
   int readPos;
   int writePos;
   bool isCirculative;
   p

相关文章

微信公众号

最新文章

更多