NetDest.cc (7089:9ea24d102d66) | NetDest.cc (7454:3a3e8e8cce1b) |
---|---|
1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include "mem/ruby/common/NetDest.hh" 30#include "mem/protocol/Protocol.hh" 31 32NetDest::NetDest() 33{ | 1/* 2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 17 unchanged lines hidden (view full) --- 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#include "mem/ruby/common/NetDest.hh" 30#include "mem/protocol/Protocol.hh" 31 32NetDest::NetDest() 33{ |
34 setSize(); | 34 resize(); |
35} 36 37void 38NetDest::add(MachineID newElement) 39{ 40 m_bits[vecIndex(newElement)].add(bitIndex(newElement.num)); 41} 42 --- 59 unchanged lines hidden (view full) --- 102{ 103 for (int i = 0; i < MachineType_base_count(machineType); i++) { 104 MachineID mach = {machineType, i}; 105 add(mach); 106 } 107} 108 109//For Princeton Network | 35} 36 37void 38NetDest::add(MachineID newElement) 39{ 40 m_bits[vecIndex(newElement)].add(bitIndex(newElement.num)); 41} 42 --- 59 unchanged lines hidden (view full) --- 102{ 103 for (int i = 0; i < MachineType_base_count(machineType); i++) { 104 MachineID mach = {machineType, i}; 105 add(mach); 106 } 107} 108 109//For Princeton Network |
110Vector<NodeID> | 110std::vector<NodeID> |
111NetDest::getAllDest() 112{ | 111NetDest::getAllDest() 112{ |
113 Vector<NodeID> dest; | 113 std::vector<NodeID> dest; |
114 dest.clear(); 115 for (int i = 0; i < m_bits.size(); i++) { 116 for (int j = 0; j < m_bits[i].getSize(); j++) { 117 if (m_bits[i].isElement(j)) { 118 int id = MachineType_base_number((MachineType)i) + j; | 114 dest.clear(); 115 for (int i = 0; i < m_bits.size(); i++) { 116 for (int j = 0; j < m_bits[i].getSize(); j++) { 117 if (m_bits[i].isElement(j)) { 118 int id = MachineType_base_number((MachineType)i) + j; |
119 dest.insertAtBottom((NodeID)id); | 119 dest.push_back((NodeID)id); |
120 } 121 } 122 } 123 return dest; 124} 125 126int 127NetDest::count() const --- 116 unchanged lines hidden (view full) --- 244 245bool 246NetDest::isElement(MachineID element) const 247{ 248 return ((m_bits[vecIndex(element)])).isElement(bitIndex(element.num)); 249} 250 251void | 120 } 121 } 122 } 123 return dest; 124} 125 126int 127NetDest::count() const --- 116 unchanged lines hidden (view full) --- 244 245bool 246NetDest::isElement(MachineID element) const 247{ 248 return ((m_bits[vecIndex(element)])).isElement(bitIndex(element.num)); 249} 250 251void |
252NetDest::setSize() | 252NetDest::resize() |
253{ | 253{ |
254 m_bits.setSize(MachineType_base_level(MachineType_NUM)); | 254 m_bits.resize(MachineType_base_level(MachineType_NUM)); |
255 assert(m_bits.size() == MachineType_NUM); 256 257 for (int i = 0; i < m_bits.size(); i++) { 258 m_bits[i].setSize(MachineType_base_count((MachineType)i)); 259 } 260} 261 262void --- 13 unchanged lines hidden --- | 255 assert(m_bits.size() == MachineType_NUM); 256 257 for (int i = 0; i < m_bits.size(); i++) { 258 m_bits[i].setSize(MachineType_base_count((MachineType)i)); 259 } 260} 261 262void --- 13 unchanged lines hidden --- |