Browse Source

Further work towards faster and more modular compilation

Former-commit-id: 9de50910b8
tempestpy_adaptions
sjunges 10 years ago
parent
commit
f85d28325e
  1. 2
      src/builder/DdPrismModelBuilder.cpp
  2. 2
      src/builder/ExplicitPrismModelBuilder.cpp
  3. 2
      src/models/sparse/DeterministicModel.cpp
  4. 2
      src/models/sparse/Dtmc.cpp
  5. 3
      src/models/sparse/Dtmc.h
  6. 2
      src/models/sparse/MarkovAutomaton.cpp
  7. 2
      src/models/sparse/Mdp.cpp
  8. 1
      src/parser/DeterministicSparseTransitionParser.cpp
  9. 2
      src/parser/NondeterministicSparseTransitionParser.cpp
  10. 158
      src/settings/Argument.cpp
  11. 1
      src/storage/Decomposition.cpp
  12. 8
      src/storage/SparseMatrix.h
  13. 1
      src/storage/StronglyConnectedComponentDecomposition.h
  14. 2
      src/utility/constants.cpp
  15. 1
      src/utility/constants.h
  16. 1
      src/utility/numerical.h
  17. 2
      src/utility/prism.cpp
  18. 2
      src/utility/prism.h
  19. 4
      test/functional/parser/DeterministicModelParserTest.cpp
  20. 2
      test/functional/parser/DeterministicSparseTransitionParserTest.cpp
  21. 1
      test/functional/parser/MarkovAutomatonParserTest.cpp
  22. 3
      test/functional/parser/NondeterministicModelParserTest.cpp
  23. 2
      test/functional/parser/NondeterministicSparseTransitionParserTest.cpp
  24. 1
      test/functional/storage/SparseMatrixTest.cpp

2
src/builder/DdPrismModelBuilder.cpp

@ -10,6 +10,8 @@
#include "src/exceptions/InvalidStateException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/utility/prism.h"
#include "src/utility/math.h"
#include "src/storage/prism/Program.h"

2
src/builder/ExplicitPrismModelBuilder.cpp

@ -14,6 +14,8 @@
#include "src/utility/macros.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/exceptions/InvalidArgumentException.h"
namespace storm {
namespace builder {
template <typename ValueType, typename IndexType>

2
src/models/sparse/DeterministicModel.cpp

@ -1,5 +1,5 @@
#include "src/models/sparse/DeterministicModel.h"
#include "src/utility/constants.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {

2
src/models/sparse/Dtmc.cpp

@ -2,6 +2,8 @@
#include "src/adapters/CarlAdapter.h"
#include "src/exceptions/NotImplementedException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/utility/constants.h"
namespace storm {
namespace models {

3
src/models/sparse/Dtmc.h

@ -1,8 +1,11 @@
#ifndef STORM_MODELS_SPARSE_DTMC_H_
#define STORM_MODELS_SPARSE_DTMC_H_
#include <unordered_set>
#include "src/models/sparse/DeterministicModel.h"
#include "src/utility/OsDetection.h"
#include "src/utility/constants.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {
namespace models {

2
src/models/sparse/MarkovAutomaton.cpp

@ -1,5 +1,7 @@
#include "src/models/sparse/MarkovAutomaton.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/utility/constants.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {

2
src/models/sparse/Mdp.cpp

@ -1,5 +1,7 @@
#include "src/models/sparse/Mdp.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/utility/constants.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {

1
src/parser/DeterministicSparseTransitionParser.cpp

@ -19,6 +19,7 @@
#include "src/parser/MappedFile.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/settings/SettingsManager.h"
#include "src/settings/modules/GeneralSettings.h"

2
src/parser/NondeterministicSparseTransitionParser.cpp

@ -14,6 +14,8 @@
#include "src/settings/modules/GeneralSettings.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/OutOfRangeException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/utility/cstring.h"

158
src/settings/Argument.cpp

@ -0,0 +1,158 @@
#include "Argument.h"
#include "src/exceptions/IllegalArgumentException.h"
#include "src/exceptions/IllegalArgumentValueException.h"
#include "src/exceptions/IllegalFunctionCallException.h"
#include "src/settings/ArgumentTypeInferationHelper.h"
#include "src/utility/macros.h"
namespace storm {
namespace settings {
template<typename T>
Argument<T>::Argument(std::string const& name, std::string const& description, std::vector<userValidationFunction_t> const& validationFunctions): ArgumentBase(name, description), argumentValue(), argumentType(inferToEnumType<T>()), validationFunctions(validationFunctions), isOptional(false), defaultValue(), hasDefaultValue(false) {
// Intentionally left empty.
}
template<typename T>
Argument<T>::Argument(std::string const& name, std::string const& description, std::vector<userValidationFunction_t> const& validationFunctions, bool isOptional, T defaultValue): ArgumentBase(name, description), argumentValue(), argumentType(inferToEnumType<T>()), validationFunctions(validationFunctions), isOptional(isOptional), defaultValue(), hasDefaultValue(true) {
this->setDefaultValue(defaultValue);
}
template<typename T>
bool Argument<T>::getIsOptional() const {
return this->isOptional;
}
template<typename T>
bool Argument<T>::setFromStringValue(std::string const& fromStringValue) {
bool conversionOk = false;
T newValue = ArgumentBase::convertFromString<T>(fromStringValue, conversionOk);
if (!conversionOk) {
return false;
}
return this->setFromTypeValue(newValue);
}
template<typename T>
bool Argument<T>::setFromTypeValue(T const& newValue, bool hasBeenSet) {
if (!this->validate(newValue)) {
return false;
}
this->argumentValue = newValue;
this->hasBeenSet = hasBeenSet;
return true;
}
template<typename T>
ArgumentType Argument<T>::getType() const {
return this->argumentType;
}
template<typename T>
T const& Argument<T>::getArgumentValue() const {
STORM_LOG_THROW(this->getHasBeenSet() || this->getHasDefaultValue(), storm::exceptions::IllegalFunctionCallException, "Unable to retrieve value of argument '" << this->getName() << "', because it was neither set nor specifies a default value.");
if (this->getHasBeenSet()) {
return this->argumentValue;
} else {
return this->defaultValue;
}
}
template<typename T>
bool Argument<T>::getHasDefaultValue() const {
return this->hasDefaultValue;
}
template<typename T>
void Argument<T>::setFromDefaultValue() {
STORM_LOG_THROW(this->hasDefaultValue, storm::exceptions::IllegalFunctionCallException, "Unable to set value from default value, because the argument has none.");
bool result = this->setFromTypeValue(this->defaultValue, false);
STORM_LOG_THROW(result, storm::exceptions::IllegalArgumentValueException, "Unable to assign default value to argument, because it was rejected.");
}
template<typename T>
std::string Argument<T>::getValueAsString() const {
switch (this->argumentType) {
case ArgumentType::String:
return inferToString(ArgumentType::String, this->getArgumentValue());
case ArgumentType::Boolean: {
bool iValue = inferToBoolean(ArgumentType::Boolean, this->getArgumentValue());
if (iValue) {
return "true";
} else {
return "false";
}
}
default: return ArgumentBase::convertToString(this->argumentValue);
}
}
template<typename T>
int_fast64_t Argument<T>::getValueAsInteger() const {
switch (this->argumentType) {
case ArgumentType::Integer:
return inferToInteger(ArgumentType::Integer, this->getArgumentValue());
default: STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "Unable to retrieve argument value as integer."); break;
}
}
template<typename T>
uint_fast64_t Argument<T>::getValueAsUnsignedInteger() const {
switch (this->argumentType) {
case ArgumentType::UnsignedInteger:
return inferToUnsignedInteger(ArgumentType::UnsignedInteger, this->getArgumentValue());
default: STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "Unable to retrieve argument value as unsigned integer."); break;
}
}
template<typename T>
double Argument<T>::getValueAsDouble() const {
switch (this->argumentType) {
case ArgumentType::Double:
return inferToDouble(ArgumentType::Double, this->getArgumentValue());
default: STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "Unable to retrieve argument value as double."); break;
}
}
template<typename T>
bool Argument<T>::getValueAsBoolean() const {
switch (this->argumentType) {
case ArgumentType::Boolean:
return inferToBoolean(ArgumentType::Boolean, this->getArgumentValue());
default: STORM_LOG_THROW(false, storm::exceptions::IllegalFunctionCallException, "Unable to retrieve argument value as boolean."); break;
}
}
template<typename T>
void Argument<T>::setDefaultValue(T const& newDefault) {
STORM_LOG_THROW(this->validate(newDefault), storm::exceptions::IllegalArgumentValueException, "The default value for the argument did not pass all validation functions.");
this->defaultValue = newDefault;
this->hasDefaultValue = true;
}
template<typename T>
bool Argument<T>::validate(T const& value) const {
bool result = true;
for (auto const& lambda : validationFunctions) {
result = result && lambda(value);
}
return result;
}
template class Argument<std::string>;
template class Argument<int_fast64_t>;
template class Argument<uint_fast64_t>;
template class Argument<double>;
template class Argument<bool>;
}
}

1
src/storage/Decomposition.cpp

@ -4,6 +4,7 @@
#include "src/storage/StronglyConnectedComponent.h"
#include "src/storage/MaximalEndComponent.h"
#include "src/utility/constants.h"
namespace storm {
namespace storage {

8
src/storage/SparseMatrix.h

@ -6,13 +6,8 @@
#include <cstdint>
#include <iterator>
#include "src/storage/BitVector.h"
#include "src/utility/constants.h"
#include "src/utility/OsDetection.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/exceptions/OutOfRangeException.h"
#include <boost/functional/hash.hpp>
// Forward declaration for adapter classes.
@ -26,11 +21,14 @@ namespace storm {
template<typename T>
class TopologicalValueIterationMinMaxLinearEquationSolver;
}
}
namespace storm {
namespace storage {
class BitVector;
// Forward declare matrix class.
template<typename T> class SparseMatrix;

1
src/storage/StronglyConnectedComponentDecomposition.h

@ -5,6 +5,7 @@
#include "src/storage/Decomposition.h"
#include "src/storage/StronglyConnectedComponent.h"
#include "src/storage/BitVector.h"
#include "src/utility/constants.h"
namespace storm {
namespace models {

2
src/utility/constants.cpp

@ -5,6 +5,8 @@
#include "src/settings/SettingsManager.h"
#include "src/settings/modules/GeneralSettings.h"
#include "src/adapters/CarlAdapter.h"
namespace storm {
namespace utility {

1
src/utility/constants.h

@ -12,7 +12,6 @@
#include <limits>
#include <cstdint>
#include "src/adapters/CarlAdapter.h"
namespace storm {

1
src/utility/numerical.h

@ -5,6 +5,7 @@
#include "src/utility/macros.h"
#include "src/utility/constants.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/exceptions/OutOfRangeException.h"
namespace storm {
namespace utility {

2
src/utility/prism.cpp

@ -2,6 +2,8 @@
#include "src/storage/expressions/ExpressionManager.h"
#include "src/storage/prism/Program.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "macros.h"
namespace storm {
namespace utility {

2
src/utility/prism.h

@ -7,8 +7,6 @@
#include <boost/container/flat_set.hpp>
#include "src/utility/OsDetection.h"
#include "src/utility/macros.h"
#include "src/exceptions/InvalidArgumentException.h"
namespace storm {

4
test/functional/parser/DeterministicModelParserTest.cpp

@ -6,6 +6,10 @@
#include "src/models/sparse/Ctmc.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/InvalidArgumentException.h"
#include "src/exceptions/OutOfRangeException.h"
TEST(DeterministicModelParserTest, NonExistingFile) {
// No matter what happens, please do NOT create a file with the name "nonExistingFile.not"!
ASSERT_THROW(storm::parser::DeterministicModelParser::parseDtmc(STORM_CPP_TESTS_BASE_PATH "/nonExistingFile.not", STORM_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), storm::exceptions::FileIoException);

2
test/functional/parser/DeterministicSparseTransitionParserTest.cpp

@ -16,6 +16,8 @@
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/exceptions/InvalidArgumentException.h"
TEST(DeterministicSparseTransitionParserTest, NonExistingFile) {
// No matter what happens, please do NOT create a file with the name "nonExistingFile.not"!

1
test/functional/parser/MarkovAutomatonParserTest.cpp

@ -3,6 +3,7 @@
#include "src/parser/MarkovAutomatonParser.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/OutOfRangeException.h"
TEST(MarkovAutomatonParserTest, NonExistingFile) {

3
test/functional/parser/NondeterministicModelParserTest.cpp

@ -5,6 +5,9 @@
#include "src/models/sparse/Mdp.h"
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/OutOfRangeException.h"
#include "src/exceptions/InvalidArgumentException.h"
TEST(NondeterministicModelParserTest, NonExistingFile) {
// No matter what happens, please do NOT create a file with the name "nonExistingFile.not"!
ASSERT_THROW(storm::parser::NondeterministicModelParser::parseMdp(STORM_CPP_TESTS_BASE_PATH "/nonExistingFile.not", STORM_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), storm::exceptions::FileIoException);

2
test/functional/parser/NondeterministicSparseTransitionParserTest.cpp

@ -17,6 +17,8 @@
#include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFormatException.h"
#include "src/exceptions/InvalidArgumentException.h"
TEST(NondeterministicSparseTransitionParserTest, NonExistingFile) {
// No matter what happens, please do NOT create a file with the name "nonExistingFile.not"!

1
test/functional/storage/SparseMatrixTest.cpp

@ -1,5 +1,6 @@
#include "gtest/gtest.h"
#include "src/storage/SparseMatrix.h"
#include "src/storage/BitVector.h"
#include "src/exceptions/InvalidStateException.h"
#include "src/exceptions/OutOfRangeException.h"

Loading…
Cancel
Save