multisource.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_MULTISOURCE_H
00012 #define _GEDDEI_MULTISOURCE_H
00013 
00014 #ifdef __GEDDEI_BUILD
00015 #include "multiplicative.h"
00016 #include "processorport.h"
00017 #else
00018 #include <geddei/multiplicative.h>
00019 #include <geddei/processorport.h>
00020 #endif
00021 using namespace Geddei;
00022 
00023 namespace Geddei
00024 {
00025 
00026 class MultiSink;
00027 
00038 class MultiSource: virtual public Multiplicative
00039 {
00040  //* Reimplementations from Multiplicative
00041  virtual void setSourceMultiplicity(const uint multiplicity);
00042 
00044 
00045  bool theDeferredConnect, theConnected;
00046  uint theDeferredBufferSize;
00047  MultiSink *theDeferredSink;
00049 
00050 protected:
00057  virtual ProcessorPort sourcePort(const uint i) = 0;
00058 
00063  virtual void connectCheck() const {}
00064 
00065 public:
00074  const bool deferConnect(MultiSink *sink, const uint bufferSize);
00075 
00082  void connect(MultiSink *sink, const uint bufferSize = 1);
00083 
00088  void disconnect();
00089 
00098  void operator>>=(MultiSink &sink) { connect(&sink); }
00099 
00106  void operator--() { disconnect(); }
00107 
00111  MultiSource() : theDeferredConnect(false), theConnected(false) {}
00112 };
00113 
00114 }
00115 
00116 #endif

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