00001 /*-------------------------------------------------------------------- 00002 * 00003 * (C) Copyright Koninklijke Philips Electronics NV 2006. 00004 * All rights reserved. This software is licensed under the terms of 00005 * version 2.1 of the GNU Lesser General Public License as published 00006 * by the Free Software Foundation. For licensing and warranty 00007 * information, see the file COPYING in the main directory. 00008 * 00009 *------------------------------------------------------------------*/ 00010 00011 #ifndef PORT_BASE_H 00012 #define PORT_BASE_H 00013 00014 #include "connector.h" 00015 00016 class FifoBase; 00017 class Component; 00018 00019 00020 class PortBase : public Connector 00021 { 00022 public: 00023 PortBase(const IdBase& n); 00024 00025 Component* parentComponent() const; 00026 }; 00027 00028 00029 class InPortBase : public PortBase 00030 { 00031 public: 00032 InPortBase(const IdBase& n, Connector& c); 00033 00034 FifoBase* getSrcFifo() const; // get src fifo or 0 if src is inport 00035 InPortBase* getSrcPort() const; // get src inport or 0 if src is fifo 00036 InPortBase* getDstPort(unsigned int i=0) const; // get dst inport or 0 if process port 00037 00038 private: 00039 friend void insert(Component* c, InPortBase* i); 00040 }; 00041 00042 00043 class OutPortBase : public PortBase 00044 { 00045 public: 00046 OutPortBase(const IdBase& n, Connector& c); 00047 00048 FifoBase* getDstFifo(unsigned int i=0) const; // get dst fifo or 0 00049 OutPortBase* getDstPort(unsigned int i=0) const; // get dst outport or 0 00050 OutPortBase* getSrcPort() const; // get src outport or 0 00051 00052 private: 00053 friend void insert(Component* c, OutPortBase* o); 00054 }; 00055 00056 00057 #endif