port.h

Go to the documentation of this file.
00001 /*******************************************************************\
00002 
00003                    SESAME project software license
00004 
00005               Copyright (C) 2002 University of Amsterdam
00006 
00007     This program is free software; you can redistribute it and/or
00008      modify it under the terms of the GNU General Public License
00009     as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015              GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018      along with this program; if not, write to the Free Software
00019       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020                            02111-1307, USA.
00021 
00022       For information regarding the SESAME software project see
00023               http://sesamesim.sourceforge.net or email
00024                     jcofflan@users.sourceforge.net
00025 
00026 \*******************************************************************/
00027 
00028 #ifndef PORT_H
00029 #define PORT_H
00030 
00031 #include "pnxmltags.h"
00032 #include "ymldefs.h"
00033 #include <iostream>
00034 
00035 #include "id.h"
00036 #include "io.h"
00037 
00038 #define YMLGEN_PORT_BASENAME "YMLGen_Port_"
00039 
00040 template<class T>
00041 class InPort : public Id, public In<T> {
00042   In<T> *in;
00043 
00044  public:
00045   InPort(const Id& n, In<T>& i);
00046   virtual ~InPort() {}
00047 
00048   void read(T& value);
00049   void read(T* p, unsigned int n);
00050 
00051   yapiObject_t getYAPIType() {return yapiPort;}
00052   virtual void dumpYML(std::ostream &stream, int tablevel);
00053 };
00054 
00055 template<class T>
00056 class OutPort : public Id, public Out<T> {
00057   Out<T> *out;
00058 
00059  public:
00060   OutPort(const Id& n, Out<T>& i);
00061   virtual ~OutPort() {}
00062 
00063   void write(const T& t);
00064   void write(const T* p, unsigned int n);
00065 
00066   yapiObject_t getYAPIType() {return yapiPort;}
00067   virtual void dumpYML(std::ostream &stream, int tablevel);
00068 };
00069 
00070 
00072 
00073 template<class T>
00074 void read(InPort<T>& s, T& t);
00075 
00076 template<class T>
00077 void read(InPort<T>& s, T* p, unsigned int n);
00078 
00079 template<class T>
00080 void write(OutPort<T>& s, const T& t);
00081 
00082 template<class T>
00083 void write(OutPort<T>& s, const T* p, unsigned int n);
00084 
00085 
00087 //#include "select.h"
00088 
00089 // include implementation of template classes
00090 #include "port.cc"
00091 
00092 #endif

Generated on Wed Apr 5 20:57:45 2006 for Sesame by  doxygen 1.4.6