GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gws::Buffer Class Reference

A buffer is used to read/write raw data buffers from/on files. More...

#include <Buffer.h>

Inheritance diagram for Gws::Buffer:

Public Types

enum  EStatus { kBad = BIT(1), kGood = BIT(2), kEoB = BIT(3), kFail = BIT(4), kCorrupt = BIT(5) }
 

Public Member Functions

 Buffer (UInt_t s=32 *KBYTE)
 Default size for a Buffer is 32 KBYTE. More...
 
virtual Bool_t Expand (UInt_t)
 Expand the actual size of the buffer. More...
 
UInt_t FreeSize () const
 it returns the number of free bytes to the end More...
 
Char_t * GetBuffer ()
 Pointer to the underlying array of chars. More...
 
bool IsBytes (Memory::EEndian) const
 
bool IsStatus (Buffer::EStatus)
 
UInt_t Offset () const
 it returns the current position in the buffer More...
 
virtual Bufferoperator<< (Char_t)
 
virtual Bufferoperator<< (UChar_t)
 
virtual Bufferoperator<< (Short_t)
 
virtual Bufferoperator<< (UShort_t)
 
virtual Bufferoperator<< (Int_t)
 
virtual Bufferoperator<< (UInt_t)
 
virtual Bufferoperator<< (Float_t)
 
virtual Bufferoperator<< (Double_t)
 
virtual Bufferoperator>> (Char_t &)
 
virtual Bufferoperator>> (UChar_t &)
 
virtual Bufferoperator>> (Short_t &)
 
virtual Bufferoperator>> (UShort_t &)
 
virtual Bufferoperator>> (Int_t &)
 
virtual Bufferoperator>> (UInt_t &)
 
virtual Bufferoperator>> (Float_t &)
 
virtual Bufferoperator>> (Double_t &)
 
virtual void Reset ()
 Reset means set all elements to 0 and the current position is 0. More...
 
virtual void Reset (UInt_t)
 
void SetBytes (Memory::EEndian)
 
UInt_t SetOffset (UInt_t off=0)
 change the current position. More...
 
void SetStatus (Buffer::EStatus)
 
UInt_t Size () const
 it returns the maximum number of bytes in this buffer More...
 
virtual ~Buffer ()
 

Static Public Member Functions

static BufferNew (Memory::EEndian e, UInt_t s=32 *KBYTE)
 copy n bytes from one buffer to another one More...
 

Protected Types

enum  EEndian { kLittle = 0, kBig = 1 }
 The adjectives big-endian and little-endian refer to which bytes are most significant in multi-byte data types and describe the order in which a sequence of bytes is stored in a computer’s memory. More...
 

Protected Member Functions

void DoAlloc (UInt_t)
 
TSystem * SystemROOT ()
 

Static Protected Member Functions

static void Copy (const Char_t *from, Char_t *to, Int_t size)
 copy the content from -> to More...
 
static void Delete (Char_t *p)
 
static void Delete (Short_t *p)
 
static void Delete (Int_t *p)
 
static void Delete (UChar_t *p)
 
static void Delete (UShort_t *p)
 
static void Delete (UInt_t *p)
 
static void Delete (Float_t *p)
 
static void Delete (Double_t *p)
 
static Int_t GetEndian ()
 
static bool IsBytes (Memory::EEndian e)
 check out the endian type of the running system More...
 
static Char_t * New (Char_t *p, Int_t nb=32 *KBYTE)
 To allocate a buffer that is set to 0 (some compilers don't do it) More...
 
static Short_t * New (Short_t *p, Int_t nb=32 *KBYTE)
 
static Int_t * New (Int_t *p, Int_t nb=32 *KBYTE)
 
static UChar_t * New (UChar_t *p, Int_t nb=32 *KBYTE)
 
static UShort_t * New (UShort_t *p, Int_t nb=32 *KBYTE)
 
static UInt_t * New (UInt_t *p, Int_t nb=32 *KBYTE)
 
static Float_t * New (Float_t *p, Int_t nb=32 *KBYTE)
 
static Double_t * New (Double_t *p, Int_t nb=32 *KBYTE)
 
static Char_t * New (Char_t *p, UInt_t nb=32 *KBYTE)
 
static Short_t * New (Short_t *p, UInt_t nb=32 *KBYTE)
 
static Int_t * New (Int_t *p, UInt_t nb=32 *KBYTE)
 
static Long_t * New (Long_t *p, UInt_t nb=32 *KBYTE)
 
static UChar_t * New (UChar_t *p, UInt_t nb=32 *KBYTE)
 
static UShort_t * New (UShort_t *p, UInt_t nb=32 *KBYTE)
 
static UInt_t * New (UInt_t *p, UInt_t nb=32 *KBYTE)
 
static Float_t * New (Float_t *p, UInt_t nb=32 *KBYTE)
 
static Double_t * New (Double_t *p, UInt_t nb=32 *KBYTE)
 
static void Swap (Short_t, Char_t *)
 the Swap members More...
 
static void Swap (UShort_t, Char_t *)
 
static void Swap (Int_t, Char_t *)
 
static void Swap (UInt_t, Char_t *)
 
static void Swap (Float_t, Char_t *)
 
static void Swap (Double_t, Char_t *)
 
static void Swap (Char_t *, Short_t &)
 
static void Swap (Char_t *, UShort_t &)
 
static void Swap (Char_t *, Int_t &)
 
static void Swap (Char_t *, UInt_t &)
 
static void Swap (Char_t *, Float_t &)
 
static void Swap (Char_t *, Double_t &)
 
static void Zero (Char_t *p, Int_t nb)
 fast initialization of the buffer at 0 More...
 
static void Zero (Short_t *p, Int_t nb)
 
static void Zero (Int_t *p, Int_t nb)
 
static void Zero (UChar_t *p, Int_t nb)
 
static void Zero (UShort_t *p, Int_t nb)
 
static void Zero (UInt_t *p, Int_t nb)
 
static void Zero (Float_t *p, Int_t nb)
 
static void Zero (Double_t *p, Int_t nb)
 
static void Zero (Char_t *p, UInt_t nb)
 
static void Zero (Short_t *p, UInt_t nb)
 
static void Zero (Int_t *p, UInt_t nb)
 
static void Zero (UChar_t *p, UInt_t nb)
 
static void Zero (UShort_t *p, UInt_t nb)
 
static void Zero (UInt_t *p, UInt_t nb)
 
static void Zero (Float_t *p, UInt_t nb)
 
static void Zero (Double_t *p, UInt_t nb)
 

Protected Attributes

Char_t * fBuffer
 
UInt_t fCurrent
 
Int_t fEndian
 
UInt_t fSize
 
Int_t fStatus
 

Detailed Description

A buffer is used to read/write raw data buffers from/on files.

It is an array of fSize bytes with a cursor on it. Stream operators are defined for some basic types.
By default, the size of the buffer is 32 kBYTE. For some reason, the allocation could failed in the constructor. In this case the kBad flags is set. Be sure your buffer is good after creating it before any readings/writings.

Author
Olivier Stezowski

Definition at line 43 of file Buffer.h.


The documentation for this class was generated from the following files: