Skip to content

Commit

Permalink
Make a port.cpp, put the static PortName function there to silence co…
Browse files Browse the repository at this point in the history
…mpile warnings
  • Loading branch information
Matt Johnson committed Mar 29, 2012
1 parent 12f21ea commit e8f7931
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions rigel-sim/Makefile.am
Expand Up @@ -90,6 +90,7 @@ common_SOURCES = \
src/instr/instr_legacy.cpp \
src/instr/pipe_packet.cpp \
src/instr/static_decode_info.cpp \
src/port/port.cpp \
src/util/convert.cpp \
src/util/rigel_strings.cpp \
src/util/ui_legacy.cpp \
Expand Down
17 changes: 4 additions & 13 deletions rigel-sim/include/port/port.h
Expand Up @@ -6,29 +6,20 @@
#include "include/port/portmanager.h"

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <cassert>

/// this base class is meaningless, either get rid of or define a general port
/// this base class is meaningless
/// FIXME either get rid of or define a general port
/// concept with meaning
class PortBase {
public:
protected:
private:
};

static std::string PortName( std::string parent, int id, std::string suffix, int index = -1) {

std::stringstream port_name;
port_name << parent << "[" << std::setw(4) << id << "]." << suffix;
if (index >= 0) {
port_name << "[" << std::setw(4) << index << "]";
}
return port_name.str();

}
//FIXME Use a function naming convention, not a class naming convention
std::string PortName( std::string parent, int id, std::string suffix, int index = -1);

// forward declarations
template <class T> class OutPortBase;
Expand Down
17 changes: 17 additions & 0 deletions rigel-sim/src/port/port.cpp
@@ -0,0 +1,17 @@
#include "port/port.h"
#include <string>
#include <sstream>
#include <iomanip>

//FIXME Use a function naming convention, not a class naming convention
std::string PortName(std::string parent, int id, std::string suffix, int index) {

std::stringstream port_name;
port_name << parent << "[" << std::setw(4) << id << "]." << suffix;
if (index >= 0) {
port_name << "[" << std::setw(4) << index << "]";
}
return port_name.str();

}

0 comments on commit e8f7931

Please sign in to comment.