diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fc1a8305..2d5913c06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,20 +101,33 @@ message(STATUS "STORM_CPP_TESTS_BASE_PATH is ${STORM_CPP_TESTS_BASE_PATH}") # Main Sources file(GLOB_RECURSE STORM_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h) -file(GLOB_RECURSE STORM_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) +file(GLOB_RECURSE STORM_SOURCES_WITHOUT_MAIN ${PROJECT_SOURCE_DIR}/src/*/*.cpp) +file(GLOB_RECURSE STORM_MAIN_FILE ${PROJECT_SOURCE_DIR}/src/storm.cpp) +set(STORM_SOURCES "${STORM_SOURCES_WITHOUT_MAIN};${STORM_MAIN_FILE}") +file(GLOB_RECURSE STORM_ADAPTERS_FILES ${PROJECT_SOURCE_DIR}/src/adapters/*.h ${PROJECT_SOURCE_DIR}/src/adapters/*.cpp) +file(GLOB_RECURSE STORM_EXCEPTIONS_FILES ${PROJECT_SOURCE_DIR}/src/exceptions/*.h ${PROJECT_SOURCE_DIR}/src/exceptions/*.cpp) +file(GLOB_RECURSE STORM_FORMULA_FILES ${PROJECT_SOURCE_DIR}/src/formula/*.h ${PROJECT_SOURCE_DIR}/src/formula/*.cpp) +file(GLOB_RECURSE STORM_MODELCHECKER_FILES ${PROJECT_SOURCE_DIR}/src/modelchecker/*.h ${PROJECT_SOURCE_DIR}/src/modelchecker/*.cpp) +file(GLOB_RECURSE STORM_MODELS_FILES ${PROJECT_SOURCE_DIR}/src/models/*.h ${PROJECT_SOURCE_DIR}/src/models/*.cpp) +file(GLOB_RECURSE STORM_PARSER_FILES ${PROJECT_SOURCE_DIR}/src/parser/*.h ${PROJECT_SOURCE_DIR}/src/parser/*.cpp) +file(GLOB_RECURSE STORM_STORAGE_FILES ${PROJECT_SOURCE_DIR}/src/storage/*.h ${PROJECT_SOURCE_DIR}/src/storage/*.cpp) +file(GLOB_RECURSE STORM_UTILITY_FILES ${PROJECT_SOURCE_DIR}/src/utility/*.h ${PROJECT_SOURCE_DIR}/src/utility/*.cpp) # Test Sources # Note that the tests also need the source files, except for the main file -file(GLOB_RECURSE STORM_TEST_HEADERS ${PROJECT_SOURCE_DIR}/test/*.h) -file(GLOB_RECURSE STORM_TEST_SOURCES ${PROJECT_SOURCE_DIR}/test/*.cpp ${PROJECT_SOURCE_DIR}/src/*/*.cpp) - -# Main Grouping -source_group(Headers FILES ${STORM_HEADERS}) -source_group(Sources FILES ${STORM_SOURCES}) - -# Test Grouping -source_group(Headers FILES ${STORM_TEST_HEADERS}) -source_group(Sources FILES ${STORM_TEST_SOURCES}) +file(GLOB_RECURSE STORM_TEST_FILES ${PROJECT_SOURCE_DIR}/test/*.h ${PROJECT_SOURCE_DIR}/test/*.cpp) + +# Group the headers and sources +source_group(main FILES ${STORM_MAIN_FILE}) +source_group(adapters FILES ${STORM_ADAPTERS_FILES}) +source_group(exceptions FILES ${STORM_EXCEPTIONS_FILES}) +source_group(formula FILES ${STORM_FORMULA_FILES}) +source_group(modelchecker FILES ${STORM_MODELCHECKER_FILES}) +source_group(models FILES ${STORM_MODELS_FILES}) +source_group(parser FILES ${STORM_PARSER_FILES}) +source_group(storage FILES ${STORM_STORAGE_FILES}) +source_group(utility FILES ${STORM_UTILITY_FILES}) +source_group(test FILES ${STORM_TEST_FILES}) # Add base folder for better inclusion paths include_directories("${PROJECT_SOURCE_DIR}") @@ -149,7 +162,7 @@ include_directories(${GMMXX_INCLUDE_DIR}) # Add the executables # Must be created *after* Boost was added because of LINK_DIRECTORIES add_executable(storm ${STORM_SOURCES} ${STORM_HEADERS}) -add_executable(storm-tests ${STORM_TEST_SOURCES} ${STORM_TEST_HEADERS}) +add_executable(storm-tests ${STORM_TEST_FILES} ${STORM_SOURCES_WITHOUT_MAIN} ${STORM_HEADERS}) # Add target link deps for Boost program options target_link_libraries(storm ${Boost_LIBRARIES}) @@ -158,6 +171,10 @@ target_link_libraries(storm-tests ${Boost_LIBRARIES}) set (STORM_USE_COTIRE ON) if (APPLE) set(STORM_USE_COTIRE OFF) + + # Set up some Xcode specific settings + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") endif(APPLE) # Print Cotire Usage Status diff --git a/src/formula/AbstractPathFormula.h b/src/formula/AbstractPathFormula.h index d0ee74efd..459cbd057 100644 --- a/src/formula/AbstractPathFormula.h +++ b/src/formula/AbstractPathFormula.h @@ -61,7 +61,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector* check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const = 0; + virtual std::vector* check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const = 0; }; } //namespace formula diff --git a/src/formula/AbstractStateFormula.h b/src/formula/AbstractStateFormula.h index 9947c5df6..cf15fdb30 100644 --- a/src/formula/AbstractStateFormula.h +++ b/src/formula/AbstractStateFormula.h @@ -58,7 +58,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker& modelChecker) const = 0; // { + virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker& modelChecker) const = 0; // { }; } //namespace formula diff --git a/src/formula/And.h b/src/formula/And.h index f5d758c2b..80f46a821 100644 --- a/src/formula/And.h +++ b/src/formula/And.h @@ -162,7 +162,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector* check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkAnd(*this); } diff --git a/src/formula/Ap.h b/src/formula/Ap.h index 4950b4b72..0cb0d2480 100644 --- a/src/formula/Ap.h +++ b/src/formula/Ap.h @@ -98,7 +98,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkAp(*this); } diff --git a/src/formula/BoundedEventually.h b/src/formula/BoundedEventually.h index fe7776f33..33c42f1ba 100644 --- a/src/formula/BoundedEventually.h +++ b/src/formula/BoundedEventually.h @@ -157,7 +157,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector* check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector* check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkBoundedEventually(*this, qualitative); } diff --git a/src/formula/BoundedNaryUntil.h b/src/formula/BoundedNaryUntil.h index 7c98af61e..9f83df869 100644 --- a/src/formula/BoundedNaryUntil.h +++ b/src/formula/BoundedNaryUntil.h @@ -179,7 +179,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkBoundedNaryUntil(*this, qualitative); } diff --git a/src/formula/BoundedUntil.h b/src/formula/BoundedUntil.h index a5eec8576..685b1bfe1 100644 --- a/src/formula/BoundedUntil.h +++ b/src/formula/BoundedUntil.h @@ -184,7 +184,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkBoundedUntil(*this, qualitative); } diff --git a/src/formula/CumulativeReward.h b/src/formula/CumulativeReward.h index 3c38991a8..5d3dfa667 100644 --- a/src/formula/CumulativeReward.h +++ b/src/formula/CumulativeReward.h @@ -120,7 +120,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkCumulativeReward(*this, qualitative); } diff --git a/src/formula/Eventually.h b/src/formula/Eventually.h index 668546f0c..8db4f1b01 100644 --- a/src/formula/Eventually.h +++ b/src/formula/Eventually.h @@ -131,7 +131,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkEventually(*this, qualitative); } diff --git a/src/formula/Formulas.h b/src/formula/Formulas.h index e5864bbc0..4ad64b1e7 100644 --- a/src/formula/Formulas.h +++ b/src/formula/Formulas.h @@ -38,7 +38,4 @@ #include "AbstractPathFormula.h" #include "AbstractStateFormula.h" -// FIXME: Why is this needed? To me this makes no sense. -#include "modelchecker/DtmcPrctlModelChecker.h" - #endif /* STORM_FORMULA_FORMULAS_H_ */ diff --git a/src/formula/Globally.h b/src/formula/Globally.h index 7b58580e9..31d06bd05 100644 --- a/src/formula/Globally.h +++ b/src/formula/Globally.h @@ -132,7 +132,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkGlobally(*this, qualitative); } diff --git a/src/formula/InstantaneousReward.h b/src/formula/InstantaneousReward.h index ed0f7affa..c2001540f 100644 --- a/src/formula/InstantaneousReward.h +++ b/src/formula/InstantaneousReward.h @@ -121,7 +121,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkInstantaneousReward(*this, qualitative); } diff --git a/src/formula/Next.h b/src/formula/Next.h index 91d68d05a..5f36b053e 100644 --- a/src/formula/Next.h +++ b/src/formula/Next.h @@ -133,7 +133,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkNext(*this, qualitative); } diff --git a/src/formula/NoBoundOperator.h b/src/formula/NoBoundOperator.h index 5261f3736..cbbc9f05f 100644 --- a/src/formula/NoBoundOperator.h +++ b/src/formula/NoBoundOperator.h @@ -136,7 +136,7 @@ public: * * @returns A vector indicating all states that satisfy the formula represented by the called object. */ - virtual std::vector* check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual std::vector* check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkNoBoundOperator(*this); } diff --git a/src/formula/Not.h b/src/formula/Not.h index 0ddb803c9..dde509ec8 100644 --- a/src/formula/Not.h +++ b/src/formula/Not.h @@ -127,7 +127,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkNot(*this); } diff --git a/src/formula/Or.h b/src/formula/Or.h index 52cc1d8a8..bb91bfa59 100644 --- a/src/formula/Or.h +++ b/src/formula/Or.h @@ -160,7 +160,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkOr(*this); } diff --git a/src/formula/ProbabilisticBoundOperator.h b/src/formula/ProbabilisticBoundOperator.h index 14429c677..8d651ef2c 100644 --- a/src/formula/ProbabilisticBoundOperator.h +++ b/src/formula/ProbabilisticBoundOperator.h @@ -117,7 +117,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector* check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkProbabilisticBoundOperator(*this); } }; diff --git a/src/formula/ReachabilityReward.h b/src/formula/ReachabilityReward.h index ff8155eb5..f88deb30e 100644 --- a/src/formula/ReachabilityReward.h +++ b/src/formula/ReachabilityReward.h @@ -127,7 +127,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkReachabilityReward(*this, qualitative); } diff --git a/src/formula/RewardBoundOperator.h b/src/formula/RewardBoundOperator.h index f602f89b9..18d715fbc 100644 --- a/src/formula/RewardBoundOperator.h +++ b/src/formula/RewardBoundOperator.h @@ -113,7 +113,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector* check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkRewardBoundOperator(*this); } }; diff --git a/src/formula/StateBoundOperator.h b/src/formula/StateBoundOperator.h index 9cfcfb862..323994c76 100644 --- a/src/formula/StateBoundOperator.h +++ b/src/formula/StateBoundOperator.h @@ -171,7 +171,7 @@ public: * * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ - virtual storm::storage::BitVector *check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector *check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkStateBoundOperator(*this); } diff --git a/src/formula/SteadyStateOperator.h b/src/formula/SteadyStateOperator.h index 755f12249..402a33c01 100644 --- a/src/formula/SteadyStateOperator.h +++ b/src/formula/SteadyStateOperator.h @@ -107,7 +107,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual storm::storage::BitVector* check(const storm::modelChecker::AbstractModelChecker& modelChecker) const { + virtual storm::storage::BitVector* check(const storm::modelchecker::AbstractModelChecker& modelChecker) const { return modelChecker.template as()->checkSteadyStateOperator(*this); } diff --git a/src/formula/SteadyStateReward.h b/src/formula/SteadyStateReward.h index 799bc50a7..eae0def8b 100644 --- a/src/formula/SteadyStateReward.h +++ b/src/formula/SteadyStateReward.h @@ -84,7 +84,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkSteadyStateReward(*this, qualitative); } diff --git a/src/formula/Until.h b/src/formula/Until.h index 562d397fc..b2efe6f45 100644 --- a/src/formula/Until.h +++ b/src/formula/Until.h @@ -158,7 +158,7 @@ public: * * @returns A vector indicating the probability that the formula holds for each state. */ - virtual std::vector *check(const storm::modelChecker::AbstractModelChecker& modelChecker, bool qualitative) const { + virtual std::vector *check(const storm::modelchecker::AbstractModelChecker& modelChecker, bool qualitative) const { return modelChecker.template as()->checkUntil(*this, qualitative); } diff --git a/src/modelchecker/AbstractModelChecker.h b/src/modelchecker/AbstractModelChecker.h index a2a41f1e3..de32619f7 100644 --- a/src/modelchecker/AbstractModelChecker.h +++ b/src/modelchecker/AbstractModelChecker.h @@ -1,5 +1,5 @@ /* - * DtmcPrctlModelChecker.h + * AbstractModelChecker.h * * Created on: 22.10.2012 * Author: Thomas Heinemann @@ -8,31 +8,40 @@ #ifndef STORM_MODELCHECKER_ABSTRACTMODELCHECKER_H_ #define STORM_MODELCHECKER_ABSTRACTMODELCHECKER_H_ -namespace storm { namespace modelChecker { -template class AbstractModelChecker; -}} +// Forward declaration of abstract model checker class needed by the formula classes. +namespace storm { +namespace modelchecker { + template class AbstractModelChecker; +} +} #include "src/exceptions/InvalidPropertyException.h" #include "src/formula/Formulas.h" #include "src/storage/BitVector.h" #include "src/models/AbstractModel.h" +#include "log4cplus/logger.h" +#include "log4cplus/loggingmacros.h" + #include +extern log4cplus::Logger logger; + namespace storm { -namespace modelChecker { +namespace modelchecker { /*! * @brief - * Interface for model checker classes. + * (Abstract) interface for all model checker classes. * - * This class provides basic functions that are the same for all subclasses, but mainly only declares - * abstract methods that are to be implemented in concrete instances. - * - * @attention This class is abstract. + * This class provides basic functions that are common to all model checkers (i.e. subclasses). It mainly declares + * abstract methods that are implemented in the concrete subclasses, but also covers checking procedures that are common + * to all model checkers for state-based models. */ template class AbstractModelChecker : + // A list of interfaces the model checker supports. Typically, for each of the interfaces, a check method needs to + // be implemented that performs the corresponding check. public virtual storm::formula::IApModelChecker, public virtual storm::formula::IAndModelChecker, public virtual storm::formula::IOrModelChecker, @@ -51,36 +60,70 @@ class AbstractModelChecker : public virtual storm::formula::IInstantaneousRewardModelChecker { public: - explicit AbstractModelChecker(storm::models::AbstractModel& model) - : model(model) { - // Nothing to do here... + /*! + * Constructs an AbstractModelChecker with the given model. + */ + explicit AbstractModelChecker(storm::models::AbstractModel const& model) : model(model) { + // Intentionally left empty. } - explicit AbstractModelChecker(AbstractModelChecker* modelChecker) - : model(modelChecker->model) { + /*! + * Copy constructs an AbstractModelChecker from the given model checker. In particular, this means that the newly + * constructed model checker will have the model of the given model checker as its associated model. + */ + explicit AbstractModelChecker(AbstractModelChecker const& modelchecker) : model(modelchecker.model) { + // Intentionally left empty. } + /*! + * Virtual destructor. Needs to be virtual, because this class has virtual methods. + */ virtual ~AbstractModelChecker() { - //intentionally left empty + // Intentionally left empty. } + /*! + * Returns a pointer to the model checker object that is of the requested type as given by the template parameters. + * @returns A pointer to the model checker object that is of the requested type as given by the template parameters. + * If the model checker is not of the requested type, type casting will fail and result in an exception. + */ template