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_PROCESSORPORT_H 00012 #define _GEDDEI_PROCESSORPORT_H 00013 00014 namespace Geddei 00015 { 00016 00017 class Processor; 00018 class MultiProcessor; 00019 00032 class ProcessorPort 00033 { 00034 friend class Processor; 00035 00036 Processor *theParent; 00037 uint thePort, theBufferSize; 00038 00047 ProcessorPort(Processor *parent, const uint port, const uint bufferSize = 1): theParent(parent), thePort(port), theBufferSize(bufferSize) {} 00048 00049 public: 00067 ProcessorPort &setSize(const uint bufferSize); 00068 00086 void share() const; 00087 00106 void split() const; 00107 00125 void connect(const ProcessorPort &input) const; 00126 00127 void connect(MultiProcessor &input) const; 00128 00143 void disconnect() const; 00144 00162 void operator>>=(const ProcessorPort &input) const { connect(input); } 00163 00184 void operator>>=(MultiProcessor &input) const { connect(input); } 00185 00200 void operator--(int) const { disconnect(); } 00201 }; 00202 00203 } 00204 00205 #endif