Panda3D
 All Classes Functions Variables Enumerations
ringbuffer_slide.h
00001 #ifndef __RINGBUFFER_GM_H__
00002 #define __RINGBUFFER_GM_H__
00003 ////////////////////////////////////////////
00004 
00005 // RHH
00006 ////////////////////////////////////////////////////////////////////
00007 //   Class : GmRingBuffer
00008 // Description :    This is an implemention of the membuffer with ring 
00009 //                  buffer interface on it....  
00010 //                  
00011 //                  Main target right know is base class for network
00012 //                  stream buffering both input and output
00013 //                  
00014 //  see         BufferedReader_Gm
00015 //              BufferedWriter_Gm
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 #include "membuffer.h"
00019 class   RingBuffer_Slide   : protected MemBuffer
00020 {
00021 protected:
00022     size_t          _StartPos;
00023     size_t          _EndPos;
00024     inline char *   GetMessageHead(void);
00025     inline char *   GetBufferOpen(void);
00026     inline void ForceWindowSlide(void);
00027 #define FastGetMessageHead() (_Buffer+_StartPos)
00028 #define FastAmountBeffered() (_EndPos - _StartPos)
00029 
00030 inline bool PutFast(const char * data, size_t len);
00031 
00032 public:
00033     inline size_t       AmountBuffered(void);
00034     inline size_t      BufferAvailabe(void);
00035     inline void     ResetContent(void);
00036 
00037     inline RingBuffer_Slide(size_t in_size = 4096);
00038     inline void FullCompress(void);
00039     inline void Compress(void);
00040     inline bool Put(const char * data, size_t len);
00041     inline bool Get(char * data, size_t len);
00042 };
00043 
00044 #include "ringbuffer_slide.i"
00045 
00046 #endif //__RINGBUFFER_GM_H__
00047 
00048 
 All Classes Functions Variables Enumerations