summaryrefslogtreecommitdiff
path: root/src/mem/slicc/symbols/Type.py
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/slicc/symbols/Type.py
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/slicc/symbols/Type.py')
-rw-r--r--src/mem/slicc/symbols/Type.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py
index 3f39ec208..a13cc2385 100644
--- a/src/mem/slicc/symbols/Type.py
+++ b/src/mem/slicc/symbols/Type.py
@@ -202,6 +202,8 @@ class Type(Symbol):
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Allocator.hh"
''')
@@ -323,7 +325,7 @@ ${{dm.type.c_ident}}& get${{dm.ident}}() { return m_${{dm.ident}}; }
void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm.ident}} = local_${{dm.ident}}; }
''')
- code('void print(ostream& out) const;')
+ code('void print(std::ostream& out) const;')
code.dedent()
code(' //private:')
code.indent()
@@ -358,14 +360,14 @@ void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm
code('''
// Output operator declaration
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
@@ -383,7 +385,11 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+
+using namespace std;
''')
if self.isMessage:
@@ -421,6 +427,9 @@ void ${{self.c_ident}}::print(ostream& out) const
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
/** \\enum ${{self.c_ident}}
@@ -443,8 +452,8 @@ enum ${{self.c_ident}} {
code('''
${{self.c_ident}}_NUM
};
-${{self.c_ident}} string_to_${{self.c_ident}}(const string& str);
-string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
+${{self.c_ident}} string_to_${{self.c_ident}}(const std::string& str);
+std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
${{self.c_ident}} &operator++(${{self.c_ident}} &e);
''')
@@ -462,7 +471,7 @@ int ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj);
# Trailer
code('''
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
#endif // ${{self.c_ident}}_H
''')
@@ -477,8 +486,13 @@ ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+#include <string>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+using namespace std;
+
''')
if self.isMachineType: