home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / pipebuffer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  1.8 KB  |  76 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.    
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.     Boston, MA 02111-1307, USA.
  20.  
  21.     */
  22.  
  23. #ifndef __PIPEBUFFER_H__
  24. #define __PIPEBUFFER_H__
  25.  
  26. /*
  27.  * BC - Status (2002-03-08): PipeSegment, PipeBuffer
  28.  *
  29.  * None of these classes is considered part of the public API. Do NOT use it
  30.  * in your apps. These are part of the implementation of libartsflow's
  31.  * AudioSubSystem, and subject to change/disappearing due to optimization
  32.  * work.
  33.  */
  34.  
  35.  
  36. #include <list>
  37. namespace Arts {
  38.  
  39. class PipeSegment {
  40.     long _remaining;
  41.     char *currentpos, *buffer;
  42. public:
  43.     PipeSegment(long size, void *buffer);
  44.     ~PipeSegment();
  45.  
  46.     void *data();
  47.     long remaining();
  48.     void skip(long count);
  49. };
  50.  
  51. class PipeBuffer {
  52. protected:
  53.     std::list<PipeSegment *> segments;
  54.     long _size;
  55.  
  56. public:
  57.     PipeBuffer();
  58.     ~PipeBuffer();
  59.  
  60.     // reading
  61.     void *peek(long size);
  62.     void skip(long size);
  63.     long read(long size, void *buffer);
  64.     void unRead(long size, void *buffer);
  65.  
  66.     // writing
  67.     void write(long size, void *buffer);
  68.     void clear();
  69.  
  70.     // status
  71.     long size();
  72. };
  73. }
  74.  
  75. #endif
  76.