tglobalroutingtable.h

来自「noxim系统的软件实现」· C头文件 代码 · 共 88 行

H
88
字号
/* Copyright 2005-2007      Fabrizio Fazzino <fabrizio.fazzino@diit.unict.it>    Maurizio Palesi <mpalesi@diit.unict.it>    Davide Patti <dpatti@diit.unict.it> *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#ifndef __TGLOBALROUTINGTABLE_H__#define __TGLOBALROUTINGTABLE_H__//---------------------------------------------------------------------------#include <vector>#include <map>#include <set>using namespace std;//---------------------------------------------------------------------------typedef pair<int,int> TLinkId; // source, destination node// Routing tabletypedef set<TLinkId> TAdmissibleOutputs;// Map a destination to a set of admissible outputstypedef map<int,TAdmissibleOutputs> TRoutingTableLink; // Map an input link to its routing tabletypedef map<TLinkId,TRoutingTableLink> TRoutingTableNode;// Map a node of the network to its routing tabletypedef map<int,TRoutingTableNode> TRoutingTableNoC;//---------------------------------------------------------------------------// Converts an input direction to a link TLinkId direction2ILinkId(const int node_id, const int dir);// Converts an input direction to a linkint oLinkId2Direction(const TLinkId& out_link);// Converts a set of output links to a set of directionsvector<int> admissibleOutputsSet2Vector(const TAdmissibleOutputs& ao);//---------------------------------------------------------------------------class TGlobalRoutingTable{public:  TGlobalRoutingTable();   // Load routing table from file. Returns true if ok, false otherwise  bool load(const char* fname);  TRoutingTableNode getNodeRoutingTable(const int node_id);  bool isValid() { return valid; }private:  TRoutingTableNoC rt_noc;    bool             valid;  // Search label rt_label through the file  //  bool seek(const char* fname, const char* rt_label, ifstream& fin);};//---------------------------------------------------------------------------#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?