#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
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/jacke121/article/details/122389301
内容来源于网络,如有侵权,请联系作者删除!