Panda3D
ringbuffer.h
1 #ifndef __RINGBUFFER_GM_H__
2 #define __RINGBUFFER_GM_H__
3 
4 #include "membuffer.h"
5 
6 class EXPCL_PANDA_NATIVENET RingBuffer : protected MemBuffer {
7 protected:
8  size_t _StartPos;
9  size_t _EndPos;
10  inline char *GetMessageHead(void);
11  inline char *GetBufferOpen(void);
12  inline void ForceWindowSlide(void);
13 
14 #define FastGetMessageHead() (_Buffer + _StartPos)
15 #define FastAmountBeffered() (_EndPos - _StartPos)
16 
17  inline bool PutFast(const char * data, size_t len);
18 
19 public:
20  inline size_t AmountBuffered(void);
21  inline size_t BufferAvailabe(void);
22  inline void ResetContent(void);
23 
24  inline RingBuffer(size_t in_size = 4096);
25  inline void FullCompress(void);
26  inline void Compress(void);
27  inline bool Put(const char * data, size_t len);
28  inline bool Get(char * data, size_t len);
29 };
30 
31 #include "ringbuffer.I"
32 
33 #endif //__RINGBUFFER_GM_H__