Browse Source

A little bit of cleaning in pgcl

Former-commit-id: 28154e6c1e [formerly d80220f3dc]
Former-commit-id: a1410fc930
tempestpy_adaptions
sjunges 8 years ago
parent
commit
6a635c75c1
  1. 4
      src/parser/PgclParser.h
  2. 2
      src/storage/pgcl/AssignmentStatement.h
  3. 7
      src/storage/pgcl/BooleanExpression.cpp
  4. 15
      src/storage/pgcl/BooleanExpression.h
  5. 7
      src/storage/pgcl/BranchStatement.cpp
  6. 2
      src/storage/pgcl/BranchStatement.h
  7. 14
      src/storage/pgcl/IfStatement.cpp
  8. 14
      src/storage/pgcl/IfStatement.h
  9. 6
      src/storage/pgcl/LoopStatement.cpp
  10. 2
      src/storage/pgcl/LoopStatement.h
  11. 7
      src/storage/pgcl/NondeterministicBranch.cpp
  12. 7
      src/storage/pgcl/ObserveStatement.cpp
  13. 15
      src/storage/pgcl/ObserveStatement.h
  14. 7
      src/storage/pgcl/ProbabilisticBranch.cpp
  15. 13
      src/storage/pgcl/ProbabilisticBranch.h
  16. 8
      src/storage/pgcl/StatementPrinterVisitor.cpp
  17. 9
      src/storage/pgcl/StatementPrinterVisitor.h
  18. 6
      src/storage/pgcl/UniformExpression.cpp
  19. 11
      src/storage/pgcl/UniformExpression.h

4
src/parser/PgclParser.h

@ -58,8 +58,8 @@ namespace storm {
qi::rule<Iterator, storm::pgcl::PgclProgram(), Skipper> program;
qi::rule<Iterator, std::vector<std::shared_ptr<storm::pgcl::Statement> >(), Skipper> sequenceOfStatements;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::Statement>(), Skipper> statement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::SimpleStatement>(), Skipper> simpleStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::CompoundStatement>(), Skipper> compoundStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::Statement>(), Skipper> simpleStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::Statement>(), Skipper> compoundStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::IfStatement>(), Skipper> ifElseStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::BranchStatement>(), Skipper> branchStatement;
qi::rule<Iterator, std::shared_ptr<storm::pgcl::LoopStatement>(), Skipper> loopStatement;

2
src/storage/pgcl/AssignmentStatement.h

@ -14,7 +14,7 @@ namespace storm {
* identifier := expression; where the expression is either handled by
* the expression manager or is a uniform distribution expression.
*/
class AssignmentStatement : public SimpleStatement {
class AssignmentStatement : public Statement {
public:
AssignmentStatement() = default;
/**

7
src/storage/pgcl/BooleanExpression.cpp

@ -1,10 +1,3 @@
/*
* File: BooleanExpression.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:44
*/
#include "src/storage/pgcl/BooleanExpression.h"
#include "src/storage/expressions/ExpressionManager.h"

15
src/storage/pgcl/BooleanExpression.h

@ -1,12 +1,4 @@
/*
* File: BooleanExpression.h
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:44
*/
#ifndef BOOLEANEXPRESSION_H
#define BOOLEANEXPRESSION_H
#pragma once
#include "src/storage/expressions/Expression.h"
@ -36,7 +28,4 @@ namespace storm {
storm::expressions::Expression booleanExpression;
};
}
}
#endif /* BOOLEANEXPRESSION_H */
}

7
src/storage/pgcl/BranchStatement.cpp

@ -1,10 +1,3 @@
/*
* File: BranchStatement.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#include "src/storage/pgcl/BranchStatement.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"

2
src/storage/pgcl/BranchStatement.h

@ -11,7 +11,7 @@ namespace storm {
* compound statements, every branch is again a complete PGCL program
* itself.
*/
class BranchStatement : public CompoundStatement {
class BranchStatement : public Statement {
public:
BranchStatement() = default;
BranchStatement(const BranchStatement& orig) = default;

14
src/storage/pgcl/IfStatement.cpp

@ -1,10 +1,3 @@
/*
* File: IfStatement.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#include "IfStatement.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"
@ -24,11 +17,8 @@ namespace storm {
}
std::shared_ptr<storm::pgcl::PgclBlock> const& IfStatement::getElseBody() const {
if(this->elseBody) {
return this->elseBody;
} else {
throw "Tried to access non-present else body of if statement.";
}
assert(hasElse());
return this->elseBody;
}
bool IfStatement::hasElse() const{

14
src/storage/pgcl/IfStatement.h

@ -1,12 +1,4 @@
/*
* File: IfStatement.h
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#ifndef IFSTATEMENT_H
#define IFSTATEMENT_H
#pragma once
#include "src/storage/pgcl/CompoundStatement.h"
#include "src/storage/pgcl/BooleanExpression.h"
@ -21,7 +13,7 @@ namespace storm {
* It is possibly for if statements to have one else body, but not
* mandatory.
*/
class IfStatement : public CompoundStatement {
class IfStatement : public Statement {
public:
IfStatement() = default;
/**
@ -73,5 +65,3 @@ namespace storm {
}
}
#endif /* IFSTATEMENT_H */

6
src/storage/pgcl/LoopStatement.cpp

@ -1,9 +1,3 @@
/*
* File: LoopStatement.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#include "src/storage/pgcl/LoopStatement.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"

2
src/storage/pgcl/LoopStatement.h

@ -18,7 +18,7 @@ namespace storm {
* This class represents a guarded loop statement. The guard is saved as
* a boolean expression. The body of the loop is again a PGCL program.
*/
class LoopStatement : public CompoundStatement {
class LoopStatement : public Statement {
public:
LoopStatement() = default;
/**

7
src/storage/pgcl/NondeterministicBranch.cpp

@ -1,10 +1,3 @@
/*
* File: NondeterministicBranch.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:44
*/
#include "src/storage/pgcl/NondeterministicBranch.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"

7
src/storage/pgcl/ObserveStatement.cpp

@ -1,10 +1,3 @@
/*
* File: ObserveStatement.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#include "src/storage/pgcl/ObserveStatement.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"

15
src/storage/pgcl/ObserveStatement.h

@ -1,12 +1,4 @@
/*
* File: ObserveStatement.h
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:42
*/
#ifndef OBSERVESTATEMENT_H
#define OBSERVESTATEMENT_H
#pragma once
#include "src/storage/pgcl/SimpleStatement.h"
#include "src/storage/pgcl/BooleanExpression.h"
@ -18,7 +10,7 @@ namespace storm {
* include a condition. If this condition doesn't hold, the program
* stops at that point in its execution.
*/
class ObserveStatement : public SimpleStatement {
class ObserveStatement : public Statement {
public:
ObserveStatement() = default;
/**
@ -41,6 +33,3 @@ namespace storm {
};
}
}
#endif /* OBSERVESTATEMENT_H */

7
src/storage/pgcl/ProbabilisticBranch.cpp

@ -1,10 +1,3 @@
/*
* File: ProbabilisticBranch.cpp
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:43
*/
#include "src/storage/pgcl/ProbabilisticBranch.h"
#include "src/storage/pgcl/AbstractStatementVisitor.h"

13
src/storage/pgcl/ProbabilisticBranch.h

@ -1,12 +1,4 @@
/*
* File: ProbabilisticBranch.h
* Author: Lukas Westhofen
*
* Created on 11. April 2015, 17:43
*/
#ifndef PROBABILISTICBRANCH_H
#define PROBABILISTICBRANCH_H
#pragma once
#include "src/storage/pgcl/BranchStatement.h"
@ -46,6 +38,3 @@ namespace storm {
};
}
}
#endif /* PROBABILISTICBRANCH_H */

8
src/storage/pgcl/StatementPrinterVisitor.cpp

@ -1,7 +1,3 @@
//
// Created by Lukas Westhofen on 21.04.15.
//
#include "src/storage/pgcl/StatementPrinterVisitor.h"
#include "src/storage/pgcl/AssignmentStatement.h"
@ -34,7 +30,7 @@ namespace storm {
void StatementPrinterVisitor::visit(storm::pgcl::IfStatement const& statement) {
this->stream << statement.getLocationNumber() << ": ";
this->stream << "if(" << statement.getCondition().getBooleanExpression() << ") {" << std::endl;
this->stream << "if (" << statement.getCondition().getBooleanExpression() << ") {" << std::endl;
int i = 1;
for(iterator it = (*(statement.getIfBody())).begin(); it != (*(statement.getIfBody())).end(); ++it) {
(*(*it)).accept(*this);
@ -53,7 +49,7 @@ namespace storm {
void StatementPrinterVisitor::visit(storm::pgcl::LoopStatement const& statement) {
this->stream << statement.getLocationNumber() << ": ";
this->stream << "while(" << statement.getCondition().getBooleanExpression() << ") {" << std::endl;
this->stream << "while (" << statement.getCondition().getBooleanExpression() << ") {" << std::endl;
int i = 1;
for(iterator it = (*(statement.getBody())).begin(); it != (*(statement.getBody())).end(); ++it) {
(*(*it)).accept(*this);

9
src/storage/pgcl/StatementPrinterVisitor.h

@ -1,9 +1,4 @@
//
// Created by Lukas Westhofen on 21.04.15.
//
#ifndef STORM_STATEMENTVISITOR_H
#define STORM_STATEMENTVISITOR_H
#pragma once
#include <iostream>
#include <boost/variant/get.hpp>
@ -35,5 +30,3 @@ namespace storm {
};
}
}
#endif //STORM_STATEMENTVISITOR_H

6
src/storage/pgcl/UniformExpression.cpp

@ -1,7 +1,3 @@
//
// Created by foxnbk on 16.03.16.
//
#include "UniformExpression.h"
namespace storm {
@ -19,5 +15,3 @@ namespace storm {
}
}
}
#include "UniformExpression.h"

11
src/storage/pgcl/UniformExpression.h

@ -1,9 +1,4 @@
//
// Created by Lukas Westhofen on 16.03.16.
//
#ifndef STORM_UNIFORMEXPRESSION_H
#define STORM_UNIFORMEXPRESSION_H
#pragma once
#include <stdint.h>
@ -38,6 +33,4 @@ namespace storm {
int_fast64_t end = 0;
};
}
}
#endif //STORM_UNIFORMEXPRESSION_H
}
Loading…
Cancel
Save