c++ 循环队列
【摘要】
#ifndef __CIRCLEQUEUE_H__#define __CIRCLEQUEUE_H__#include <stdlib.h>#include <string.h>#include <pthread.h> #undef CIRCLEQUEUE_DEBUG #include <an...
-
#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
文章来源: blog.csdn.net,作者:AI视觉网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/122389301
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)