changeset 48a19d52d939 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=48a19d52d939
description:
        ruby: get rid of std-includes.hh
        Do not use "using namespace std;" in headers
        Include header files as needed

diffstat:

45 files changed, 312 insertions(+), 239 deletions(-)
src/cpu/rubytest/CheckTable.hh                                    |   10 +
src/mem/gems_common/Map.hh                                        |   37 ++++--
src/mem/gems_common/PrioHeap.hh                                   |   12 +-
src/mem/gems_common/RefCnt.hh                                     |   12 +-
src/mem/gems_common/Vector.hh                                     |   18 +--
src/mem/gems_common/std-includes.hh                               |   57 
----------
src/mem/gems_common/util.cc                                       |    6 -
src/mem/gems_common/util.hh                                       |   12 +-
src/mem/ruby/buffers/MessageBuffer.hh                             |   23 ++--
src/mem/ruby/buffers/MessageBufferNode.cc                         |    3 
src/mem/ruby/buffers/MessageBufferNode.hh                         |   10 +
src/mem/ruby/common/Address.hh                                    |    7 -
src/mem/ruby/common/Consumer.hh                                   |   10 +
src/mem/ruby/common/DataBlock.hh                                  |   15 +-
src/mem/ruby/common/Debug.cc                                      |    6 -
src/mem/ruby/common/Debug.hh                                      |   15 ++
src/mem/ruby/common/Global.hh                                     |    1 
src/mem/ruby/common/Histogram.cc                                  |    5 
src/mem/ruby/common/Histogram.hh                                  |   14 +-
src/mem/ruby/eventqueue/RubyEventQueue.hh                         |   10 +
src/mem/ruby/eventqueue/RubyEventQueueNode.cc                     |    2 
src/mem/ruby/eventqueue/RubyEventQueueNode.hh                     |   10 +
src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc  |    2 
src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc |    2 
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 ++-
src/mem/ruby/profiler/CacheProfiler.hh                            |   17 +-
src/mem/ruby/profiler/MemCntrlProfiler.cc                         |    2 
src/mem/ruby/profiler/MemCntrlProfiler.hh                         |   17 +-
src/mem/ruby/profiler/Profiler.cc                                 |    7 -
src/mem/ruby/recorder/CacheRecorder.hh                            |   18 +--
src/mem/ruby/recorder/Tracer.cc                                   |    6 -
src/mem/ruby/recorder/Tracer.hh                                   |   15 +-
src/mem/ruby/slicc_interface/Message.hh                           |   10 +
src/mem/ruby/system/MachineID.hh                                  |   11 +
src/mem/ruby/system/MemoryNode.cc                                 |    2 
src/mem/ruby/system/MemoryNode.hh                                 |   10 +
src/mem/ruby/system/NodeID.hh                                     |    4 
src/mem/ruby/system/PseudoLRUPolicy.hh                            |    2 
src/mem/slicc/symbols/StateMachine.py                             |   33 ++++-
src/mem/slicc/symbols/Type.py                                     |   28 +++-

diffs (truncated from 1966 to 300 lines):

diff -r eca0b78f6d96 -r 48a19d52d939 src/cpu/rubytest/CheckTable.hh
--- a/src/cpu/rubytest/CheckTable.hh    Wed Mar 10 16:22:27 2010 -0800
+++ b/src/cpu/rubytest/CheckTable.hh    Wed Mar 10 18:33:11 2010 -0800
@@ -31,6 +31,8 @@
 #ifndef CHECKTABLE_H
 #define CHECKTABLE_H
 
+#include <iostream>
+
 #include "mem/ruby/common/Global.hh"
 #include "mem/gems_common/Vector.hh"
 
@@ -57,7 +59,7 @@
   //  bool isTableFull() const;
   // Need a method to select a check or retrieve a check
 
-  void print(ostream& out) const;
+  void print(std::ostream& out) const;
 private:
   // Private Methods
   void addCheck(const Address& address);
@@ -75,16 +77,16 @@
 };
 
 // Output operator declaration
-ostream& operator<<(ostream& out, const CheckTable& obj);
+std::ostream& operator<<(std::ostream& out, const CheckTable& obj);
 
 // ******************* Definitions *******************
 
 // Output operator definition
 extern inline 
-ostream& operator<<(ostream& out, const CheckTable& obj)
+std::ostream& operator<<(std::ostream& out, const CheckTable& obj)
 {
   obj.print(out);
-  out << flush;
+  out << std::flush;
   return out;
 }
 
diff -r eca0b78f6d96 -r 48a19d52d939 src/mem/gems_common/Map.hh
--- a/src/mem/gems_common/Map.hh        Wed Mar 10 16:22:27 2010 -0800
+++ b/src/mem/gems_common/Map.hh        Wed Mar 10 18:33:11 2010 -0800
@@ -34,12 +34,19 @@
 #ifndef MAP_H
 #define MAP_H
 
+#include <iostream>
+
 #include "base/hashmap.hh"
 #include "mem/gems_common/Vector.hh"
 
 template <class KEY_TYPE, class VALUE_TYPE>
 class Map
 {
+  private:
+    typedef typename m5::hash_map<KEY_TYPE, VALUE_TYPE> MapType;
+    typedef typename MapType::iterator iterator;
+    typedef typename MapType::const_iterator const_iterator;
+
 public:
   Map() { /* empty */ }
   ~Map() { /* empty */ }
@@ -54,7 +61,7 @@
   void deleteValues();
   VALUE_TYPE& lookup(const KEY_TYPE& key) const;
   void clear() { m_map.clear(); }
-  void print(ostream& out) const;
+    void print(std::ostream& out) const;
 
   // Synonyms
   void remove(const KEY_TYPE& key) { erase(key); }
@@ -73,7 +80,8 @@
 };
 
 template <class KEY_TYPE, class VALUE_TYPE>
-ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map);
+std::ostream&
+operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map);
 
 // *********************
 
@@ -94,7 +102,7 @@
 VALUE_TYPE& Map<KEY_TYPE, VALUE_TYPE>::lookup(const KEY_TYPE& key) const
 {
   if (!exist(key))
-    cerr << *this << " is looking for " << key << endl;
+    std::cerr << *this << " is looking for " << key << std::endl;
   assert(exist(key));
   return m_map[key];
 }
@@ -103,7 +111,7 @@
 Vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const
 {
   Vector<KEY_TYPE> keys;
-  typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
+  const_iterator iter;
   for (iter = m_map.begin(); iter != m_map.end(); iter++) {
     keys.insertAtBottom((*iter).first);
   }
@@ -114,8 +122,8 @@
 Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
 {
   Vector<VALUE_TYPE> values;
-  typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
-  pair<KEY_TYPE, VALUE_TYPE> p;
+  const_iterator iter;
+  std::pair<KEY_TYPE, VALUE_TYPE> p;
 
   for (iter = m_map.begin(); iter != m_map.end(); iter++) {
     p = *iter;
@@ -127,8 +135,8 @@
 template <class KEY_TYPE, class VALUE_TYPE>
 void Map<KEY_TYPE, VALUE_TYPE>::deleteKeys()
 {
-  typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
-  pair<KEY_TYPE, VALUE_TYPE> p;
+  const_iterator iter;
+  std::pair<KEY_TYPE, VALUE_TYPE> p;
 
   for (iter = m_map.begin(); iter != m_map.end(); iter++) {
     p = *iter;
@@ -139,8 +147,8 @@
 template <class KEY_TYPE, class VALUE_TYPE>
 void Map<KEY_TYPE, VALUE_TYPE>::deleteValues()
 {
-  typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
-  pair<KEY_TYPE, VALUE_TYPE> p;
+  const_iterator iter;
+  std::pair<KEY_TYPE, VALUE_TYPE> p;
 
   for (iter = m_map.begin(); iter != m_map.end(); iter++) {
     p = *iter;
@@ -149,10 +157,10 @@
 }
 
 template <class KEY_TYPE, class VALUE_TYPE>
-void Map<KEY_TYPE, VALUE_TYPE>::print(ostream& out) const
+void Map<KEY_TYPE, VALUE_TYPE>::print(std::ostream& out) const
 {
-  typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
-  pair<KEY_TYPE, VALUE_TYPE> p;
+  const_iterator iter;
+  std::pair<KEY_TYPE, VALUE_TYPE> p;
 
   out << "[";
   for (iter = m_map.begin(); iter != m_map.end(); iter++) {
@@ -164,7 +172,8 @@
 }
 
 template <class KEY_TYPE, class VALUE_TYPE>
-ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map)
+std::ostream&
+operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map)
 {
   map.print(out);
   return out;
diff -r eca0b78f6d96 -r 48a19d52d939 src/mem/gems_common/PrioHeap.hh
--- a/src/mem/gems_common/PrioHeap.hh   Wed Mar 10 16:22:27 2010 -0800
+++ b/src/mem/gems_common/PrioHeap.hh   Wed Mar 10 18:33:11 2010 -0800
@@ -29,6 +29,8 @@
 #ifndef PRIOHEAP_H
 #define PRIOHEAP_H
 
+#include <iostream>
+
 #include "mem/gems_common/Vector.hh"
 
 typedef unsigned int HeapIndex;
@@ -49,7 +51,7 @@
   const TYPE& peekMin() const;
   const TYPE& peekElement(int index) const;
   TYPE extractMin();
-  void print(ostream& out) const;
+  void print(std::ostream& out) const;
 private:
   // Private Methods
   bool verifyHeap() const;
@@ -67,7 +69,7 @@
 
 // Output operator declaration
 template <class TYPE>
-ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj);
+std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj);
 
 // ******************* Helper Functions *******************
 inline
@@ -210,7 +212,7 @@
 }
 
 template <class TYPE>
-void PrioHeap<TYPE>::print(ostream& out) const
+void PrioHeap<TYPE>::print(std::ostream& out) const
 {
   Vector<TYPE> copyHeap(m_heap);
 
@@ -239,10 +241,10 @@
 
 // Output operator definition
 template <class TYPE>
-ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj)
+std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj)
 {
   obj.print(out);
-  out << flush;
+  out << std::flush;
   return out;
 }
 
diff -r eca0b78f6d96 -r 48a19d52d939 src/mem/gems_common/RefCnt.hh
--- a/src/mem/gems_common/RefCnt.hh     Wed Mar 10 16:22:27 2010 -0800
+++ b/src/mem/gems_common/RefCnt.hh     Wed Mar 10 18:33:11 2010 -0800
@@ -29,6 +29,8 @@
 #ifndef REFCNT_H
 #define REFCNT_H
 
+#include <iostream>
+
 template <class TYPE>
 class RefCnt {
 public:
@@ -44,7 +46,7 @@
   TYPE* ref() { return m_data_ptr; }
   TYPE* mod_ref() const { return m_data_ptr; }
   void freeRef();
-  void print(ostream& out) const;
+  void print(std::ostream& out) const;
 
   // Public copy constructor and assignment operator
   RefCnt(const RefCnt& obj);
@@ -61,7 +63,7 @@
 // Output operator declaration
 template <class TYPE>
 inline
-ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj);
+std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj);
 
 // ******************* Definitions *******************
 
@@ -103,7 +105,7 @@
 
 template <class TYPE>
 inline
-void RefCnt<TYPE>::print(ostream& out) const
+void RefCnt<TYPE>::print(std::ostream& out) const
 {
   if (m_data_ptr == NULL) {
     out << "[RefCnt: Null]";
@@ -150,10 +152,10 @@
 // Output operator definition
 template <class TYPE>
 inline
-ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj)
+std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj)
 {
   obj.print(out);
-  out << flush;
+  out << std::flush;
   return out;
 }
 
diff -r eca0b78f6d96 -r 48a19d52d939 src/mem/gems_common/Vector.hh
--- a/src/mem/gems_common/Vector.hh     Wed Mar 10 16:22:27 2010 -0800
+++ b/src/mem/gems_common/Vector.hh     Wed Mar 10 18:33:11 2010 -0800
@@ -38,7 +38,9 @@
 #ifndef VECTOR_H
 #define VECTOR_H
 
-#include "mem/gems_common/std-includes.hh"
+#include <cassert>
+#include <iostream>
+#include <vector>
 
 template <class TYPE>
 class Vector
@@ -63,7 +65,7 @@
                          // elements and sets them to NULL, can only
                          // be used when the TYPE is a pointer type.
   void removeFromTop(int num);  // removes elements from top
-  void print(ostream& out) const;
+  void print(std::ostream& out) const;
 
 
   // Array Reference operator overloading
@@ -84,7 +86,7 @@
 };
 
 template <class TYPE>
-ostream& operator<<(ostream& out, const Vector<TYPE>& vec);
+std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec);
 
 // *********************
 
@@ -139,7 +141,7 @@
 {
   // FIXME - this should also decrease or shrink the size of the array at some 
point.
   if (new_size > m_max_size) {
-    grow(max((m_max_size+1)*2, new_size));
+    grow(std::max((m_max_size+1)*2, new_size));
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to