rc_portal.h

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00037 #ifndef RC_PORTAL_H_
00038 #define RC_PORTAL_H_
00039 
00040 #include "ReChannel/communication/portals/rc_abstract_portal.h"
00041 
00042 namespace ReChannel {
00043 
00049 template<class PORT>
00050 class rc_portal
00051     : public rc_abstract_portal<PORT>
00052 {
00053 private:
00054     typedef rc_abstract_portal<PORT> base_type;
00055 public:
00056     typedef PORT                              port_type;
00057     typedef typename base_type::if_type       if_type;
00058     typedef typename base_type::accessor_type accessor_type;
00059 
00060 public:
00061     explicit rc_portal(
00062         const sc_module_name& module_name_ =
00063             sc_gen_unique_name("rc_portal"))
00064         : base_type(module_name_)
00065     { }
00066 };
00067 
00068 } // namespace ReChannel
00069 
00070 /* portal construction macros */
00071 
00072 #define RC_PORTAL(port_class_name) \
00073     template<> \
00074     struct rc_portal<port_class_name > \
00075         : public rc_abstract_portal<port_class_name >
00076 
00077 #define RC_PORTAL_TEMPLATE(port_class_name) \
00078     struct rc_portal<port_class_name > \
00079         : public rc_abstract_portal<port_class_name >
00080 
00081 #define RC_PORTAL_CTOR(port_class_name) \
00082     typedef port_class_name port_type; \
00083     typedef rc_abstract_portal<port_class_name >::if_type if_type; \
00084     typedef rc_abstract_portal<port_class_name >::accessor_type \
00085         accessor_type; \
00086     explicit rc_portal(const sc_module_name& module_name_ \
00087         = sc_gen_unique_name("rc_portal")) \
00088         : rc_abstract_portal<port_class_name >(module_name_)
00089 
00090 #define RC_PORTAL_TEMPLATE_CTOR(port_class_name) \
00091     typedef port_class_name port_type; \
00092     typedef typename rc_abstract_portal<port_class_name >::if_type \
00093         if_type; \
00094     typedef typename rc_abstract_portal<port_class_name >::accessor_type \
00095         accessor_type; \
00096     explicit rc_portal(const sc_module_name& module_name_ \
00097         = sc_gen_unique_name("rc_portal")) \
00098         : rc_abstract_portal<port_class_name >(module_name_)
00099 
00100 // note: using this macro requires the definition of 
00101 //       the typedef 'if_type' at class scope
00102 //       or the use of macro RC_PORTAL_CTOR
00103 #define RC_PORTAL_FORWARD_EVENT(event_method_name) \
00104     this->add_event_forwarder( \
00105         &if_type::event_method_name, #event_method_name)
00106 
00107 #endif // RC_PORTAL_H_
00108 //
00109 // $Id: rc_portal.h,v 1.17 2007/11/23 13:25:45 felke Exp $
00110 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/portals/rc_portal.h,v $
00111 //

Generated on Tue Jan 1 23:13:41 2008 for ReChannel by  doxygen 1.5.3