Skip to content

Commit

Permalink
Refactor: Fix constructors and destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
fushar committed May 28, 2017
1 parent 488b1c5 commit 69724ca
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 20 deletions.
2 changes: 2 additions & 0 deletions include/tcframe/aggregator/Aggregator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace tcframe {

class Aggregator {
public:
virtual ~Aggregator() {}

virtual Verdict aggregate(const vector<Verdict>& verdicts, double points) = 0;
};

Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/evaluator/scorer/CustomScorer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class CustomScorer : public Scorer {
string scorerCommand_;

public:
virtual ~CustomScorer() {}

CustomScorer(OperatingSystem* os, VerdictCreator* verdictCreator, const string& scorerCommand)
: os_(os)
, verdictCreator_(verdictCreator)
Expand Down
26 changes: 13 additions & 13 deletions include/tcframe/generator/DefaultGeneratorLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,46 @@ class DefaultGeneratorLogger : public GeneratorLogger, public DefaultBaseLogger
DefaultGeneratorLogger(LoggerEngine* engine)
: DefaultBaseLogger(engine) {}

virtual void logIntroduction() {
void logIntroduction() {
engine_->logParagraph(0, "Generating test cases...");
}

virtual void logSuccessfulResult() {
void logSuccessfulResult() {
engine_->logParagraph(0, "");
engine_->logParagraph(0, "Generation finished. All test cases OK.");
}

virtual void logFailedResult() {
void logFailedResult() {
engine_->logParagraph(0, "");
engine_->logParagraph(0, "Generation finished. Some test cases FAILED.");
}

virtual void logTestCaseSuccessfulResult() {
void logTestCaseSuccessfulResult() {
engine_->logParagraph(0, "OK");
}

virtual void logTestCaseFailedResult(const optional<string>& testCaseDescription) {
void logTestCaseFailedResult(const optional<string>& testCaseDescription) {
engine_->logParagraph(0, "FAILED");
if (testCaseDescription) {
engine_->logParagraph(2, "Description: " + testCaseDescription.value());
}
engine_->logParagraph(2, "Reasons:");
}

virtual void logMultipleTestCasesCombinationIntroduction(const string& testGroupName) {
void logMultipleTestCasesCombinationIntroduction(const string& testGroupName) {
engine_->logHangingParagraph(1, "Combining test cases into a single file (" + testGroupName + "): ");
}

virtual void logMultipleTestCasesCombinationSuccessfulResult() {
void logMultipleTestCasesCombinationSuccessfulResult() {
engine_->logParagraph(0, "OK");
}

virtual void logMultipleTestCasesCombinationFailedResult() {
void logMultipleTestCasesCombinationFailedResult() {
engine_->logParagraph(0, "FAILED");
engine_->logParagraph(2, "Reasons:");
}

virtual void logConstraintsVerificationFailure(const ConstraintsVerificationResult& result) {
void logConstraintsVerificationFailure(const ConstraintsVerificationResult& result) {
for (const auto& entry : result.unsatisfiedConstraintDescriptionsBySubtaskId()) {
int subtaskId = entry.first;
const vector<string>& unsatisfiedConstraintDescriptions = entry.second;
Expand All @@ -81,7 +81,7 @@ class DefaultGeneratorLogger : public GeneratorLogger, public DefaultBaseLogger
}
}

virtual void logMultipleTestCasesConstraintsVerificationFailure(
void logMultipleTestCasesConstraintsVerificationFailure(
const MultipleTestCasesConstraintsVerificationResult& result) {

engine_->logListItem1(2, "Does not satisfy constraints, on:");
Expand All @@ -91,15 +91,15 @@ class DefaultGeneratorLogger : public GeneratorLogger, public DefaultBaseLogger
}
}

virtual void logSampleTestCaseCheckFailure() {
void logSampleTestCaseCheckFailure() {
engine_->logListItem1(2, "Sample test case output does not match with actual output produced by the solution");
}

virtual void logSampleTestCaseNoOutputNeededFailure() {
void logSampleTestCaseNoOutputNeededFailure() {
engine_->logListItem1(2, "Problem does not need test case outputs, but this sample test case has output");
}

virtual void logSimpleFailure(const string& message) {
void logSimpleFailure(const string& message) {
engine_->logListItem1(2, message);
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/tcframe/grader/DefaultGraderLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class DefaultGraderLogger : public GraderLogger, public DefaultBaseLogger {
DefaultGraderLogger(LoggerEngine* engine)
: DefaultBaseLogger(engine) {}

virtual void logIntroduction(const string& solutionCommand) {
void logIntroduction(const string& solutionCommand) {
engine_->logParagraph(0, "Local grading with solution command: '" + solutionCommand + "'...");
}

virtual void logTestCaseVerdict(const Verdict& verdict) {
void logTestCaseVerdict(const Verdict& verdict) {
engine_->logParagraph(0, verdict.toString());
}

virtual void logResult(const map<int, Verdict>& subtaskVerdicts, const Verdict& verdict) {
void logResult(const map<int, Verdict>& subtaskVerdicts, const Verdict& verdict) {
if (subtaskVerdicts.size() > 1) {
engine_->logHeading("SUBTASK VERDICTS");
for (auto entry : subtaskVerdicts) {
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/io_manipulator/GridIOSegmentManipulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tcframe {

class GridIOSegmentManipulator {
public:
GridIOSegmentManipulator() = delete;

static string parse(GridIOSegment* segment, istream* in) {
Matrix* variable = segment->variable();
variable->clear();
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/io_manipulator/LineIOSegmentManipulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tcframe {

class LineIOSegmentManipulator {
public:
LineIOSegmentManipulator() = delete;

static string parse(LineIOSegment* segment, istream* in) {
string lastVariableName;
for (const LineIOSegmentVariable& segmentVariable : segment->variables()) {
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/io_manipulator/LinesIOSegmentManipulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tcframe {

class LinesIOSegmentManipulator {
public:
LinesIOSegmentManipulator() = delete;

static string parse(LinesIOSegment* segment, istream* in) {
for (Variable* variable : segment->variables()) {
if (variable->type() == VariableType::VECTOR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace tcframe {

class RawLineIOSegmentManipulator {
public:
RawLineIOSegmentManipulator() = delete;

static string parse(RawLineIOSegment* segment, istream* in) {
string lastVariableName = TokenFormatter::formatVariable(segment->variable()->name());
segment->variable()->parseFrom(in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tcframe {

class RawLinesIOSegmentManipulator {
public:
RawLinesIOSegmentManipulator() = delete;

static string parse(RawLinesIOSegment* segment, istream* in) {
string lastVariableName;

Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/logger/SimpleLoggerEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace tcframe {

class SimpleLoggerEngine : public LoggerEngine {
public:
virtual ~SimpleLoggerEngine() {}

void logHeading(const string& message) {
cout << endl;
cout << "[ " << message << " ]" << endl;
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/os/OperatingSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class OperatingSystem {
static constexpr const char* ERROR_FILENAME = "__tcframe_error.out";

public:
virtual ~OperatingSystem() {}

virtual istream* openForReading(const string& filename) {
ifstream* file = new ifstream();
file->open(filename);
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/runner/ArgsParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace tcframe {

class ArgsParser {
public:
ArgsParser() = delete;

static Args parse(int argc, char* argv[]) {
option longopts[] = {
{ "communicator", required_argument, nullptr, 'a'},
Expand Down
2 changes: 2 additions & 0 deletions include/tcframe/spec/io/GridIOSegment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct GridIOSegment : public IOSegment {
function<int()> columns_;

public:
virtual ~GridIOSegment() {}

GridIOSegment()
: variable_(nullptr)
, rows_([] {return NO_SIZE;})
Expand Down
2 changes: 0 additions & 2 deletions include/tcframe/spec/io/IOFormat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ class IOFormatBuilder {
IOFormatBuilder()
: lastBuilder_(nullptr) {}

virtual ~IOFormatBuilder() {}

void prepareForInputFormat() {
addLastSegment();
currentFormat_ = &subject_.inputFormat_;
Expand Down
2 changes: 0 additions & 2 deletions include/tcframe/spec/testcase/TestSuite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class TestSuiteBuilder {
optional<vector<string>> curSampleOutputLines_;

public:
virtual ~TestSuiteBuilder() {}

TestSuiteBuilder()
: beforeClosure_([]{})
, afterClosure_([]{})
Expand Down

0 comments on commit 69724ca

Please sign in to comment.