rc_abstract_filter.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_ABSTRACT_FILTER_H_
00038 #define RC_ABSTRACT_FILTER_H_
00039 
00040 #include "ReChannel/core/rc_reconfigurable.h"
00041 #include "ReChannel/core/rc_transaction_counter.h"
00042 #include "ReChannel/communication/rc_interface_wrapper.h"
00043 #include "ReChannel/communication/accessors/rc_accessor.h"
00044 
00045 namespace ReChannel {
00046 
00050 template<class IF>
00051 class rc_abstract_filter
00052     : public rc_accessor<IF>,
00053       virtual public IF
00054 {
00055     RC_STATIC_ASSERT_VALID_INTERFACE(IF);
00056 
00057 private:
00058     typedef rc_abstract_filter<IF> this_type;
00059 
00060 protected:
00061     typedef rc_accessor<IF> accessor_type;
00062 
00063 public:
00064     typedef IF if_type;
00065 
00066 protected:
00067     rc_abstract_filter();
00068 
00069 protected:
00070     inline rc_reconfigurable* rc_get_reconfigurable() const
00071         { return reconf; }
00072 
00073     inline bool rc_is_deactivation_requested() const;
00074 
00075     inline void rc_possible_deactivation()
00076         { this->_rc_possible_deactivation(false); }
00077 
00078     inline void rc_nb_possible_deactivation()
00079         { this->_rc_possible_deactivation(true); }
00080 
00081     inline void rc_cancel() const
00082         { throw new rc_process_cancel_exception(); }
00083 
00084     inline void rc_nb_cancel() const
00085         { throw new rc_process_cancel_exception(); }
00086 
00087 /* next_trigger(..) redirects */
00088 
00089     inline void next_trigger()
00090         { rc_next_trigger(); }
00091 
00092     inline void next_trigger(const sc_event& e)
00093         { rc_next_trigger(e); }
00094 
00095     inline void next_trigger(sc_event_or_list& el)
00096         { rc_next_trigger(el); }
00097 
00098     inline void next_trigger(sc_event_and_list& el)
00099         { rc_next_trigger(el); }
00100 
00101     inline void next_trigger(const sc_time& t)
00102         { rc_next_trigger(t); }
00103 
00104     inline void next_trigger(double v, sc_time_unit tu)
00105         { rc_next_trigger(v, tu); }
00106 
00107     inline void next_trigger(const sc_time& t, const sc_event& e)
00108         { rc_next_trigger(t, e); }
00109 
00110     inline void next_trigger(double v, sc_time_unit tu, const sc_event& e)
00111         { rc_next_trigger(v, tu, e); }
00112 
00113     inline void next_trigger(const sc_time& t, sc_event_or_list& el)
00114         { rc_next_trigger(t, el); }
00115 
00116     inline void next_trigger(
00117         double v, sc_time_unit t, sc_event_or_list& el)
00118         { rc_next_trigger(v, t, el); }
00119 
00120     inline void next_trigger(const sc_time& t, sc_event_and_list& el)
00121         { rc_next_trigger(t, el); }
00122 
00123     inline void next_trigger(
00124         double v, sc_time_unit tu, sc_event_and_list& el)
00125         { rc_next_trigger(v, tu, el); }
00126 
00127 /* rc_wait() redirects */
00128 
00129     inline void wait() const
00130         { rc_wait(); }
00131 
00132     inline void wait(int n)
00133         { rc_wait(n); }
00134 
00135     inline void wait(const sc_event& e)
00136         { rc_wait(e); }
00137 
00138     inline void wait(sc_event_or_list& el)
00139         { rc_wait(el); }
00140 
00141     inline void wait(sc_event_and_list& el)
00142         { rc_wait(el); }
00143 
00144     inline void wait(const sc_time& t)
00145         { rc_wait(t); }
00146 
00147     inline void wait(double v, sc_time_unit tu)
00148         { rc_wait(v, tu); }
00149 
00150     inline void wait(const sc_time& t, const sc_event& e)
00151         { rc_wait(t, e); }
00152 
00153     inline void wait(double v, sc_time_unit tu, const sc_event& e)
00154         { rc_wait(v, tu, e); }
00155 
00156     inline void wait(const sc_time& t, sc_event_or_list& el)
00157         { rc_wait(t, el); }
00158 
00159     inline void wait(double v, sc_time_unit t, sc_event_or_list& el)
00160         { rc_wait(v, t, el); }
00161 
00162     inline void wait(const sc_time& t, sc_event_and_list& el)
00163         { rc_wait(t, el); }
00164 
00165     inline void wait(double v, sc_time_unit tu, sc_event_and_list& el)
00166         { rc_wait(v, tu, el); }
00167 
00168 private:
00169 
00170     rc_reconfigurable* reconf;
00171 
00172 private:
00173     // disabled
00174     rc_abstract_filter(const this_type& other_);
00175     this_type& operator=(const this_type& other_);
00176 };
00177 
00178 /* inline code */
00179 
00180 template<class IF>
00181 inline
00182 bool rc_abstract_filter<IF>::rc_is_deactivation_requested() const
00183 {
00184     if (reconf != NULL) {
00185         return reconf->rc_is_deactivation_requested();
00186     } else {
00187         return false;
00188     }
00189 }
00190 
00191 /* template code */
00192 
00193 template<class IF>
00194 rc_abstract_filter<IF>::rc_abstract_filter()
00195     : reconf(rc_get_reconfigurable_context())
00196 { }
00197 
00198 } // namespace ReChannel
00199 
00200 #endif // RC_ABSTRACT_FILTER_H_
00201 
00202 //
00203 // $Id: rc_abstract_filter.h,v 1.7 2008/01/01 13:50:29 felke Exp $
00204 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/filters/rc_abstract_filter.h,v $
00205 //

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