rc_control.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_CONTROL_H_
00038 #define RC_CONTROL_H_
00039 
00040 #include "ReChannel/core/rc_common_header.h"
00041 #include "ReChannel/core/rc_control_if.h"
00042 #include "ReChannel/core/rc_reconfigurable.h"
00043 #include "ReChannel/core/rc_reconfigurable_set.h"
00044 #include "ReChannel/core/rc_switch_connector.h"
00045 #include "ReChannel/core/rc_report_ids.h"
00046 #include "ReChannel/util/rc_mutex_object.h"
00047 
00048 namespace ReChannel {
00049 
00053 class rc_control
00054     : public sc_channel,
00055       virtual public rc_control_if
00056 {
00057 private:
00058     typedef std::map<sc_object*, rc_reconfigurable*> obj_reconf_map;
00059 
00060 public:
00061     rc_control(sc_module_name name_=sc_gen_unique_name("rc_control"))
00062     { }
00063 
00064     virtual bool has_control(
00065         const rc_reconfigurable_set& reconf_set) const;
00066 
00067     virtual void add(const rc_reconfigurable_set& reconf_set);
00068 
00069     virtual void remove(const rc_reconfigurable_set& reconf_set);
00070 
00071     virtual void load(const rc_reconfigurable_set& reconf_set);
00072 
00073     virtual void unload(const rc_reconfigurable_set& reconf_set);
00074 
00075     virtual void activate(const rc_reconfigurable_set& reconf_set);
00076 
00077     virtual void deactivate(const rc_reconfigurable_set& reconf_set);
00078 
00079     virtual void lock(const rc_reconfigurable_set& reconf_set);
00080 
00081     virtual bool trylock(const rc_reconfigurable_set& reconf_set);
00082 
00083     virtual void unlock(const rc_reconfigurable_set& reconf_set);
00084 
00085     virtual bool is_locked(const rc_reconfigurable_set& reconf_set) const;
00086 
00087     virtual void move(
00088         const rc_reconfigurable_set& reconf_set,
00089         rc_switch_connector_base& target);
00090 
00091 protected:
00092 
00093     virtual sc_time takes_time(
00094         const rc_reconfigurable& reconf,
00095         rc_reconfigurable::action_type action) const;
00096 
00097     void update_delays(rc_reconfigurable::action_type action);
00098 
00099     void get_controlled_set(rc_reconfigurable_set& copy_dest) const;
00100 
00101     virtual void start_of_simulation();
00102 
00103 private:
00104     /* for internal use only */
00105 
00109     void _rc_unlock(
00110         rc_reconfigurable_set::const_iterator start_,
00111         rc_reconfigurable_set::const_iterator end_) const;
00112 
00113     void _rc_do_action(
00114         const rc_reconfigurable_set& reconf_set,
00115         rc_reconfigurable::state_type new_state);
00116 
00117     void _rc_do_action(
00118         const rc_reconfigurable_set& reconf_set,
00119         rc_reconfigurable::state_type new_state,
00120         rc_reconfigurable::state_type only_change_state);
00121 
00122     void _rc_reconfigure(
00123         const rc_reconfigurable_set& reconf_set,
00124         rc_reconfigurable::state_type new_state);
00125 
00126 private:
00127     rc_reconfigurable_set p_reconfigurable_set;
00128     obj_reconf_map        p_obj_reconf_map;
00129 
00130 private:
00131     // disabled
00132     rc_control(const rc_control& orig);
00133     rc_control& operator=(const rc_control& orig);
00134 };
00135 
00136 } // namespace ReChannel
00137 
00138 #endif //RC_CONTROL_H_
00139 
00140 //
00141 // $Id: rc_control.h,v 1.15 2007/12/20 20:28:34 felke Exp $
00142 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/core/rc_control.h,v $
00143 //

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