00001 #ifndef CLASSLIB_WRITE_BUFFER_H 00002 # define CLASSLIB_WRITE_BUFFER_H 00003 00004 //<<<<<< INCLUDES >>>>>> 00005 00006 # include "classlib/sysapi/system.h" 00007 # include "classlib/sysapi/IOTypes.h" 00008 00009 namespace lat { 00010 //<<<<<< PUBLIC DEFINES >>>>>> 00011 //<<<<<< PUBLIC CONSTANTS >>>>>> 00012 //<<<<<< PUBLIC TYPES >>>>>> 00013 //<<<<<< PUBLIC VARIABLES >>>>>> 00014 //<<<<<< PUBLIC FUNCTIONS >>>>>> 00015 //<<<<<< CLASS DECLARATIONS >>>>>> 00016 00025 class WriteBuffer 00026 { 00027 public: 00028 enum { DEFAULT_SIZE = 4096 }; //< Default buffer size. 00029 WriteBuffer (IOSize bufsize = DEFAULT_SIZE); 00030 WriteBuffer (const WriteBuffer &x); 00031 WriteBuffer &operator= (const WriteBuffer &x); 00032 ~WriteBuffer (void); 00033 00034 IOSize size (void) const; 00035 IOSize capacity (void) const; 00036 00037 unsigned char * dirty (void) const; 00038 unsigned char * buffer (void) const; 00039 unsigned char * current (void) const; 00040 unsigned char * limit (void) const; 00041 00042 void reset (void); 00043 00044 void bump (IOSize n); 00045 void put (const void *data, IOSize n); 00046 void taken (IOSize n); 00047 00048 private: 00049 unsigned char *m_buffer; 00050 unsigned char *m_current; 00051 unsigned char *m_limit; 00052 unsigned char *m_dirty; 00053 }; 00054 00055 //<<<<<< INLINE PUBLIC FUNCTIONS >>>>>> 00056 //<<<<<< INLINE MEMBER FUNCTIONS >>>>>> 00057 00058 } // namespace lat 00059 #endif // CLASSLIB_WRITE_BUFFER_H