rc_common_header.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_COMMON_H_
00038 #define RC_COMMON_H_
00039 
00040 /*
00041  * Note: Define RC_DEBUG to enable ReChannel's debug message reporting.
00042  *       If RC_DEBUG is defined, constant RC_DEBUG_LEVEL sets the
00043  *          debug level (default is RC_DEBUG_LEVEL=3).
00044  */
00045 
00046 #include <typeinfo>
00047 #include <memory>
00048 #include <string>
00049 #include <sstream>
00050 #include <vector>
00051 #include <set>
00052 #include <map>
00053 
00054 #include <boost/bind.hpp>
00055 #include <boost/function.hpp>
00056 #include <boost/type_traits.hpp>
00057 
00058 #include <systemc.h>
00059 
00060 #include "ReChannel/util/rc_report.h"
00061 #include "ReChannel/util/rc_throwable.h"
00062 #include "ReChannel/util/rc_port_traits.h"
00063 
00064 #include "ReChannel/core/rc_report_ids.h"
00065 
00066 namespace ReChannel {
00067 
00068 //using namespace sc_core;
00069 
00070 /* global functions */
00071 
00090 extern sc_object* rc_find_object(
00091     const char* obj_name, const sc_object* rel_obj);
00092 
00093 extern sc_module* rc_find_parent_module(sc_object* obj);
00094 
00095 /* internals */
00096 
00097 namespace internals {
00098 
00099 enum undef { UNDEF = 0 };
00100 
00101 template<class T, bool B> class arg;
00102 
00106 template<class T>
00107 class arg<T, true>
00108 {
00109 public:
00110     arg(T& arg_)    : p_arg(&arg_) {}
00111     arg(undef arg_) : p_arg(NULL) {}
00112     inline operator T*() const { return p_arg; }
00113 private:
00114     T* p_arg;
00115 };
00116 
00117 template<class T>
00118 class arg<T, false>
00119 {
00120 public:
00121     arg(undef arg_) {}
00122 };
00123 
00124 template<>
00125 class arg<void, true>
00126 {
00127 public:
00128     arg(undef arg_) {}
00129 };
00130 
00131 } // namespace internals
00132 } // namespace ReChannel
00133 
00134 // macros to pass templated expressions as macro arguments
00135 #define RC_PARAMS2(p1, p2) \
00136     p1, p2
00137 #define RC_PARAMS3(p1, p2, p3) \
00138     p1, p2, p3
00139 #define RC_PARAMS4(p1, p2, p3, p4) \
00140     p1, p2, p3, p4
00141 #define RC_PARAMS5(p1, p2, p3, p4, p5) \
00142     p1, p2, p3, p4, p5
00143 #define RC_PARAMS6(p1, p2, p3, p4, p5, p6) \
00144     p1, p2, p3, p4, p5, p6
00145 #define RC_PARAMS7(p1, p2, p3, p4, p5, p6, p7) \
00146     p1, p2, p3, p4, p5, p6, p7
00147 #define RC_PARAMS8(p1, p2, p3, p4, p5, p6, p7, p8) \
00148     p1, p2, p3, p4, p5, p6, p7, p8
00149 #define RC_PARAMS9(p1, p2, p3, p4, p5, p6, p7, p8, p9) \
00150     p1, p2, p3, p4, p5, p6, p7, p8, p9
00151 #define RC_PARAMS10(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) \
00152     p1, p2, p3, p4, p5, p6, p7, p8, p9, p10
00153 
00154 #define RC_STATIC_ASSERT_VALID_INTERFACE(if_type) \
00155     RC_STATIC_ASSERT_T( \
00156         interface_type_validity_check, \
00157         (boost::is_base_of<sc_interface, if_type >::value \
00158         && !boost::is_same<sc_interface, if_type >::value) \
00159     )
00160 
00161 #define RC_STATIC_ASSERT_VALID_PORT(port_type) \
00162     RC_STATIC_ASSERT_T( \
00163         port_type_validity_check, \
00164         (boost::is_base_of<sc_port_base, port_type >::value \
00165         && !boost::is_same<sc_port_base, port_type >::value) \
00166     )
00167 
00168 #endif //RC_COMMON_H_
00169 
00170 //
00171 // $Id: rc_common_header.h,v 1.11 2007/12/20 20:24:29 felke Exp $
00172 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/core/rc_common_header.h,v $
00173 //

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