Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

routedb.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 routedb.h - description 00003 ------------------- 00004 begin : Thu May 20 2004 00005 copyright : (C) 2004 by Ramakrishna Shenai 00006 email : shenai1@cs.umbc.edu 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef routedb_h 00019 #define routedb_h 00020 00021 #include <cassert> 00022 #include <cstdlib> 00023 #include <fstream> 00024 #include <iostream> 00025 #include <map> 00026 #include <string> 00027 #include <sstream> 00028 00029 using namespace std; 00030 00031 00032 namespace sim { 00033 class Routedb; 00034 00044 class RouteManager { 00045 public: 00052 RouteManager( u_int size ); 00053 00065 void addRoute( u_int src, u_int dest, u_int rtSize, int *rt ); 00066 00075 int *getRoute( u_int src, u_int dest ); 00076 00084 u_int getRouteSize( u_int src, u_int dest ); 00085 00095 static void parseRouteFile( RouteManager *rm, std::string filename ); 00096 protected: 00100 Routedb *_rdb; 00101 00105 u_int _size; 00106 }; 00107 00108 class RouteEntry; 00109 typedef map<u_int, RouteEntry*> RouteMap; 00110 00121 class Routedb { 00122 public: 00128 Routedb() {;} 00129 00135 Routedb( u_int src ); 00136 00141 void setSrc( u_int src ) { _src = src; } 00142 00149 void addRoute( u_int dest, u_int size, int *rt ); 00150 00157 int* getRoute( u_int dest ); 00158 00165 u_int getRouteLength( u_int dest ); 00166 protected: 00170 RouteMap _rm; 00171 00175 u_int _src; 00176 }; 00177 00181 class RouteEntry { 00182 public: 00190 RouteEntry( u_int size, int *rt ) { 00191 assert( rt != NULL ); 00192 _size = size; 00193 _rt = new int[_size]; 00194 for( u_int i = 0; i < _size; i++ ) 00195 _rt[i] = rt[i]; 00196 } 00197 00202 const u_int getSize() { return _size; } 00203 00208 int * getRoute() { return _rt; } 00209 protected: 00210 u_int _size; 00211 int* _rt; 00212 }; 00213 }; 00214 00215 00216 #endif

Generated on Fri May 21 15:23:21 2004 for Optical Network Simulation (Build) by doxygen 1.3.7