Panda3D

membuffer.h

00001 #ifndef __MEMBUFFER_GM_H__
00002 #define __MEMBUFFER_GM_H__
00003 // RHH
00004 ////////////////////////////////////////////////////////////////////
00005 //   Class : GmMemBuf
00006 // Description :    this a base class designed to be used to for items that will 
00007 //                  share portions of a memorty buufer and want to avoid copying the data
00008 //
00009 //                  Use if the class wants ot allow for refrence in place of data arrays..
00010 //                  ** be carefull could be dangerous **
00011 //
00012 //                  GmCoreMessage
00013 //                  GmRingBuffer
00014 //
00015 //
00016 ////////////////////////////////////////////////////////////////////
00017 class EXPCL_PANDA_NATIVENET MemBuffer
00018 {
00019 public:
00020     inline      MemBuffer(void);
00021     inline      MemBuffer(size_t len);
00022     inline      MemBuffer(char * data, size_t len);
00023     virtual ~MemBuffer();
00024     inline void SetBuffer(char * data, size_t len);
00025     inline void GrowBuffer(size_t len);
00026     inline size_t  GetBufferSize(void ) const;
00027     inline char * GetBuffer(void);
00028     inline const char * GetBuffer(void) const;
00029     inline bool InBufferRange(char * );
00030 protected:
00031     bool        _BufferLocal;  // indicates responsibility of managment of the data
00032     size_t          _BufferLen; // the length of the data
00033     char    *   _Buffer;        // the data
00034 
00035     inline void ClearBuffer(void);
00036     inline void AllocBuffer(size_t len);
00037 };
00038 
00039 
00040 #include "membuffer.i"
00041 
00042 
00043 #endif //__MEMBUFFER_GM_H__
00044 
 All Classes Functions Variables Enumerations