Panda3D
Loading...
Searching...
No Matches
ringbuffer.h
1#ifndef __RINGBUFFER_GM_H__
2#define __RINGBUFFER_GM_H__
3
4#include "membuffer.h"
5
6class EXPCL_PANDA_NATIVENET RingBuffer : protected MemBuffer {
7protected:
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
19public:
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__
MemBuffer(void)
default constructor
Definition membuffer.I:31
void Compress(void)
Try and do a intelegent compress of the data space the algorithem is really stupid right know.
Definition ringbuffer.I:87
bool Put(const char *data, size_t len)
Adds Data to a ring Buffer Will do a compress if needed so pointers suplied by Get Call are no longer...
Definition ringbuffer.I:104
size_t BufferAvailabe(void)
Will report amount of data that is contiguas that can be writen at the location returned by GetBuffer...
Definition ringbuffer.I:42
size_t AmountBuffered(void)
Will report the number of unread chars in buffer.
Definition ringbuffer.I:32
bool Get(char *data, size_t len)
will copy the data .
Definition ringbuffer.I:136
void ResetContent(void)
Throw away all inread information.
Definition ringbuffer.I:51
void FullCompress(void)
Force a compress of the data.
Definition ringbuffer.I:67