summaryrefslogtreecommitdiff
path: root/src/mem/ruby/common
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-10 18:33:11 -0800
committerNathan Binkert <nate@binkert.org>2010-03-10 18:33:11 -0800
commit140785d24c27f3afddbe95c9e504e27bf8274290 (patch)
treecc4d27a7d4e417a6cd0f0364cff3db67ca1825b7 /src/mem/ruby/common
parent1badec39a94397397a3c918bfcc75c71efc507ea (diff)
downloadgem5-140785d24c27f3afddbe95c9e504e27bf8274290.tar.xz
ruby: get rid of std-includes.hh
Do not use "using namespace std;" in headers Include header files as needed
Diffstat (limited to 'src/mem/ruby/common')
-rw-r--r--src/mem/ruby/common/Address.hh7
-rw-r--r--src/mem/ruby/common/Consumer.hh10
-rw-r--r--src/mem/ruby/common/DataBlock.hh15
-rw-r--r--src/mem/ruby/common/Debug.cc6
-rw-r--r--src/mem/ruby/common/Debug.hh15
-rw-r--r--src/mem/ruby/common/Global.hh1
-rw-r--r--src/mem/ruby/common/Histogram.cc5
-rw-r--r--src/mem/ruby/common/Histogram.hh14
8 files changed, 52 insertions, 21 deletions
diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh
index 88cd2668a..44dff7d83 100644
--- a/src/mem/ruby/common/Address.hh
+++ b/src/mem/ruby/common/Address.hh
@@ -35,6 +35,8 @@
#define ADDRESS_H
#include <iomanip>
+
+#include "base/hashmap.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh"
#include "mem/ruby/system/NodeID.hh"
@@ -223,11 +225,12 @@ ADDRESS_WIDTH MEMORY_SIZE_BITS PAGE_SIZE_BITS DATA_BLOCK_BITS
inline
void Address::print(ostream& out) const
{
- out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush;
+ using namespace std;
+ out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush;
}
class Address;
-namespace __gnu_cxx {
+namespace __hash_namespace {
template <> struct hash<Address>
{
size_t operator()(const Address &s) const { return (size_t) s.getAddress(); }
diff --git a/src/mem/ruby/common/Consumer.hh b/src/mem/ruby/common/Consumer.hh
index beb50a891..955c1ffa9 100644
--- a/src/mem/ruby/common/Consumer.hh
+++ b/src/mem/ruby/common/Consumer.hh
@@ -39,6 +39,8 @@
#ifndef CONSUMER_H
#define CONSUMER_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
@@ -56,7 +58,7 @@ public:
// void triggerWakeup() { Time time = g_eventQueue_ptr->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }}
void triggerWakeup(RubyEventQueue * eventQueue) { Time time = eventQueue->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }}
virtual void wakeup() = 0;
- virtual void print(ostream& out) const = 0;
+ virtual void print(std::ostream& out) const = 0;
const Time& getLastScheduledWakeup() const { return m_last_scheduled_wakeup; }
void setLastScheduledWakeup(const Time& time) { m_last_scheduled_wakeup = time; }
@@ -70,16 +72,16 @@ private:
// Output operator declaration
inline extern
-ostream& operator<<(ostream& out, const Consumer& obj);
+std::ostream& operator<<(std::ostream& out, const Consumer& obj);
// ******************* Definitions *******************
// Output operator definition
inline extern
-ostream& operator<<(ostream& out, const Consumer& obj)
+std::ostream& operator<<(std::ostream& out, const Consumer& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index d62efc72b..5407033bf 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -30,6 +30,9 @@
#ifndef DATABLOCK_H
#define DATABLOCK_H
+#include <iomanip>
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh"
#include "mem/gems_common/Vector.hh"
@@ -63,7 +66,7 @@ class DataBlock {
void setData(uint8* data, int offset, int len);
void copyPartial(const DataBlock & dblk, int offset, int len);
bool equal(const DataBlock& obj) const;
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
void alloc();
@@ -73,7 +76,7 @@ private:
};
// Output operator declaration
-ostream& operator<<(ostream& out, const DataBlock& obj);
+std::ostream& operator<<(std::ostream& out, const DataBlock& obj);
bool operator==(const DataBlock& obj1, const DataBlock& obj2);
@@ -110,8 +113,10 @@ bool DataBlock::equal(const DataBlock& obj) const
}
inline
-void DataBlock::print(ostream& out) const
+void DataBlock::print(std::ostream& out) const
{
+ using namespace std;
+
int size = RubySystem::getBlockSizeBytes();
out << "[ ";
for (int i = 0; i < size; i++) {
@@ -157,10 +162,10 @@ void DataBlock::copyPartial(const DataBlock & dblk, int offset, int len)
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const DataBlock& obj)
+std::ostream& operator<<(std::ostream& out, const DataBlock& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
diff --git a/src/mem/ruby/common/Debug.cc b/src/mem/ruby/common/Debug.cc
index 68ab2448b..e67dc68ba 100644
--- a/src/mem/ruby/common/Debug.cc
+++ b/src/mem/ruby/common/Debug.cc
@@ -41,9 +41,11 @@
#include "mem/gems_common/util.hh"
#include "base/misc.hh"
+using namespace std;
+
class Debug;
extern Debug* g_debug_ptr;
-std::ostream * debug_cout_ptr;
+ostream *debug_cout_ptr;
bool Debug::m_protocol_trace = false;
struct DebugComponentData
@@ -328,7 +330,7 @@ void Debug::setDebugOutputFile (const char * filename)
if (m_fout.is_open() ) {
m_fout.close ();
}
- m_fout.open (filename, std::ios::out);
+ m_fout.open (filename, ios::out);
if (! m_fout.is_open() ) {
cerr << "setDebugOutputFile: can't open file " << filename << endl;
}
diff --git a/src/mem/ruby/common/Debug.hh b/src/mem/ruby/common/Debug.hh
index 5fb4d412f..a7b1a15d1 100644
--- a/src/mem/ruby/common/Debug.hh
+++ b/src/mem/ruby/common/Debug.hh
@@ -35,6 +35,8 @@
#define __MEM_RUBY_DEBUG_HH__
#include <unistd.h>
+
+#include <fstream>
#include <iostream>
#include <string>
#include <vector>
@@ -133,7 +135,7 @@ extern inline
std::ostream& operator<<(std::ostream& out, const Debug& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
@@ -151,6 +153,7 @@ const bool ASSERT_FLAG = true;
#undef ASSERT
#define ASSERT(EXPR)\
{\
+ using namespace std;\
if (ASSERT_FLAG) {\
if (!(EXPR)) {\
cerr << "failed assertion '"\
@@ -179,6 +182,7 @@ const bool ASSERT_FLAG = true;
#define BREAK(X)\
{\
+ using namespace std;\
cerr << "breakpoint '"\
<< #X << "' reached at fn "\
<< __PRETTY_FUNCTION__ << " in "\
@@ -195,6 +199,7 @@ const bool ASSERT_FLAG = true;
#define ERROR_MSG(MESSAGE)\
{\
+ using namespace std;\
if (ERROR_MESSAGE_FLAG) {\
cerr << "Fatal Error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
@@ -212,6 +217,7 @@ const bool ASSERT_FLAG = true;
#define WARN_MSG(MESSAGE)\
{\
+ using namespace std;\
if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
@@ -228,6 +234,7 @@ const bool ASSERT_FLAG = true;
#define WARN_EXPR(EXPR)\
{\
+ using namespace std;\
if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
@@ -246,6 +253,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_MSG(module, priority, MESSAGE)\
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << "Debug: in fn "\
@@ -259,6 +267,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_EXPR(module, priority, EXPR)\
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << "Debug: in fn "\
@@ -273,6 +282,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_NEWLINE(module, priority)\
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << endl << flush;\
@@ -282,6 +292,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_SLICC(priority, LINE, MESSAGE)\
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(SLICC_COMP, priority)) {\
(* debug_cout_ptr) << (LINE) << (MESSAGE) << endl << flush;\
@@ -291,6 +302,7 @@ const bool ASSERT_FLAG = true;
#define DEBUG_OUT( rest... ) \
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
cout << "Debug: in fn "\
<< __PRETTY_FUNCTION__\
@@ -302,6 +314,7 @@ const bool ASSERT_FLAG = true;
#define ERROR_OUT( rest... ) \
{\
+ using namespace std;\
if (ERROR_MESSAGE_FLAG) {\
cout << "error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
diff --git a/src/mem/ruby/common/Global.hh b/src/mem/ruby/common/Global.hh
index 591ffed1e..16465656d 100644
--- a/src/mem/ruby/common/Global.hh
+++ b/src/mem/ruby/common/Global.hh
@@ -66,7 +66,6 @@ const bool TWO_LEVEL_CACHE = true;
// external includes for all classes
#include "mem/ruby/common/TypeDefines.hh"
-#include "mem/gems_common/std-includes.hh"
#include "mem/ruby/common/Debug.hh"
// simple type declarations
diff --git a/src/mem/ruby/common/Histogram.cc b/src/mem/ruby/common/Histogram.cc
index 7f9a7027e..2a25cfeb1 100644
--- a/src/mem/ruby/common/Histogram.cc
+++ b/src/mem/ruby/common/Histogram.cc
@@ -32,8 +32,13 @@
*
*/
+#include <cmath>
+#include <iomanip>
+
#include "mem/ruby/common/Histogram.hh"
+using namespace std;
+
Histogram::Histogram(int binsize, int bins)
{
m_binsize = binsize;
diff --git a/src/mem/ruby/common/Histogram.hh b/src/mem/ruby/common/Histogram.hh
index 59afde867..64247d64a 100644
--- a/src/mem/ruby/common/Histogram.hh
+++ b/src/mem/ruby/common/Histogram.hh
@@ -37,6 +37,8 @@
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
@@ -61,9 +63,9 @@ public:
int64 getTotal() const { return m_sumSamples; }
int64 getData(int index) const { return m_data[index]; }
- void printWithMultiplier(ostream& out, double multiplier) const;
- void printPercent(ostream& out) const;
- void print(ostream& out) const;
+ void printWithMultiplier(std::ostream& out, double multiplier) const;
+ void printPercent(std::ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private Methods
@@ -88,16 +90,16 @@ private:
bool node_less_then_eq(const Histogram* n1, const Histogram* n2);
// Output operator declaration
-ostream& operator<<(ostream& out, const Histogram& obj);
+std::ostream& operator<<(std::ostream& out, const Histogram& obj);
// ******************* Definitions *******************
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const Histogram& obj)
+std::ostream& operator<<(std::ostream& out, const Histogram& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}