xlconnectionreal.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Gav Wood                                        *
00003  *   gav@cs.york.ac.uk                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  ***************************************************************************/
00010 
00011 #ifndef _GEDDEI_XLCONNECTIONREAL_H
00012 #define _GEDDEI_XLCONNECTIONREAL_H
00013 
00014 #ifdef __GEDDEI_BUILD
00015 #include "buffer.h"
00016 #include "bufferreader.h"
00017 #include "xlconnection.h"
00018 #else
00019 #include <geddei/buffer.h>
00020 #include <geddei/bufferreader.h>
00021 #include <geddei/xlconnection.h>
00022 #endif
00023 using namespace Geddei;
00024 
00025 class BobPort;
00026 
00027 namespace Geddei
00028 {
00029 
00030 class Processor;
00031 
00040 class xLConnectionReal: public xLConnection
00041 {
00042  // Reimplementations from Connection
00043  friend class Processor;
00044 public:
00045  virtual const SignalTypeRef type();
00046 
00047  // Reimplementations from xLConnection
00048  friend class RLConnection;
00049 private:
00050  virtual void reset() { theBuffer.clear(); }
00051  virtual void sinkStopping();
00052  virtual void sinkStopped();
00053  virtual const uint elementsReady() const;
00054  virtual void waitForElements(const uint elements) const;
00055  virtual const BufferData readElements(const uint elements);
00056  virtual const BufferData peekElements(const uint elements);
00057  virtual void enforceMinimum(const uint elements);
00058  virtual BufferReader *newReader() { return new BufferReader(&theBuffer); }
00059  virtual void killReader();
00060  virtual void resurectReader();
00061  virtual const uint capacity() const { return theBuffer.size() / theType->scope(); }
00062  virtual const float filled() const { return 1.0 - float(theBuffer.elementsFree()) / float(theBuffer.size()); }
00063  virtual const bool plungeSync(const uint samples) const;
00064  
00065 protected:
00066  friend class BobPort;
00067  Buffer theBuffer;
00068  BufferReader *theReader;
00069 
00073  virtual const bool pullType() = 0;
00074 
00084  xLConnectionReal(Sink *newSink, const uint newSinkIndex, const uint bufferSize);
00085 
00089  ~xLConnectionReal();
00090 };
00091 
00092 }
00093 
00094 #endif

Generated on Fri Nov 10 21:58:26 2006 for Exscalibar by  doxygen 1.5.1