rc_portmap.cpp

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 #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 } // namespace ReChannel
00091 //
00092 // $Id: rc_portmap.cpp,v 1.3 2007/10/14 05:26:41 felke Exp $
00093 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/core/rc_portmap.cpp,v $
00094 //

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