#include "base/bitunion.hh"
#include "base/cprintf.hh"
-using namespace std;
-
namespace {
BitUnion64(SixtyFour)
#include "base/logging.hh"
-using namespace std;
-
namespace
{
#include "base/str.hh"
#include "base/types.hh"
-using namespace std;
-
-string
+std::string
__get_hostname()
{
char host[256];
return host;
}
-string &
+std::string &
hostname()
{
- static string hostname = __get_hostname();
+ static std::string hostname = __get_hostname();
return hostname;
}
#include "base/logging.hh"
#include "base/types.hh"
-using namespace std;
namespace Net {
EthAddr::EthAddr()
{
- memset(data, 0, ETH_ADDR_LEN);
+ std::memset(data, 0, ETH_ADDR_LEN);
}
EthAddr::EthAddr(const uint8_t ea[ETH_ADDR_LEN])
int bytes[ETH_ADDR_LEN == 6 ? ETH_ADDR_LEN : -1];
if (sscanf(addr.c_str(), "%x:%x:%x:%x:%x:%x", &bytes[0], &bytes[1],
&bytes[2], &bytes[3], &bytes[4], &bytes[5]) != ETH_ADDR_LEN) {
- memset(data, 0xff, ETH_ADDR_LEN);
+ std::memset(data, 0xff, ETH_ADDR_LEN);
return;
}
for (int i = 0; i < ETH_ADDR_LEN; ++i) {
if (bytes[i] & ~0xff) {
- memset(data, 0xff, ETH_ADDR_LEN);
+ std::memset(data, 0xff, ETH_ADDR_LEN);
return;
}
}
}
-string
+std::string
EthAddr::string() const
{
- stringstream stream;
+ std::stringstream stream;
stream << *this;
return stream.str();
}
bool
operator==(const EthAddr &left, const EthAddr &right)
{
- return !memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
+ return !std::memcmp(left.bytes(), right.bytes(), ETH_ADDR_LEN);
}
-ostream &
-operator<<(ostream &stream, const EthAddr &ea)
+ std::ostream &
+operator<<(std::ostream &stream, const EthAddr &ea)
{
const uint8_t *a = ea.addr();
ccprintf(stream, "%x:%x:%x:%x:%x:%x", a[0], a[1], a[2], a[3], a[4], a[5]);
return stream;
}
-string
+std::string
IpAddress::string() const
{
- stringstream stream;
+ std::stringstream stream;
stream << *this;
return stream.str();
}
return left.ip() == right.ip();
}
-ostream &
-operator<<(ostream &stream, const IpAddress &ia)
+std::ostream &
+operator<<(std::ostream &stream, const IpAddress &ia)
{
uint32_t ip = ia.ip();
ccprintf(stream, "%x.%x.%x.%x",
return stream;
}
-string
+std::string
IpNetmask::string() const
{
- stringstream stream;
+ std::stringstream stream;
stream << *this;
return stream.str();
}
(left.netmask() == right.netmask());
}
-ostream &
-operator<<(ostream &stream, const IpNetmask &in)
+std::ostream &
+operator<<(std::ostream &stream, const IpNetmask &in)
{
ccprintf(stream, "%s/%d", (const IpAddress &)in, in.netmask());
return stream;
}
-string
+std::string
IpWithPort::string() const
{
- stringstream stream;
+ std::stringstream stream;
stream << *this;
return stream.str();
}
return (left.ip() == right.ip()) && (left.port() == right.port());
}
-ostream &
-operator<<(ostream &stream, const IpWithPort &iwp)
+std::ostream &
+operator<<(std::ostream &stream, const IpWithPort &iwp)
{
ccprintf(stream, "%s:%d", (const IpAddress &)iwp, iwp.port());
return stream;
}
bool
-IpHdr::options(vector<const IpOpt *> &vec) const
+IpHdr::options(std::vector<const IpOpt *> &vec) const
{
vec.clear();
}
bool
-TcpHdr::options(vector<const TcpOpt *> &vec) const
+TcpHdr::options(std::vector<const TcpOpt *> &vec) const
{
vec.clear();
#include "base/str.hh"
-using namespace std;
-
IniFile::IniFile()
{}
}
bool
-IniFile::load(const string &file)
+IniFile::load(const std::string &file)
{
- ifstream f(file.c_str());
+ std::ifstream f(file.c_str());
if (!f.is_open())
return false;
}
-const string &
+const std::string &
IniFile::Entry::getValue() const
{
referenced = true;
bool
IniFile::Section::add(const std::string &assignment)
{
- string::size_type offset = assignment.find('=');
- if (offset == string::npos) {
+ std::string::size_type offset = assignment.find('=');
+ if (offset == std::string::npos) {
// no '=' found
- cerr << "Can't parse .ini line " << assignment << endl;
+ std::cerr << "Can't parse .ini line " << assignment << std::endl;
return false;
}
// if "+=" rather than just "=" then append value
bool append = (assignment[offset-1] == '+');
- string entryName = assignment.substr(0, append ? offset-1 : offset);
- string value = assignment.substr(offset + 1);
+ std::string entryName = assignment.substr(0, append ? offset-1 : offset);
+ std::string value = assignment.substr(offset + 1);
eat_white(entryName);
eat_white(value);
IniFile::Section *
-IniFile::addSection(const string §ionName)
+IniFile::addSection(const std::string §ionName)
{
SectionTable::iterator i = table.find(sectionName);
IniFile::Section *
-IniFile::findSection(const string §ionName) const
+IniFile::findSection(const std::string §ionName) const
{
SectionTable::const_iterator i = table.find(sectionName);
// Take string of the form "<section>:<parameter>=<value>" and add to
// database. Return true if successful, false if parse error.
bool
-IniFile::add(const string &str)
+IniFile::add(const std::string &str)
{
// find ':'
- string::size_type offset = str.find(':');
- if (offset == string::npos) // no ':' found
+ std::string::size_type offset = str.find(':');
+ if (offset == std::string::npos) // no ':' found
return false;
- string sectionName = str.substr(0, offset);
- string rest = str.substr(offset + 1);
+ std::string sectionName = str.substr(0, offset);
+ std::string rest = str.substr(offset + 1);
eat_white(sectionName);
Section *s = addSection(sectionName);
}
bool
-IniFile::load(istream &f)
+IniFile::load(std::istream &f)
{
Section *section = NULL;
while (!f.eof()) {
- f >> ws; // Eat whitespace
+ f >> std::ws; // Eat whitespace
if (f.eof()) {
break;
}
- string line;
+ std::string line;
getline(f, line);
if (line.size() == 0)
continue;
int last = line.size() - 1;
if (line[0] == '[' && line[last] == ']') {
- string sectionName = line.substr(1, last - 1);
+ std::string sectionName = line.substr(1, last - 1);
eat_white(sectionName);
section = addSection(sectionName);
continue;
}
bool
-IniFile::find(const string §ionName, const string &entryName,
- string &value) const
+IniFile::find(const std::string §ionName, const std::string &entryName,
+ std::string &value) const
{
Section *section = findSection(sectionName);
if (section == NULL)
}
bool
-IniFile::entryExists(const string §ionName, const string &entryName) const
+IniFile::entryExists(const std::string §ionName,
+ const std::string &entryName) const
{
Section *section = findSection(sectionName);
}
bool
-IniFile::sectionExists(const string §ionName) const
+IniFile::sectionExists(const std::string §ionName) const
{
return findSection(sectionName) != NULL;
}
bool
-IniFile::Section::printUnreferenced(const string §ionName)
+IniFile::Section::printUnreferenced(const std::string §ionName)
{
bool unref = false;
bool search_unref_entries = false;
- vector<string> unref_ok_entries;
+ std::vector<std::string> unref_ok_entries;
Entry *entry = findEntry("unref_entries_ok");
if (entry != NULL) {
for (EntryTable::iterator ei = table.begin();
ei != table.end(); ++ei) {
- const string &entryName = ei->first;
+ const std::string &entryName = ei->first;
entry = ei->second;
if (entryName == "unref_section_ok" ||
continue;
}
- cerr << "Parameter " << sectionName << ":" << entryName
- << " not referenced." << endl;
+ std::cerr << "Parameter " << sectionName << ":" << entryName
+ << " not referenced." << std::endl;
unref = true;
}
}
void
-IniFile::getSectionNames(vector<string> &list) const
+IniFile::getSectionNames(std::vector<std::string> &list) const
{
for (SectionTable::const_iterator i = table.begin();
i != table.end(); ++i)
for (SectionTable::iterator i = table.begin();
i != table.end(); ++i) {
- const string §ionName = i->first;
+ const std::string §ionName = i->first;
Section *section = i->second;
if (!section->isReferenced()) {
if (section->findEntry("unref_section_ok") == NULL) {
- cerr << "Section " << sectionName << " not referenced."
- << endl;
+ std::cerr << "Section " << sectionName << " not referenced."
+ << std::endl;
unref = true;
}
}
void
-IniFile::Section::dump(const string §ionName)
+IniFile::Section::dump(const std::string §ionName)
{
for (EntryTable::iterator ei = table.begin();
ei != table.end(); ++ei) {
- cout << sectionName << ": " << (*ei).first << " => "
- << (*ei).second->getValue() << "\n";
+ std::cout << sectionName << ": " << (*ei).first << " => "
+ << (*ei).second->getValue() << "\n";
}
}
#include "base/inifile.hh"
-using namespace std;
-
namespace {
std::istringstream iniFile(R"ini_file(
#include "base/types.hh"
#include "sim/serialize.hh"
-using namespace std;
-
namespace Loader
{
}
bool
-SymbolTable::load(const string &filename)
+SymbolTable::load(const std::string &filename)
{
- string buffer;
- ifstream file(filename.c_str());
+ std::string buffer;
+ std::ifstream file(filename.c_str());
if (!file)
fatal("file error: Can't open symbol table file %s\n", filename);
if (buffer.empty())
continue;
- string::size_type idx = buffer.find(',');
- if (idx == string::npos)
+ std::string::size_type idx = buffer.find(',');
+ if (idx == std::string::npos)
return false;
- string address = buffer.substr(0, idx);
+ std::string address = buffer.substr(0, idx);
eat_white(address);
if (address.empty())
return false;
- string name = buffer.substr(idx + 1);
+ std::string name = buffer.substr(idx + 1);
eat_white(name);
if (name.empty())
return false;
}
void
-SymbolTable::serialize(const string &base, CheckpointOut &cp) const
+SymbolTable::serialize(const std::string &base, CheckpointOut &cp) const
{
paramOut(cp, base + ".size", symbols.size());
}
void
-SymbolTable::unserialize(const string &base, CheckpointIn &cp,
+SymbolTable::unserialize(const std::string &base, CheckpointIn &cp,
Symbol::Binding default_binding)
{
clear();
#include "base/str.hh"
-using namespace std;
-
ObjectMatch::ObjectMatch()
{
}
-ObjectMatch::ObjectMatch(const string &expr)
+ObjectMatch::ObjectMatch(const std::string &expr)
{
setExpression(expr);
}
}
void
-ObjectMatch::setExpression(const string &expr)
+ObjectMatch::setExpression(const std::string &expr)
{
tokens.resize(1);
tokenize(tokens[0], expr, '.');
}
void
-ObjectMatch::setExpression(const vector<string> &expr)
+ObjectMatch::setExpression(const std::vector<std::string> &expr)
{
if (expr.empty()) {
tokens.resize(0);
} else {
tokens.resize(expr.size());
- for (vector<string>::size_type i = 0; i < expr.size(); ++i)
+ for (std::vector<std::string>::size_type i = 0; i < expr.size(); ++i)
tokenize(tokens[i], expr[i], '.');
}
}
* expression code
*/
bool
-ObjectMatch::domatch(const string &name) const
+ObjectMatch::domatch(const std::string &name) const
{
- vector<string> name_tokens;
+ std::vector<std::string> name_tokens;
tokenize(name_tokens, name, '.');
int ntsize = name_tokens.size();
int num_expr = tokens.size();
for (int i = 0; i < num_expr; ++i) {
- const vector<string> &token = tokens[i];
+ const std::vector<std::string> &token = tokens[i];
int jstop = token.size();
bool match = true;
if (j >= ntsize)
break;
- const string &var = token[j];
+ const std::string &var = token[j];
if (var != "*" && var != name_tokens[j]) {
match = false;
break;
#include "base/logging.hh"
-using namespace std;
-
OutputDirectory simout;
}
}
-OutputStream OutputDirectory::stdout("stdout", &cout);
-OutputStream OutputDirectory::stderr("stderr", &cerr);
+OutputStream OutputDirectory::stdout("stdout", &std::cout);
+OutputStream OutputDirectory::stderr("stderr", &std::cerr);
/**
* @file This file manages creating / deleting output files for the simulator.
}
OutputStream *
-OutputDirectory::checkForStdio(const string &name)
+OutputDirectory::checkForStdio(const std::string &name)
{
if (name == "cerr" || name == "stderr")
return &stderr;
}
void
-OutputDirectory::setDirectory(const string &d)
+OutputDirectory::setDirectory(const std::string &d)
{
- const string old_dir(dir);
+ const std::string old_dir(dir);
dir = d;
}
-const string &
+const std::string &
OutputDirectory::directory() const
{
if (dir.empty())
return dir;
}
-string
-OutputDirectory::resolve(const string &name) const
+std::string
+OutputDirectory::resolve(const std::string &name) const
{
return !isAbsolute(name) ? dir + name : name;
}
OutputStream *
-OutputDirectory::create(const string &name, bool binary, bool no_gz)
+OutputDirectory::create(const std::string &name, bool binary, bool no_gz)
{
OutputStream *file = checkForStdio(name);
if (file)
return file;
- const ios_base::openmode mode(
- ios::trunc | (binary ? ios::binary : (ios::openmode)0));
+ const std::ios_base::openmode mode(
+ std::ios::trunc | (binary ? std::ios::binary : (std::ios::openmode)0));
const bool recreateable(!isAbsolute(name));
return open(name, mode, recreateable, no_gz);
OutputStream *
OutputDirectory::open(const std::string &name,
- ios_base::openmode mode,
+ std::ios_base::openmode mode,
bool recreateable,
bool no_gz)
{
mode |= std::ios::out;
os = new OutputFile<gzofstream>(*this, name, mode, recreateable);
} else {
- os = new OutputFile<ofstream>(*this, name, mode, recreateable);
+ os = new OutputFile<std::ofstream>(*this, name, mode, recreateable);
}
files[name] = os;
}
OutputStream *
-OutputDirectory::find(const string &name) const
+OutputDirectory::find(const std::string &name) const
{
OutputStream *file = checkForStdio(name);
if (file)
}
bool
-OutputDirectory::isFile(const string &name) const
+OutputDirectory::isFile(const std::string &name) const
{
// definitely a file if in our data structure
if (find(name) != NULL) return true;
}
OutputDirectory *
-OutputDirectory::createSubdirectory(const string &name)
+OutputDirectory::createSubdirectory(const std::string &name)
{
- const string new_dir = resolve(name);
- if (new_dir.find(directory()) == string::npos)
+ const std::string new_dir = resolve(name);
+ if (new_dir.find(directory()) == std::string::npos)
fatal("Attempting to create subdirectory not in m5 output dir\n");
OutputDirectory *dir(new OutputDirectory(new_dir));
}
void
-OutputDirectory::remove(const string &name, bool recursive)
+OutputDirectory::remove(const std::string &name, bool recursive)
{
- const string fname = resolve(name);
+ const std::string fname = resolve(name);
- if (fname.find(directory()) == string::npos)
+ if (fname.find(directory()) == std::string::npos)
fatal("Attempting to remove file/dir not in output dir\n");
if (isFile(fname)) {
#include "sim/eventq.hh"
#include "sim/serialize.hh"
-using namespace std;
-
PollQueue pollQueue;
/////////////////////////////////////////////////////
#include "base/refcnt.hh"
-using namespace std;
-
namespace {
class TestRC;
-typedef list<TestRC *> LiveList;
+typedef std::list<TestRC *> LiveList;
LiveList liveList;
int
-liveListSize(){
+liveListSize()
+{
return liveList.size();
}
#include "sim/full_system.hh"
#include "sim/system.hh"
-using namespace std;
using namespace TheISA;
static const char GDBStart = '$';
static const char GDBGoodP = '+';
static const char GDBBadP = '-';
-vector<BaseRemoteGDB *> debuggers;
+std::vector<BaseRemoteGDB *> debuggers;
class HardBreakpoint : public PCEvent
{
// Exception to throw when an error needs to be reported to the client.
struct CmdError
{
- string error;
+ std::string error;
CmdError(std::string _error) : error(_error)
{}
};
delete dataEvent;
}
-string
+std::string
BaseRemoteGDB::name()
{
return sys->name() + ".remote_gdb";
connectEvent = new ConnectEvent(this, listener.getfd(), POLLIN);
pollQueue.schedule(connectEvent);
- ccprintf(cerr, "%d: %s: listening for remote gdb on port %d\n",
+ ccprintf(std::cerr, "%d: %s: listening for remote gdb on port %d\n",
curTick(), name(), _port);
}
bool
BaseRemoteGDB::cmd_query_var(GdbCommand::Context &ctx)
{
- string s(ctx.data, ctx.len - 1);
- string xfer_read_prefix = "Xfer:features:read:";
+ std::string s(ctx.data, ctx.len - 1);
+ std::string xfer_read_prefix = "Xfer:features:read:";
if (s.rfind("Supported:", 0) == 0) {
std::ostringstream oss;
// This reply field mandatory. We can receive arbitrarily
#include "base/types.hh"
#include "sim/byteswap.hh"
-using namespace std;
-
bool ListenSocket::listeningDisabled = false;
bool ListenSocket::anyListening = false;
htobe<in_addr_t>(bindToLoopback ? INADDR_LOOPBACK : INADDR_ANY);
sockaddr.sin_port = htons(port);
// finally clear sin_zero
- memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
+ std::memset(&sockaddr.sin_zero, 0, sizeof(sockaddr.sin_zero));
int ret = ::bind(fd, (struct sockaddr *)&sockaddr, sizeof (sockaddr));
if (ret != 0) {
if (ret == -1 && errno != EADDRINUSE)
#include "base/trace.hh"
#include "sim/root.hh"
-using namespace std;
-
namespace Stats {
std::string Info::separatorString = "::";
// We wrap these in a function to make sure they're built in time.
-list<Info *> &
+std::list<Info *> &
statsList()
{
- static list<Info *> the_list;
+ static std::list<Info *> the_list;
return the_list;
}
statsList().push_back(info);
#ifndef NDEBUG
- pair<MapType::iterator, bool> result =
+ std::pair<MapType::iterator, bool> result =
#endif
- statsMap().insert(make_pair(this, info));
+ statsMap().insert(std::make_pair(this, info));
assert(result.second && "this should never fail");
assert(statsMap().find(this) != statsMap().end());
}
}
bool
-validateStatName(const string &name)
+validateStatName(const std::string &name)
{
if (name.empty())
return false;
- vector<string> vec;
+ std::vector<std::string> vec;
tokenize(vec, name, '.');
- vector<string>::const_iterator item = vec.begin();
+ std::vector<std::string>::const_iterator item = vec.begin();
while (item != vec.end()) {
if (item->empty())
return false;
- string::const_iterator c = item->begin();
+ std::string::const_iterator c = item->begin();
// The first character is different
if (!isalpha(*c) && *c != '_')
}
void
-Info::setName(const string &name)
+Info::setName(const std::string &name)
{
setName(nullptr, name);
}
void
-Info::setName(const Group *parent, const string &name)
+Info::setName(const Group *parent, const std::string &name)
{
if (!validateStatName(name))
panic("invalid stat name '%s'", name);
bool
Info::less(Info *stat1, Info *stat2)
{
- const string &name1 = stat1->name;
- const string &name2 = stat2->name;
+ const std::string &name1 = stat1->name;
+ const std::string &name2 = stat2->name;
- vector<string> v1;
- vector<string> v2;
+ std::vector<std::string> v1;
+ std::vector<std::string> v2;
tokenize(v1, name1, '.');
tokenize(v2, name2, '.');
- size_type last = min(v1.size(), v2.size()) - 1;
+ size_type last = std::min(v1.size(), v2.size()) - 1;
for (off_type i = 0; i < last; ++i)
if (v1[i] != v2[i])
return v1[i] < v2[i];
return true;
}
-string
+std::string
Formula::str() const
{
return root ? root->str() : "";
#include "base/stats/info.hh"
#include "base/str.hh"
-using namespace std;
-
#ifndef NAN
float __nan();
/** Define Not a number. */
panic("stream already set!");
mystream = true;
- stream = new ofstream(file.c_str(), ios::trunc);
+ stream = new std::ofstream(file.c_str(), std::ios::trunc);
if (!valid())
fatal("Unable to open statistics file for writing\n");
}
return false;
}
-string
+std::string
ValueToString(Result value, int precision)
{
- stringstream val;
+ std::stringstream val;
if (!std::isnan(value)) {
if (precision != -1)
else if (value == rint(value))
val.precision(0);
- val.unsetf(ios::showpoint);
- val.setf(ios::fixed);
+ val.unsetf(std::ios::showpoint);
+ val.setf(std::ios::fixed);
val << value;
} else {
val << "nan";
struct ScalarPrint
{
Result value;
- string name;
- string desc;
+ std::string name;
+ std::string desc;
Flags flags;
bool descriptions;
bool spaces;
}
}
void update(Result val, Result total);
- void operator()(ostream &stream, bool oneLine = false) const;
+ void operator()(std::ostream &stream, bool oneLine = false) const;
};
void
}
void
-ScalarPrint::operator()(ostream &stream, bool oneLine) const
+ScalarPrint::operator()(std::ostream &stream, bool oneLine) const
{
if ((flags.isSet(nozero) && (!oneLine) && value == 0.0) ||
(flags.isSet(nonan) && std::isnan(value)))
return;
- stringstream pdfstr, cdfstr;
+ std::stringstream pdfstr, cdfstr;
if (!std::isnan(pdf))
ccprintf(pdfstr, "%.2f%%", pdf * 100.0);
if (!desc.empty())
ccprintf(stream, " # %s", desc);
}
- stream << endl;
+ stream << std::endl;
}
}
struct VectorPrint
{
- string name;
- string separatorString;
- string desc;
- vector<string> subnames;
- vector<string> subdescs;
+ std::string name;
+ std::string separatorString;
+ std::string desc;
+ std::vector<std::string> subnames;
+ std::vector<std::string> subdescs;
Flags flags;
bool descriptions;
bool spaces;
nameSpaces = 0;
}
}
- void operator()(ostream &stream) const;
+ void operator()(std::ostream &stream) const;
};
void
}
}
- string base = name + separatorString;
+ std::string base = name + separatorString;
ScalarPrint print(spaces);
print.name = name;
if (!desc.empty())
ccprintf(stream, " # %s", desc);
}
- stream << endl;
+ stream << std::endl;
}
}
struct DistPrint
{
- string name;
- string separatorString;
- string desc;
+ std::string name;
+ std::string separatorString;
+ std::string desc;
Flags flags;
bool descriptions;
bool spaces;
DistPrint(const Text *text, const DistInfo &info);
DistPrint(const Text *text, const VectorDistInfo &info, int i);
void init(const Text *text, const Info &info);
- void operator()(ostream &stream) const;
+ void operator()(std::ostream &stream) const;
};
DistPrint::DistPrint(const Text *text, const DistInfo &info)
}
void
-DistPrint::operator()(ostream &stream) const
+DistPrint::operator()(std::ostream &stream) const
{
if (flags.isSet(nozero) && data.samples == 0) return;
- string base = name + separatorString;
+ std::string base = name + separatorString;
ScalarPrint print(spaces);
print.precision = precision;
}
for (off_type i = 0; i < size; ++i) {
- stringstream namestr;
+ std::stringstream namestr;
namestr << base;
Counter low = i * data.bucket_size + data.min;
- Counter high = ::min(low + data.bucket_size - 1.0, data.max);
+ Counter high = std::min(low + data.bucket_size - 1.0, data.max);
namestr << low;
if (low < high)
namestr << "-" << high;
if (!desc.empty())
ccprintf(stream, " # %s", desc);
}
- stream << endl;
+ stream << std::endl;
}
if (data.type == Dist && data.overflow != NAN) {
}
// Create a subname for printing the total
- vector<string> total_subname;
+ std::vector<std::string> total_subname;
total_subname.push_back("total");
if (info.flags.isSet(::Stats::total) && (info.x > 1)) {
*/
struct SparseHistPrint
{
- string name;
- string separatorString;
- string desc;
+ std::string name;
+ std::string separatorString;
+ std::string desc;
Flags flags;
bool descriptions;
bool spaces;
SparseHistPrint(const Text *text, const SparseHistInfo &info);
void init(const Text *text, const Info &info);
- void operator()(ostream &stream) const;
+ void operator()(std::ostream &stream) const;
};
/* Call initialization function */
/* Grab data from map and write to output stream */
void
-SparseHistPrint::operator()(ostream &stream) const
+SparseHistPrint::operator()(std::ostream &stream) const
{
- string base = name + separatorString;
+ std::string base = name + separatorString;
ScalarPrint print(spaces);
print.precision = precision;
MCounter::const_iterator it;
for (it = data.cmap.begin(); it != data.cmap.end(); it++) {
- stringstream namestr;
+ std::stringstream namestr;
namestr << base;
namestr <<(*it).first;
}
Output *
-initText(const string &filename, bool desc, bool spaces)
+initText(const std::string &filename, bool desc, bool spaces)
{
static Text text;
static bool connected = false;
#include <string>
#include <vector>
-using namespace std;
-
bool
-split_first(const string &s, string &lhs, string &rhs, char c)
+split_first(const std::string &s, std::string &lhs, std::string &rhs, char c)
{
- string::size_type offset = s.find(c);
- if (offset == string::npos) {
+ std::string::size_type offset = s.find(c);
+ if (offset == std::string::npos) {
lhs = s;
rhs = "";
return false;
}
bool
-split_last(const string &s, string &lhs, string &rhs, char c)
+split_last(const std::string &s, std::string &lhs, std::string &rhs, char c)
{
- string::size_type offset = s.rfind(c);
- if (offset == string::npos) {
+ std::string::size_type offset = s.rfind(c);
+ if (offset == std::string::npos) {
lhs = s;
rhs = "";
return false;
}
void
-tokenize(vector<string>& v, const string &s, char token, bool ignore)
+tokenize(std::vector<std::string>& v, const std::string &s, char token,
+ bool ignore)
{
- string::size_type first = 0;
- string::size_type last = s.find_first_of(token);
+ std::string::size_type first = 0;
+ std::string::size_type last = s.find_first_of(token);
if (s.empty())
return;
while (last == first)
last = s.find_first_of(token, ++first);
- if (last == string::npos) {
+ if (last == std::string::npos) {
if (first != s.size())
v.push_back(s.substr(first));
return;
}
}
- while (last != string::npos) {
+ while (last != std::string::npos) {
v.push_back(s.substr(first, last - first));
if (ignore) {
first = s.find_first_not_of(token, last + 1);
- if (first == string::npos)
+ if (first == std::string::npos)
return;
} else
first = last + 1;
#include "sim/core.hh"
#include "sim/serialize.hh"
-using namespace std;
-
void
Time::_set(bool monotonic)
{
static_cast<uint64_t>(nsec() * SimClock::Float::ns);
}
-string
-Time::date(const string &format) const
+std::string
+Time::date(const std::string &format) const
{
time_t sec = this->sec();
char buf[256];
return buf;
}
-string
+std::string
Time::time() const
{
double time = double(*this);
double mins = fmod(all_mins, 60.0);
double hours = floor(all_mins / 60.0);
- stringstream str;
+ std::stringstream str;
if (hours > 0.0) {
if (hours < 10.0)
#include "base/trace.hh"
#include "debug/VNC.hh"
-using namespace std;
-
VncInput::VncInput(const Params &p)
: SimObject(p), keyboard(NULL), mouse(NULL),
fb(&FrameBuffer::dummy),
if (captureEnabled) {
// remove existing frame output directory if it exists, then create a
// clean empty directory
- const string FRAME_OUTPUT_SUBDIR = "frames_" + name();
+ const std::string FRAME_OUTPUT_SUBDIR = "frames_" + name();
simout.remove(FRAME_OUTPUT_SUBDIR, true);
captureOutputDirectory = simout.createSubdirectory(
FRAME_OUTPUT_SUBDIR);
snprintf(frameFilenameBuffer, 64, "fb.%06d.%lld.%s.gz",
captureCurrentFrame, static_cast<long long int>(curTick()),
captureImage->getImgExtension());
- const string frameFilename(frameFilenameBuffer);
+ const std::string frameFilename(frameFilenameBuffer);
// create the compressed framebuffer file
OutputStream *fb_out(captureOutputDirectory->create(frameFilename, true));
#include "sim/byteswap.hh"
#include "sim/core.hh"
-using namespace std;
-
const PixelConverter VncServer::pixelConverter(
4, // 4 bytes / pixel
16, 8, 0, // R in [23, 16], G in [15, 8], B in [7, 0]
port++;
}
- ccprintf(cerr, "%s: Listening for connections on port %d\n",
+ ccprintf(std::cerr, "%s: Listening for connections on port %d\n",
name(), port);
listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
memset(msg.px.padding, 0, 3);
msg.namelen = 2;
msg.namelen = htobe(msg.namelen);
- memcpy(msg.name, "M5", 2);
+ std::memcpy(msg.name, "M5", 2);
if (!write(&msg))
return;