rc_transaction_counter.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_TRANSACTION_COUNTER_H_
00038 #define RC_TRANSACTION_COUNTER_H_
00039 
00040 #include "ReChannel/core/rc_reconfigurable.h"
00041 
00042 namespace ReChannel {
00043 
00074 class rc_transaction_counter
00075     : public sc_object
00076 {
00077 private:
00078     typedef rc_transaction_counter this_type;
00079 
00080 public:
00081 
00085     rc_transaction_counter();
00086 
00092     explicit rc_transaction_counter(std::vector<this_type*>& children);
00093 
00097     inline int count() const
00098         { return p_count; }
00099 
00104     void modify(int amount);
00105 
00112     void reset();
00113 
00119     ~rc_transaction_counter()
00120         { this->reset(); }
00121 
00125     inline rc_reconfigurable* get_reconfigurable() const
00126         { return p_reconf; }
00127 
00133     inline int get_children_count() const
00134         { return (int)p_children.size(); }
00135 
00139     int get_relay_factor(int index) const;
00140 
00144     void set_relay_factor(int index, int factor);
00145 
00149     void set_relay_factor(rc_transaction_counter& child, int factor);
00150 
00151 /* convenience operators */
00152 
00156     inline const this_type& operator++()
00157         { this->modify(+1); return *this; }
00158 
00162     inline const this_type& operator--()
00163         { this->modify(-1); return *this; }
00164 
00168     inline const this_type& operator+=(int amount)
00169         { this->modify(amount); return *this; }
00170 
00174     inline const this_type& operator-=(int amount)
00175         { this->modify(-amount); return *this; }
00176 
00177 /* convenience constructors */
00178 
00184     explicit rc_transaction_counter(this_type& tc1, int factor1);
00185 
00186     rc_transaction_counter(
00187         this_type& tc1, int factor1, this_type& tc2, int factor2);
00188 
00189     rc_transaction_counter(
00190         this_type& tc1, int factor1, this_type& tc2, int factor2,
00191         this_type& tc3, int factor3);
00192 
00193     rc_transaction_counter(
00194         this_type& tc1, int factor1, this_type& tc2, int factor2,
00195         this_type& tc3, int factor3, this_type& tc4, int factor4);
00196 
00197     rc_transaction_counter(
00198         this_type& tc1, int factor1, this_type& tc2, int factor2,
00199         this_type& tc3, int factor3, this_type& tc4, int factor4,
00200         this_type& tc5, int factor5);
00201 
00202     rc_transaction_counter(
00203         this_type& tc1, int factor1, this_type& tc2, int factor2,
00204         this_type& tc3, int factor3, this_type& tc4, int factor4,
00205         this_type& tc5, int factor5, this_type& tc6, int factor6);
00206 
00207     rc_transaction_counter(
00208         this_type& tc1, int factor1, this_type& tc2, int factor2,
00209         this_type& tc3, int factor3, this_type& tc4, int factor4,
00210         this_type& tc5, int factor5, this_type& tc6, int factor6,
00211         this_type& tc7, int factor7);
00212 
00213     rc_transaction_counter(
00214         this_type& tc1, int factor1, this_type& tc2, int factor2,
00215         this_type& tc3, int factor3, this_type& tc4, int factor4,
00216         this_type& tc5, int factor5, this_type& tc6, int factor6,
00217         this_type& tc7, int factor7, this_type& tc8, int factor8);
00218 
00219     rc_transaction_counter(
00220         this_type& tc1, int factor1, this_type& tc2, int factor2,
00221         this_type& tc3, int factor3, this_type& tc4, int factor4,
00222         this_type& tc5, int factor5, this_type& tc6, int factor6,
00223         this_type& tc7, int factor7, this_type& tc8, int factor8,
00224         this_type& tc9, int factor9);
00225 
00226     rc_transaction_counter(
00227         this_type& tc1, int factor1, this_type& tc2, int factor2,
00228         this_type& tc3, int factor3, this_type& tc4, int factor4,
00229         this_type& tc5, int factor5, this_type& tc6, int factor6,
00230         this_type& tc7, int factor7, this_type& tc8, int factor8,
00231         this_type& tc9, int factor9, this_type& tc10, int factor10);
00232 
00233 private:
00234 
00238     void _rc_relay(int amount);
00239 
00248     void _rc_add_child(rc_transaction_counter& child, int factor=1);
00249 
00250 private:
00251 
00255     rc_reconfigurable*                       p_reconf;
00259     int                                      p_count;
00265     std::vector<std::pair<this_type*, int> > p_children;
00266 
00267 private:
00268     // disabled
00270     rc_transaction_counter(const this_type& orig);
00272     this_type& operator=(const this_type& orig);
00273 };
00274 
00275 } // namespace ReChannel
00276 
00277 #endif //RC_TRANSACTION_COUNTER_H_
00278 
00279 //
00280 // $Id: rc_transaction_counter.h,v 1.11 2007/12/20 20:42:13 felke Exp $
00281 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/core/rc_transaction_counter.h,v $
00282 //

Generated on Tue Jan 1 23:14:06 2008 for ReChannel by  doxygen 1.5.3