rc_signal_accessors.cpp

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 #include "rc_signal_accessors.h"
00038 
00039 namespace ReChannel {
00040 
00041 void rc_accessor<sc_signal_in_if<bool> >::register_process_control(
00042     rc_process_control& pctrl, bool active_level) const
00043 {
00044     _rc_get_reset_signal().register_process_control(
00045         pctrl, active_level);
00046 }
00047 
00048 void rc_accessor<sc_signal_in_if<bool> >::unregister_process_control(
00049     rc_process_control& pctrl) const
00050 {
00051     _rc_get_reset_signal().unregister_process_control(pctrl);
00052 }
00053 
00054 rc_accessor<sc_signal_in_if<bool> >::reset_signal_type&
00055 rc_accessor<sc_signal_in_if<bool> >::_rc_get_reset_signal() const
00056 {
00057     if (p_reset_signal == NULL) {
00058         p_reset_signal =
00059             new reset_signal_type(
00060                 sc_gen_unique_name("_rc_signal_accessor_reset_signal"));
00061         sc_spawn_options opt;
00062         {
00063             opt.spawn_method();
00064             opt.set_sensitivity(&this->value_changed_event());
00065         }
00066         sc_spawn(
00067             sc_bind(
00068                 &this_type::_rc_reset_updater_proc,
00069                 const_cast<this_type*>(this)),
00070             sc_gen_unique_name("_rc_accessor_reset_updater_proc"), &opt);
00071     }
00072     return *p_reset_signal;
00073 }
00074 
00075 void rc_accessor<sc_signal_in_if<bool> >::_rc_reset_updater_proc()
00076 {
00077     rc_interface_wrapper<if_type>* const target_wrapper =
00078         this->rc_get_target_wrapper();
00079     if (target_wrapper != NULL) {
00080         p_reset_signal->write(
00081             target_wrapper->get_nb_interface_access()->read());
00082     } else {
00083         p_reset_signal->write(rc_undefined_value<bool>());
00084     }
00085 }
00086 
00087 void rc_accessor<sc_signal_inout_if<bool> >::register_process_control(
00088     rc_process_control& pctrl, bool active_level) const
00089 {
00090     _rc_get_reset_signal().register_process_control(
00091         pctrl, active_level);
00092 }
00093 
00094 void rc_accessor<sc_signal_inout_if<bool> >::unregister_process_control(
00095     rc_process_control& pctrl) const
00096 {
00097     _rc_get_reset_signal().unregister_process_control(pctrl);
00098 }
00099 
00100 rc_accessor<sc_signal_inout_if<bool> >::reset_signal_type&
00101 rc_accessor<sc_signal_inout_if<bool> >::_rc_get_reset_signal() const
00102 {
00103     if (p_reset_signal == NULL) {
00104         p_reset_signal =
00105             new reset_signal_type(
00106                 sc_gen_unique_name("_rc_signal_accessor_reset_signal"));
00107         sc_spawn_options opt;
00108         {
00109             opt.spawn_method();
00110             opt.set_sensitivity(&this->value_changed_event());
00111         }
00112         sc_spawn(
00113             sc_bind(
00114                 &this_type::_rc_reset_updater_proc,
00115                 const_cast<this_type*>(this)),
00116             sc_gen_unique_name("_rc_accessor_reset_updater_proc"), &opt);
00117     }
00118     return *p_reset_signal;
00119 }
00120 
00121 void rc_accessor<sc_signal_inout_if<bool> >::_rc_reset_updater_proc()
00122 {
00123     rc_interface_wrapper<if_type>* const target_wrapper =
00124         this->rc_get_target_wrapper();
00125     if (target_wrapper != NULL) {
00126         p_reset_signal->write(
00127             target_wrapper->get_nb_interface_access()->read());
00128     } else {
00129         p_reset_signal->write(rc_undefined_value<bool>());
00130     }
00131 }
00132 
00133 } // namespace ReChannel
00134 
00135 //
00136 // $Id: rc_signal_accessors.cpp,v 1.5 2007/12/06 11:42:43 felke Exp $
00137 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/accessors/rc_signal_accessors.cpp,v $
00138 //
00139 

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