Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

component.cc

Go to the documentation of this file.
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 #include <sys/types.h>
00012 #include "component.h"
00013 #include "portbase.h"
00014 #include <assert.h>
00015 
00016 Component::Component(const IdBase& n) : IdBase(n)
00017 { }
00018 
00019 Component* Component::parentComponent() const
00020 {
00021   return (Component*)parent();
00022 }
00023 
00024 unsigned int Component::nrInPorts() const
00025 {
00026   return ip.size();
00027 }
00028 
00029 unsigned int Component::nrOutPorts() const
00030 {
00031   return op.size();
00032 }
00033 
00034 InPortBase*  Component::getInPort(unsigned int i) const
00035 {
00036   assert(i < ip.size());
00037   return ip[i];
00038 }
00039 
00040 OutPortBase* Component::getOutPort(unsigned int i) const
00041 {
00042   assert(i < op.size());
00043   return op[i];
00044 }
00045 
00046 // friend functions
00047 
00048 void insert(Component* p, InPortBase* i)
00049 {
00050   assert(p);
00051   assert(i);
00052   p->ip.push_back(i); 
00053 }
00054 
00055 void insert(Component* p, OutPortBase* o)
00056 {
00057   assert(p);
00058   assert(o);
00059   p->op.push_back(o); 
00060 }
00061 

Generated on Wed Feb 15 14:52:38 2006 for yapi by doxygen 1.3.2