From 140785d24c27f3afddbe95c9e504e27bf8274290 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 10 Mar 2010 18:33:11 -0800 Subject: ruby: get rid of std-includes.hh Do not use "using namespace std;" in headers Include header files as needed --- src/mem/ruby/network/simple/PerfectSwitch.cc | 6 +++--- src/mem/ruby/network/simple/PerfectSwitch.hh | 14 ++++++++------ src/mem/ruby/network/simple/Switch.cc | 8 +++++--- src/mem/ruby/network/simple/Switch.hh | 14 ++++++++------ src/mem/ruby/network/simple/Topology.cc | 7 ++++--- src/mem/ruby/network/simple/Topology.hh | 21 ++++++++++++--------- 6 files changed, 40 insertions(+), 30 deletions(-) (limited to 'src/mem/ruby/network/simple') diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index fab699ea4..d60c5332c 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -295,7 +295,7 @@ void PerfectSwitch::wakeup() } } -void PerfectSwitch::printStats(ostream& out) const +void PerfectSwitch::printStats(std::ostream& out) const { out << "PerfectSwitch printStats" << endl; } @@ -304,11 +304,11 @@ void PerfectSwitch::clearStats() { } -void PerfectSwitch::printConfig(ostream& out) const +void PerfectSwitch::printConfig(std::ostream& out) const { } -void PerfectSwitch::print(ostream& out) const +void PerfectSwitch::print(std::ostream& out) const { out << "[PerfectSwitch " << m_switch_id << "]"; } diff --git a/src/mem/ruby/network/simple/PerfectSwitch.hh b/src/mem/ruby/network/simple/PerfectSwitch.hh index 9cc28fff8..2956e261a 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.hh +++ b/src/mem/ruby/network/simple/PerfectSwitch.hh @@ -41,6 +41,8 @@ #ifndef PerfectSwitch_H #define PerfectSwitch_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/common/Consumer.hh" @@ -76,11 +78,11 @@ public: // Public Methods void wakeup(); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private copy constructor and assignment operator @@ -102,16 +104,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const PerfectSwitch& obj); +std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const PerfectSwitch& obj) +std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc index 87021471f..88695250c 100644 --- a/src/mem/ruby/network/simple/Switch.cc +++ b/src/mem/ruby/network/simple/Switch.cc @@ -129,8 +129,10 @@ const Vector* Switch::getThrottles() const return &m_throttles; } -void Switch::printStats(ostream& out) const +void Switch::printStats(std::ostream& out) const { + using namespace std; + out << "switch_" << m_switch_id << "_inlinks: " << m_perfect_switch_ptr->getInLinks() << endl; out << "switch_" << m_switch_id << "_outlinks: " << m_perfect_switch_ptr->getOutLinks() << endl; @@ -188,7 +190,7 @@ void Switch::clearStats() } } -void Switch::printConfig(ostream& out) const +void Switch::printConfig(std::ostream& out) const { m_perfect_switch_ptr->printConfig(out); for (int i=0; i + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" @@ -68,14 +70,14 @@ public: void clearBuffers(); void reconfigureOutPort(const NetDest& routing_table_entry); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; // Destructor ~Switch(); - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private copy constructor and assignment operator @@ -91,16 +93,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const Switch& obj); +std::ostream& operator<<(std::ostream& out, const Switch& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Switch& obj) +std::ostream& operator<<(std::ostream& out, const Switch& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc index e7fbe1ce3..a8ce4db84 100644 --- a/src/mem/ruby/network/simple/Topology.cc +++ b/src/mem/ruby/network/simple/Topology.cc @@ -45,7 +45,6 @@ #include "mem/protocol/MachineType.hh" #include "mem/protocol/Protocol.hh" #include "mem/ruby/system/System.hh" -#include static const int INFINITE_LATENCY = 10000; // Yes, this is a big hack static const int DEFAULT_BW_MULTIPLIER = 1; // Just to be consistent with above :) @@ -238,7 +237,7 @@ void Topology::makeLink(Network *net, SwitchID src, SwitchID dest, const NetDest } } -void Topology::printStats(ostream& out) const +void Topology::printStats(std::ostream& out) const { for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { m_controller_vector[cntrl]->printStats(out); @@ -252,8 +251,10 @@ void Topology::clearStats() } } -void Topology::printConfig(ostream& out) const +void Topology::printConfig(std::ostream& out) const { + using namespace std; + if (m_print_config == false) return; assert(m_component_latencies.size() > 0); diff --git a/src/mem/ruby/network/simple/Topology.hh b/src/mem/ruby/network/simple/Topology.hh index c274ed330..7202c4446 100644 --- a/src/mem/ruby/network/simple/Topology.hh +++ b/src/mem/ruby/network/simple/Topology.hh @@ -47,6 +47,9 @@ #ifndef TOPOLOGY_H #define TOPOLOGY_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/system/NodeID.hh" @@ -101,11 +104,11 @@ public: void initNetworkPtr(Network* net_ptr); - const string getName() { return m_name; } - void printStats(ostream& out) const; + const std::string getName() { return m_name; } + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; - void print(ostream& out) const { out << "[Topology]"; } + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const { out << "[Topology]"; } protected: // Private Methods @@ -117,13 +120,13 @@ protected: // void makeSwitchesPerChip(Vector< Vector < SwitchID > > &nodePairs, Vector &latencies, Vector &bw_multis, int numberOfChips); - string getDesignStr(); + std::string getDesignStr(); // Private copy constructor and assignment operator Topology(const Topology& obj); Topology& operator=(const Topology& obj); // Data Members (m_ prefix) - string m_name; + std::string m_name; bool m_print_config; NodeID m_nodes; int m_number_of_switches; @@ -141,16 +144,16 @@ protected: }; // Output operator declaration -ostream& operator<<(ostream& out, const Topology& obj); +std::ostream& operator<<(std::ostream& out, const Topology& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Topology& obj) +std::ostream& operator<<(std::ostream& out, const Topology& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } -- cgit v1.2.3