SafeBuf

Files CCore/inc/SafeBuf.h CCore/src/SafeBuf.cpp

This class is used to allocate file buffers. It provides a buffer of required length, but if the memory cannot be allocated, the small safeguard internal buffer is used.


class SafeBuf : NoCopy
 {
   static const ulen SafeLen = 32 ;
   
   char *ptr;
   ulen len;
   
   char safebuf[SafeLen];
 
  public:
  
   explicit SafeBuf(ulen len);
   
   ~SafeBuf();

   char * getPtr() const { return ptr; }
 
   ulen getLen() const { return len; }
 };