Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

ByteFIFO.h

00001 // See the file LICENSE in the some directory as this file for legal
00002 // notices about this software.   
00003 // $Id: ByteFIFO_8h-source.html,v 1.9 2001/10/10 20:40:58 sandro Exp $
00004 #ifndef DEV_W3_ORG__2001_BLINDFOLD_SRC_BYTEFIFO_H
00005 #define DEV_W3_ORG__2001_BLINDFOLD_SRC_BYTEFIFO_H
00006 #include "config.h"
00007 
00008 #include "ByteSink.h"
00009 #include "ByteSource.h"
00010 
00019 class ByteFIFO : public ByteSink, public ByteSource {
00020       
00021 public:
00022 
00023     // STANDARD MEMBER FUNCTIONS
00025     ByteFIFO(const size_t initialAllocation = 256);
00026     ByteFIFO(const ByteFIFO& other);
00027     const ByteFIFO& operator=(const ByteFIFO& other);
00028     bool operator==(const ByteFIFO& other) const;
00029     bool operator<(const ByteFIFO& other) const;
00030     size_t hash() const;
00031     friend std::ostream& operator<<(std::ostream& s, const ByteFIFO& me);
00032     std::ostream& print_to(std::ostream& stream) const; 
00033     ~ByteFIFO();       
00034 
00035     // CLASS-SPECIFIC PUBLIC INTERFACE
00036 
00037     virtual size_t read(void* byteBuffer, size_t maxBytes);
00038     virtual void write(const void* byteBuffer, size_t numBytes);
00039     virtual void* peek();
00040     virtual size_t size() { return nextToWrite - nextToRead; }
00041     virtual void skip(size_t bytes);
00042 
00043 private:
00044 
00045     char *buffer;
00046     size_t bytesAllocated;
00047     char *nextToRead;
00048     char *nextToWrite;
00049 
00050     void makeRoom(size_t additionalBytes);
00051 };     
00052 
00053 
00054 STANDARD_EXTERNAL(ByteFIFO)
00055 
00056 #endif   /* BYTEFIFO */  // -*-C++-*-

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.