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 // $Id: component.h,v 1.3 2006/02/06 12:58:07 kock Exp $ 00012 #ifndef COMPONENT_H 00013 #define COMPONENT_H 00014 00015 #include "idbase.h" 00016 #include <vector> 00017 00018 class InPortBase; 00019 class OutPortBase; 00020 00021 class Component : public IdBase 00022 { 00023 public: 00024 Component(const IdBase& n); 00025 00026 Component* parentComponent() const; 00027 00028 unsigned int nrInPorts() const; 00029 unsigned int nrOutPorts() const; 00030 00031 InPortBase* getInPort(unsigned int i) const; 00032 OutPortBase* getOutPort(unsigned int i) const; 00033 00034 virtual const char* type() const = 0; 00035 00036 private: 00037 friend void insert(Component* c, InPortBase* i); 00038 friend void insert(Component* c, OutPortBase* o); 00039 00040 typedef std::vector<InPortBase*> InPorts; 00041 typedef std::vector<OutPortBase*> OutPorts; 00042 typedef InPorts::iterator InPortIterator; 00043 typedef OutPorts::iterator OutPortIterator; 00044 00045 InPorts ip; 00046 OutPorts op; 00047 }; 00048 00049 #endif