coding style

This commit is contained in:
Éder F. Zulian
2018-07-03 15:10:39 +02:00
parent 6c5c49179a
commit 2cc7127317
3 changed files with 9 additions and 15 deletions

View File

@@ -37,7 +37,7 @@
traceSetup::traceSetup(std::string uri,
std::string pathToResources,
std::vector<TracePlayer *> * devices)
std::vector<TracePlayer *> *devices)
{
// Load Simulation:
tinyxml2::XMLDocument simulationdoc;
@@ -71,13 +71,12 @@ traceSetup::traceSetup(std::string uri,
std::string name = device->GetText();
int pos = name.rfind('.');
if(pos == std::string::npos)
{
if (pos == std::string::npos) {
throw std::runtime_error("Name of the trace file does not contain a valid extension.");
}
// Get the extension and make it lower case
std::string ext = name.substr(pos+1);
std::string ext = name.substr(pos + 1);
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
std::string stlFile = pathToResources + string("traces/") + name;
@@ -86,17 +85,12 @@ traceSetup::traceSetup(std::string uri,
// replace all '.' to '_'
std::replace( moduleName.begin(), moduleName.end(), '.', '_');
TracePlayer * player;
if(strcmp(ext.c_str(), "stl") == 0)
{
TracePlayer *player;
if (strcmp(ext.c_str(), "stl") == 0) {
player = new StlPlayer<false>(moduleName.c_str(), stlFile, playerClk, this);
}
else if(strcmp(ext.c_str(), "rstl") == 0)
{
} else if (strcmp(ext.c_str(), "rstl") == 0) {
player = new StlPlayer<true>(moduleName.c_str(), stlFile, playerClk, this);
}
else
{
} else {
std::string error = "Unsupported file extension in " + name;
throw std::runtime_error(error);
}

View File

@@ -49,7 +49,7 @@ class traceSetup : public TracePlayerListener
public:
traceSetup(std::string uri,
std::string pathToResources,
std::vector<TracePlayer*> * devices);
std::vector<TracePlayer *> *devices);
virtual void tracePlayerTerminates() override;
virtual void transactionFinished() override;

View File

@@ -72,7 +72,7 @@ int sc_main(int argc, char **argv)
SimulationXML = resources + "simulations/ddr3-example.xml";
}
std::vector<TracePlayer*> players;
std::vector<TracePlayer *> players;
// Instantiate DRAMSys:
DRAMSys *dramSys = new DRAMSys("DRAMSys", SimulationXML, resources);