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 #include "rc_portmap.h"
00038
00039 namespace ReChannel {
00040
00041 rc_object_handle rc_portmap_base::get(int index) const
00042 {
00043 if (index >= 0 && index < p_size) {
00044 return p_arr[index];
00045 } else {
00046 RC_REPORT_ERROR(RC_ID_OUT_OF_BOUNDS_,
00047 "out of bounds (in port map, at index: " << index <<")");
00048 }
00049 }
00050
00051 sc_object& rc_portmap_base::get_object(int index) const
00052 {
00053 if (index >= 0 && index < p_size) {
00054 return *(p_arr[index].get_object());
00055 } else {
00056 RC_REPORT_ERROR(RC_ID_OUT_OF_BOUNDS_,
00057 "out of bounds (in port map, at index: " << index <<")");
00058 }
00059 }
00060
00061 sc_interface* rc_portmap_base::get_interface(int index) const
00062 {
00063 if (index >= 0 && index < p_size) {
00064 return p_arr[index].get_interface();
00065 } else {
00066 RC_REPORT_ERROR(RC_ID_OUT_OF_BOUNDS_,
00067 "out of bounds (in port map, at index: " << index <<")");
00068 }
00069 }
00070
00071 void rc_portmap_base::_rc_init(rc_object_handle arr[], int size)
00072 {
00073 assert(p_arr == NULL);
00074 assert(arr != NULL && size > 0);
00075
00076 if (arr != NULL && p_arr == NULL) {
00077 p_arr = arr;
00078 p_size = size;
00079 for(int i=0; i < size; ++i) {
00080 if (p_arr[i].is_comm_object() == false) {
00081 RC_REPORT_ERROR(RC_ID_PORTMAP_INIT_ERROR_,
00082 "missing communication object:"
00083 " port, export or channel expected"
00084 " (in port map, at index: " << i <<")");
00085 }
00086 }
00087 }
00088 }
00089
00090 }
00091
00092
00093
00094