rc_module.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_MODULE_H_
00038 #define RC_MODULE_H_
00039 
00040 #include "ReChannel/core/rc_process_support.h"
00041 
00042 namespace ReChannel {
00043 
00044 struct rc_module;
00045 
00046 typedef sc_module_name rc_module_name;
00047 typedef rc_module      rc_channel;
00048 typedef rc_module      rc_behavior;
00049 
00053 struct rc_module
00054     : public sc_module,
00055       virtual public rc_resettable
00056 {
00057 protected:
00058     rc_module()
00059         { rc_register_resettable(*this, this); }
00060 
00061     rc_module(rc_module_name name_)
00062         { rc_register_resettable(*this, this); }
00063 
00064 protected:
00065 
00066     /* next_trigger(..) redirects */
00067 
00068     inline void next_trigger()
00069         { rc_next_trigger(); }
00070 
00071     inline void next_trigger(const sc_event& e)
00072         { rc_next_trigger(e); }
00073 
00074     inline void next_trigger(sc_event_or_list& el)
00075         { rc_next_trigger(el); }
00076 
00077     inline void next_trigger(sc_event_and_list& el)
00078         { rc_next_trigger(el); }
00079 
00080     inline void next_trigger(const sc_time& t)
00081         { rc_next_trigger(t); }
00082 
00083     inline void next_trigger(double v, sc_time_unit tu)
00084         { rc_next_trigger(v, tu); }
00085 
00086     inline void next_trigger(const sc_time& t, const sc_event& e)
00087         { rc_next_trigger(t, e); }
00088 
00089     inline void next_trigger(double v, sc_time_unit tu, const sc_event& e)
00090         { rc_next_trigger(v, tu, e); }
00091 
00092     inline void next_trigger(const sc_time& t, sc_event_or_list& el)
00093         { rc_next_trigger(t, el); }
00094 
00095     inline void next_trigger(
00096         double v, sc_time_unit t, sc_event_or_list& el)
00097         { rc_next_trigger(v, t, el); }
00098 
00099     inline void next_trigger(const sc_time& t, sc_event_and_list& el)
00100         { rc_next_trigger(t, el); }
00101 
00102     inline void next_trigger(
00103         double v, sc_time_unit tu, sc_event_and_list& el)
00104         { rc_next_trigger(v, tu, el); }
00105 
00106     /* wait(..) redirects */
00107 
00108     inline void wait()
00109         { rc_wait(); }
00110 
00111     inline void wait(int n)
00112         { rc_wait(n); }
00113 
00114     inline void wait(const sc_event& e)
00115         { rc_wait(e); }
00116 
00117     inline void wait(sc_event_or_list& el)
00118         { rc_wait(el); }
00119 
00120     inline void wait(sc_event_and_list& el)
00121         { rc_wait(el); }
00122 
00123     inline void wait(const sc_time& t)
00124         { rc_wait(t); }
00125 
00126     inline void wait(double v, sc_time_unit tu)
00127         { rc_wait(v, tu); }
00128 
00129     inline void wait(const sc_time& t, const sc_event& e)
00130         { rc_wait(t, e); }
00131 
00132     inline void wait(double v, sc_time_unit tu, const sc_event& e)
00133         { rc_wait(v, tu, e); }
00134 
00135     inline void wait(const sc_time& t, sc_event_or_list& el)
00136         { rc_wait(t, el); }
00137 
00138     inline void wait(double v, sc_time_unit t, sc_event_or_list& el)
00139         { rc_wait(v, t, el); }
00140 
00141     inline void wait(const sc_time& t, sc_event_and_list& el)
00142         { rc_wait(t, el); }
00143 
00144     inline void wait(double v, sc_time_unit tu, sc_event_and_list& el)
00145         { rc_wait(v, tu, el); }
00146 
00147     virtual void rc_on_reset() {}
00148 
00149     virtual void rc_on_init_resettable() {}
00150 
00151     virtual ~rc_module() {}
00152 };
00153 
00154 } // namespace ReChannel
00155 
00156 #define RC_MODULE(user_module_name) \
00157     struct user_module_name \
00158         : public ::ReChannel::rc_module
00159 
00160 #define RC_CTOR(user_module_name) \
00161     RC_HAS_PROCESS(user_module_name); \
00162     user_module_name(sc_module_name)
00163 
00164 #endif //RC_MODULE_H_
00165 
00166 //
00167 // $Id: rc_module.h,v 1.20 2007/11/23 13:24:55 felke Exp $
00168 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/components/rc_module.h,v $
00169 //

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