Skip to content

Commit 23c4025

Browse files
committed
Remove duplicated/dead code from output builders
1 parent 8e65e31 commit 23c4025

8 files changed

+18
-54
lines changed

src/printer/AugmentedOIOutputBuilder.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,5 @@ std::string AugmentedOIOutputBuilder::dump() const {
2424
return ss.str();
2525
}
2626

27-
void AugmentedOIOutputBuilder::dumpStatus(std::ostream& ss) const {
28-
if (killReason_ != KillReason::NONE) {
29-
ss << killReasonComment_;
30-
}
31-
else if (killSignal_ > 0) {
32-
ss << "process exited due to signal " << killSignal_;
33-
}
34-
else if (exitStatus_ > 0) {
35-
ss << "runtime error " << exitStatus_;
36-
}
37-
else {
38-
ss << "ok";
39-
}
40-
}
41-
4227
} // namespace printer
4328
} // namespace s2j

src/printer/AugmentedOIOutputBuilder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ class AugmentedOIOutputBuilder : public OIModelOutputBuilder {
1010
std::string dump() const override;
1111

1212
const static std::string FORMAT_NAME;
13-
14-
private:
15-
void dumpStatus(std::ostream& ss) const;
16-
int encodeStatusCode() const;
1713
};
1814

1915
} // namespace printer

src/printer/OIModelOutputBuilder.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "OIModelOutputBuilder.h"
22

33
#include <cstdint>
4+
#include <sstream>
45

56
namespace s2j {
67
namespace printer {
@@ -55,5 +56,20 @@ OutputBuilder& OIModelOutputBuilder::setKillReason(
5556
return *this;
5657
}
5758

59+
void OIModelOutputBuilder::dumpStatus(std::ostream& ss) const {
60+
if (killReason_ != KillReason::NONE) {
61+
ss << killReasonComment_;
62+
}
63+
else if (killSignal_ > 0) {
64+
ss << "process exited due to signal " << killSignal_;
65+
}
66+
else if (exitStatus_ > 0) {
67+
ss << "runtime error " << exitStatus_;
68+
}
69+
else {
70+
ss << "ok";
71+
}
72+
}
73+
5874
} // namespace printer
5975
} // namespace s2j

src/printer/OIModelOutputBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class OIModelOutputBuilder : public OutputBuilder {
3131

3232
KillReason killReason_ = KillReason::NONE;
3333
std::string killReasonComment_;
34+
35+
void dumpStatus(std::ostream& ss) const;
3436
};
3537

3638
} // namespace printer

src/printer/OITimeToolOutputBuilder.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ std::string OITimeToolOutputBuilder::dump() const {
1919
return ss.str();
2020
}
2121

22-
void OITimeToolOutputBuilder::dumpStatus(std::ostream& ss) const {
23-
if (killReason_ != KillReason::NONE) {
24-
ss << killReasonComment_;
25-
}
26-
else if (killSignal_ > 0) {
27-
ss << "process exited due to signal " << killSignal_;
28-
}
29-
else if (exitStatus_ > 0) {
30-
ss << "runtime error " << exitStatus_;
31-
}
32-
else {
33-
ss << "ok";
34-
}
35-
}
36-
3722
int OITimeToolOutputBuilder::encodeStatusCode() const {
3823
static const int CODE_SIG_BASE = 0;
3924
static const int CODE_RE_BASE = 200;

src/printer/OITimeToolOutputBuilder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class OITimeToolOutputBuilder : public OIModelOutputBuilder {
1212
const static std::string FORMAT_NAME;
1313

1414
private:
15-
void dumpStatus(std::ostream& ss) const;
1615
int encodeStatusCode() const;
1716
};
1817

src/printer/RealTimeOIOutputBuilder.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,5 @@ std::string RealTimeOIOutputBuilder::dump() const {
2424
return ss.str();
2525
}
2626

27-
void RealTimeOIOutputBuilder::dumpStatus(std::ostream& ss) const {
28-
if (killReason_ != KillReason::NONE) {
29-
ss << killReasonComment_;
30-
}
31-
else if (killSignal_ > 0) {
32-
ss << "process exited due to signal " << killSignal_;
33-
}
34-
else if (exitStatus_ > 0) {
35-
ss << "runtime error " << exitStatus_;
36-
}
37-
else {
38-
ss << "ok";
39-
}
40-
}
41-
4227
} // namespace printer
4328
} // namespace s2j

src/printer/RealTimeOIOutputBuilder.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ class RealTimeOIOutputBuilder : public OIModelOutputBuilder {
1010
std::string dump() const override;
1111

1212
const static std::string FORMAT_NAME;
13-
14-
private:
15-
void dumpStatus(std::ostream& ss) const;
16-
int encodeStatusCode() const;
1713
};
1814

1915
} // namespace printer

0 commit comments

Comments
 (0)