Network.hh (9859:1bd310386038) | Network.hh (9863:9483739f83ee) |
---|---|
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; --- 74 unchanged lines hidden (view full) --- 83 const NetDest& routing_table_entry) = 0; 84 virtual void makeInLink(NodeID src, SwitchID dest, BasicLink* link, 85 LinkDirection direction, 86 const NetDest& routing_table_entry) = 0; 87 virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, 88 LinkDirection direction, 89 const NetDest& routing_table_entry) = 0; 90 | 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; --- 74 unchanged lines hidden (view full) --- 83 const NetDest& routing_table_entry) = 0; 84 virtual void makeInLink(NodeID src, SwitchID dest, BasicLink* link, 85 LinkDirection direction, 86 const NetDest& routing_table_entry) = 0; 87 virtual void makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link, 88 LinkDirection direction, 89 const NetDest& routing_table_entry) = 0; 90 |
91 virtual void printStats(std::ostream& out) const = 0; 92 virtual void clearStats() = 0; | 91 virtual void collateStats() = 0; |
93 virtual void print(std::ostream& out) const = 0; 94 95 /* 96 * Virtual functions for functionally reading and writing packets in 97 * the network. Each network needs to implement these for functional 98 * accesses to work correctly. 99 */ 100 virtual bool functionalRead(Packet *pkt) 101 { fatal("Functional read not implemented.\n"); } 102 virtual uint32_t functionalWrite(Packet *pkt) 103 { fatal("Functional write not implemented.\n"); } 104 105 protected: 106 // Private copy constructor and assignment operator 107 Network(const Network& obj); 108 Network& operator=(const Network& obj); 109 | 92 virtual void print(std::ostream& out) const = 0; 93 94 /* 95 * Virtual functions for functionally reading and writing packets in 96 * the network. Each network needs to implement these for functional 97 * accesses to work correctly. 98 */ 99 virtual bool functionalRead(Packet *pkt) 100 { fatal("Functional read not implemented.\n"); } 101 virtual uint32_t functionalWrite(Packet *pkt) 102 { fatal("Functional write not implemented.\n"); } 103 104 protected: 105 // Private copy constructor and assignment operator 106 Network(const Network& obj); 107 Network& operator=(const Network& obj); 108 |
110 protected: 111 const std::string m_name; 112 int m_nodes; | 109 uint32_t m_nodes; |
113 static uint32_t m_virtual_networks; 114 Topology* m_topology_ptr; 115 static uint32_t m_control_msg_size; 116 static uint32_t m_data_msg_size; | 110 static uint32_t m_virtual_networks; 111 Topology* m_topology_ptr; 112 static uint32_t m_control_msg_size; 113 static uint32_t m_data_msg_size; |
114 115 private: 116 //! Callback class used for collating statistics from all the 117 //! controller of this type. 118 class StatsCallback : public Callback 119 { 120 private: 121 Network *ctr; 122 123 public: 124 virtual ~StatsCallback() {} 125 126 StatsCallback(Network *_ctr) 127 : ctr(_ctr) 128 { 129 } 130 131 void process() {ctr->collateStats();} 132 }; |
|
117}; 118 119inline std::ostream& 120operator<<(std::ostream& out, const Network& obj) 121{ 122 obj.print(out); 123 out << std::flush; 124 return out; 125} 126 127#endif // __MEM_RUBY_NETWORK_NETWORK_HH__ | 133}; 134 135inline std::ostream& 136operator<<(std::ostream& out, const Network& obj) 137{ 138 obj.print(out); 139 out << std::flush; 140 return out; 141} 142 143#endif // __MEM_RUBY_NETWORK_NETWORK_HH__ |