提交 | 用户 | age
|
4b03ae
|
1 |
#pragma once
|
Q |
2 |
class CMyCircularBuf
|
|
3 |
{
|
|
4 |
public:
|
|
5 |
CMyCircularBuf();
|
|
6 |
~CMyCircularBuf();
|
|
7 |
CMyCircularBuf(int nCapicity);
|
|
8 |
CCriticalSection m_critial1;
|
|
9 |
int nmCapacity; //容量
|
|
10 |
char * pBuffer;
|
|
11 |
int WriteP;
|
|
12 |
int ReadP;
|
|
13 |
int nDataSize;
|
|
14 |
bool bIsEmpty;
|
|
15 |
bool bIsFull;
|
|
16 |
public:
|
|
17 |
int Alloc(int nCapicity);
|
|
18 |
int GetCapicity();
|
|
19 |
int GetNextWriteP(int nOffset);
|
|
20 |
int GetNextReadP(int nOffset);
|
|
21 |
int GetTailRoomSize();
|
|
22 |
int GetTailDataSize();
|
|
23 |
int GetLeftRoomSize();
|
|
24 |
int GetDataSize();
|
|
25 |
char * GetWriteBuffer(int * LeftRoomSize);
|
|
26 |
int ReleaseWriteBuffer(int AddSize);
|
|
27 |
char * GetReadBuffer(int * DataSize);
|
|
28 |
int ReleaseReadBuffer(int DelSize);
|
|
29 |
bool IsEmpty(){return bIsEmpty;}
|
|
30 |
bool IsFull(){return bIsFull;}
|
|
31 |
int PushIn(void * pData,int Size);
|
|
32 |
int CopyData(void *pData,int Size);
|
|
33 |
int DelData(int Size);
|
|
34 |
int PopOut(void * pData,int Size);
|
|
35 |
}; |