00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00037 #ifndef RC_COMMON_H_
00038 #define RC_COMMON_H_
00039
00040
00041
00042
00043
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
00069
00070
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
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 }
00132 }
00133
00134
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
00172
00173