From cce8391e441828cf0d74dc76d2fb8c4acf5a7b44 Mon Sep 17 00:00:00 2001 From: PBerger Date: Sun, 16 Dec 2012 18:17:40 +0100 Subject: [PATCH 1/7] Refactored everything to match naming scheme. --- src/exceptions/FileIoException.h | 33 ++++++++++++++++ ..._argument.h => InvalidArgumentException.h} | 18 ++++----- ...nvalid_state.h => InvalidStateException.h} | 18 ++++----- .../{out_of_range.h => OutOfRangeException.h} | 18 ++++----- src/exceptions/WrongFileFormatException.h | 35 +++++++++++++++++ src/exceptions/file_IO_exception.h | 33 ---------------- src/exceptions/wrong_file_format.h | 35 ----------------- src/formula/ProbabilisticIntervalOperator.h | 2 +- src/modelChecker/EigenDtmcPrctlModelChecker.h | 4 +- src/modelChecker/GmmxxDtmcPrctlModelChecker.h | 4 +- src/models/AtomicPropositionsLabeling.h | 13 ++++--- src/mrmc.cpp | 4 +- src/parser/parser.cpp | 22 +++++------ src/parser/parser.h | 6 +-- src/parser/readLabFile.cpp | 8 ++-- src/parser/readTraFile.cpp | 8 ++-- src/solver/GraphAnalyzer.h | 10 ++--- src/storage/BitVector.h | 14 +++---- src/storage/SquareSparseMatrix.h | 38 +++++++++---------- .../{const_templates.h => ConstTemplates.h} | 8 ++-- src/utility/{ioUtility.cpp => IoUtility.cpp} | 4 +- src/utility/{ioUtility.h => IoUtility.h} | 8 ++-- src/utility/{osDetection.h => OsDetection.h} | 0 src/utility/{settings.cpp => Settings.cpp} | 4 +- src/utility/{settings.h => Settings.h} | 8 ++-- src/utility/{vector.h => Vector.h} | 8 ++-- test/eigen/sparse_matrix_test.cpp | 2 +- test/parser/parse_dtmc_test.cpp | 2 +- test/parser/read_lab_file_test.cpp | 12 +++--- test/parser/read_tra_file_test.cpp | 14 +++---- test/reward/reward_model_test.cpp | 2 +- test/storage/BitVectorTest.cpp | 2 +- test/storage/SquareSparseMatrixTest.cpp | 17 +++++---- 33 files changed, 209 insertions(+), 205 deletions(-) create mode 100644 src/exceptions/FileIoException.h rename src/exceptions/{invalid_argument.h => InvalidArgumentException.h} (51%) rename src/exceptions/{invalid_state.h => InvalidStateException.h} (52%) rename src/exceptions/{out_of_range.h => OutOfRangeException.h} (54%) create mode 100644 src/exceptions/WrongFileFormatException.h delete mode 100644 src/exceptions/file_IO_exception.h delete mode 100644 src/exceptions/wrong_file_format.h rename src/utility/{const_templates.h => ConstTemplates.h} (94%) rename src/utility/{ioUtility.cpp => IoUtility.cpp} (97%) rename src/utility/{ioUtility.h => IoUtility.h} (90%) rename src/utility/{osDetection.h => OsDetection.h} (100%) rename src/utility/{settings.cpp => Settings.cpp} (99%) rename src/utility/{settings.h => Settings.h} (98%) rename src/utility/{vector.h => Vector.h} (88%) diff --git a/src/exceptions/FileIoException.h b/src/exceptions/FileIoException.h new file mode 100644 index 000000000..5fd72dad9 --- /dev/null +++ b/src/exceptions/FileIoException.h @@ -0,0 +1,33 @@ +/* + * FileIoException.h + * + * Created on: 16.08.2012 + * Author: Thomas Heinemann + */ + +#ifndef MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ +#define MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ + +namespace mrmc { + +namespace exceptions { + +class FileIoException : public std::exception { + public: +#ifdef _WIN32 + FileIoException() : exception("::mrmc::FileIoException"){}; + FileIoException(const char * const s): exception(s) {}; +#else + FileIoException() {}; + FileIoException(const char * const s): exception() {}; +#endif + virtual const char* what() const throw(){ + { return "mrmc::FileIoException"; } + } +}; + +} + +} + +#endif /* MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ */ diff --git a/src/exceptions/invalid_argument.h b/src/exceptions/InvalidArgumentException.h similarity index 51% rename from src/exceptions/invalid_argument.h rename to src/exceptions/InvalidArgumentException.h index 31db957a4..051e4c000 100644 --- a/src/exceptions/invalid_argument.h +++ b/src/exceptions/InvalidArgumentException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ -#define MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ +#ifndef MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ +#define MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ #include @@ -8,7 +8,7 @@ namespace mrmc { namespace exceptions { //!This exception is thrown when a parameter is invalid in this context -class invalid_argument : public std::exception +class InvalidArgumentException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -18,17 +18,17 @@ class invalid_argument : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - invalid_argument() : exception("::mrmc::invalid_argument"){} - invalid_argument(const char * const s): exception(s) {} + InvalidArgumentException() : exception("::mrmc::InvalidArgumentException"){} + InvalidArgumentException(const char * const s): exception(s) {} #else - invalid_argument() : exception() {} - invalid_argument(const char * const s): exception() {} + InvalidArgumentException() : exception() {} + InvalidArgumentException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::invalid_argument"; } + { return "mrmc::InvalidArgumentException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_INVALID_ARGUMENT_H_ +#endif // MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ diff --git a/src/exceptions/invalid_state.h b/src/exceptions/InvalidStateException.h similarity index 52% rename from src/exceptions/invalid_state.h rename to src/exceptions/InvalidStateException.h index 132c99644..32b07a659 100644 --- a/src/exceptions/invalid_state.h +++ b/src/exceptions/InvalidStateException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_INVALID_STATE_H_ -#define MRMC_EXCEPTIONS_INVALID_STATE_H_ +#ifndef MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ #include @@ -9,7 +9,7 @@ namespace exceptions { //!This exception is thrown when a memory request can't be //!fulfilled. -class invalid_state : public std::exception +class InvalidStateException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -19,19 +19,19 @@ class invalid_state : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - invalid_state() : exception("::mrmc::invalid_state"){} - invalid_state(const char * const s): exception(s) {} + InvalidStateException() : exception("::mrmc::InvalidStateException"){} + InvalidStateException(const char * const s): exception(s) {} #else - invalid_state() : exception() {} - invalid_state(const char * const s): exception() {} + InvalidStateException() : exception() {} + InvalidStateException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::invalid_state"; } + { return "mrmc::InvalidStateException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_INVALID_STATE_H_ +#endif // MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ diff --git a/src/exceptions/out_of_range.h b/src/exceptions/OutOfRangeException.h similarity index 54% rename from src/exceptions/out_of_range.h rename to src/exceptions/OutOfRangeException.h index 5b1bfaac9..dffcd4e78 100644 --- a/src/exceptions/out_of_range.h +++ b/src/exceptions/OutOfRangeException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ -#define MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ +#ifndef MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ #include @@ -8,7 +8,7 @@ namespace mrmc { namespace exceptions { //!This exception is thrown when a parameter is not in the range of valid values -class out_of_range : public std::exception +class OutOfRangeException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -18,17 +18,17 @@ class out_of_range : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - out_of_range() : exception("::mrmc::out_of_range"){} - out_of_range(const char * const s): exception(s) {} + OutOfRangeException() : exception("::mrmc::OutOfRangeException"){} + OutOfRangeException(const char * const s): exception(s) {} #else - out_of_range() : exception() {} - out_of_range(const char * const s): exception() {} + OutOfRangeException() : exception() {} + OutOfRangeException(const char * const s): exception() {} #endif virtual const char* what() const throw() - { return "mrmc::out_of_range"; } + { return "mrmc::OutOfRangeException"; } }; } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_OUT_OF_RANGE_H_ +#endif // MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ diff --git a/src/exceptions/WrongFileFormatException.h b/src/exceptions/WrongFileFormatException.h new file mode 100644 index 000000000..11dafe38b --- /dev/null +++ b/src/exceptions/WrongFileFormatException.h @@ -0,0 +1,35 @@ +/* + * WrongFileFormatException.h + * + * Created on: 16.08.2012 + * Author: Thomas Heinemann + */ + +#ifndef MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ +#define MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ + +#include + +namespace mrmc { + +namespace exceptions { + +class WrongFileFormatException : public std::exception { + public: +#ifdef _WIN32 + WrongFileFormatException() : exception("::mrmc::WrongFileFormatException"){}; + WrongFileFormatException(const char * const s): exception(s) {}; +#else + WrongFileFormatException() {}; + WrongFileFormatException(const char * const s): exception() {}; +#endif + virtual const char* what() const throw(){ + { return "mrmc::WrongFileFormatException"; } + } +}; + +} //namespace exceptions + +} //namespace mrmc + +#endif /* MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ */ diff --git a/src/exceptions/file_IO_exception.h b/src/exceptions/file_IO_exception.h deleted file mode 100644 index b2270fbe2..000000000 --- a/src/exceptions/file_IO_exception.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * file_IO_exception.h - * - * Created on: 16.08.2012 - * Author: Thomas Heinemann - */ - -#ifndef MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ -#define MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ - -namespace mrmc { - -namespace exceptions { - -class file_IO_exception : public std::exception { - public: -#ifdef _WIN32 - file_IO_exception() : exception("::mrmc::file_IO_exception"){}; - file_IO_exception(const char * const s): exception(s) {}; -#else - file_IO_exception() {}; - file_IO_exception(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::file_IO_exception"; } - } -}; - -} - -} - -#endif /* MRMC_EXCEPTIONS_FILE_IO_EXCEPTION_H_ */ diff --git a/src/exceptions/wrong_file_format.h b/src/exceptions/wrong_file_format.h deleted file mode 100644 index afe996733..000000000 --- a/src/exceptions/wrong_file_format.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * wrong_file_format.h - * - * Created on: 16.08.2012 - * Author: Thomas Heinemann - */ - -#ifndef WRONG_FILE_FORMAT_H_ -#define WRONG_FILE_FORMAT_H_ - -#include - -namespace mrmc { - -namespace exceptions { - -class wrong_file_format : public std::exception { - public: -#ifdef _WIN32 - wrong_file_format() : exception("::mrmc::wrong_file_format"){}; - wrong_file_format(const char * const s): exception(s) {}; -#else - wrong_file_format() {}; - wrong_file_format(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::wrong_file_format"; } - } -}; - -} //namespace exceptions - -} //namespace mrmc - -#endif /* WRONG_FILE_FORMAT_H_ */ diff --git a/src/formula/ProbabilisticIntervalOperator.h b/src/formula/ProbabilisticIntervalOperator.h index c7ffb9ba3..8bd86d393 100644 --- a/src/formula/ProbabilisticIntervalOperator.h +++ b/src/formula/ProbabilisticIntervalOperator.h @@ -10,7 +10,7 @@ #include "PCTLStateFormula.h" #include "PCTLPathFormula.h" -#include "utility/const_templates.h" +#include "utility/ConstTemplates.h" namespace mrmc { diff --git a/src/modelChecker/EigenDtmcPrctlModelChecker.h b/src/modelChecker/EigenDtmcPrctlModelChecker.h index 4730ab9cc..084c576f4 100644 --- a/src/modelChecker/EigenDtmcPrctlModelChecker.h +++ b/src/modelChecker/EigenDtmcPrctlModelChecker.h @@ -8,12 +8,12 @@ #ifndef EIGENDTMCPRCTLMODELCHECKER_H_ #define EIGENDTMCPRCTLMODELCHECKER_H_ -#include "src/utility/vector.h" +#include "src/utility/Vector.h" #include "src/models/Dtmc.h" #include "src/modelChecker/DtmcPrctlModelChecker.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/const_templates.h" +#include "src/utility/ConstTemplates.h" #include "src/exceptions/NoConvergence.h" #include "Eigen/Sparse" diff --git a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h index 8d2af9f2a..a3b1a57c4 100644 --- a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h +++ b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h @@ -13,9 +13,9 @@ #include "src/models/Dtmc.h" #include "src/modelChecker/DtmcPrctlModelChecker.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/vector.h" +#include "src/utility/Vector.h" -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "gmm/gmm_matrix.h" #include "gmm/gmm_iter_solvers.h" diff --git a/src/models/AtomicPropositionsLabeling.h b/src/models/AtomicPropositionsLabeling.h index 34c2da73b..a35fd693a 100644 --- a/src/models/AtomicPropositionsLabeling.h +++ b/src/models/AtomicPropositionsLabeling.h @@ -9,6 +9,7 @@ #define MRMC_MODELS_ATOMIC_PROPOSITIONS_LABELING_H_ #include "src/storage/BitVector.h" +#include "src/exceptions/OutOfRangeException.h" #include #include #include @@ -81,10 +82,10 @@ public: */ uint_fast64_t addAtomicProposition(std::string ap) { if (nameToLabelingMap.count(ap) != 0) { - throw std::out_of_range("Atomic Proposition already exists."); + throw mrmc::exceptions::OutOfRangeException("Atomic Proposition already exists."); } if (apsCurrent >= apCountMax) { - throw std::out_of_range("Added more atomic propositions than" + throw mrmc::exceptions::OutOfRangeException("Added more atomic propositions than" "previously declared."); } nameToLabelingMap[ap] = apsCurrent; @@ -109,10 +110,12 @@ public: */ void addAtomicPropositionToState(std::string ap, const uint_fast64_t state) { if (nameToLabelingMap.count(ap) == 0) { - throw std::out_of_range("Atomic Proposition '" + ap + "' unknown."); + /*throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '" << ap << "' unknown.");*/ + // TODO !!! + throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '' unknown."); } if (state >= stateCount) { - throw std::out_of_range("State index out of range."); + throw mrmc::exceptions::OutOfRangeException("State index out of range."); } this->singleLabelings[nameToLabelingMap[ap]]->set(state, true); } @@ -124,7 +127,7 @@ public: */ std::set getPropositionsForState(uint_fast64_t state) { if (state >= stateCount) { - throw std::out_of_range("State index out of range."); + throw mrmc::exceptions::OutOfRangeException("State index out of range."); } std::set result; for (auto it = nameToLabelingMap.begin(); diff --git a/src/mrmc.cpp b/src/mrmc.cpp index 7d334408c..882c096a8 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -12,7 +12,7 @@ * Description: Central part of the application containing the main() Method */ -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #include #include #include @@ -28,7 +28,7 @@ #include "src/parser/readTraFile.h" #include "src/parser/readPrctlFile.h" #include "src/solver/GraphAnalyzer.h" -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "src/formula/Formulas.h" #include "src/exceptions/NoConvergence.h" diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 9e5558291..010ed201a 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -12,8 +12,8 @@ #include #include -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -22,7 +22,7 @@ extern log4cplus::Logger logger; /*! * Calls strtol() internally and checks if the new pointer is different * from the original one, i.e. if str != *end. If they are the same, a - * mrmc::exceptions::wrong_file_format will be thrown. + * mrmc::exceptions::WrongFileFormatException will be thrown. * @param str String to parse * @param end New pointer will be written there * @return Result of strtol() @@ -34,7 +34,7 @@ uint_fast64_t mrmc::parser::Parser::checked_strtol(const char* str, char** end) { LOG4CPLUS_ERROR(logger, "Error while parsing integer. Next input token is not a number."); LOG4CPLUS_ERROR(logger, "\tUpcoming input is: \"" << std::string(str, 0, 16) << "\""); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException("Error while parsing integer. Next input token is not a number."); } return res; } @@ -71,14 +71,14 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) #endif { LOG4CPLUS_ERROR(logger, "Error in stat(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in stat()"); } this->file = open(filename, O_RDONLY); if (this->file < 0) { LOG4CPLUS_ERROR(logger, "Error in open(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in open()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in open()"); } this->data = (char*) mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0); @@ -86,7 +86,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) { close(this->file); LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in mmap()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in mmap()"); } this->dataend = this->data + this->st.st_size; #elif defined WINDOWS @@ -97,14 +97,14 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) if (_stat64(filename, &(this->st)) != 0) { LOG4CPLUS_ERROR(logger, "Error in _stat(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in stat()"); } this->file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (this->file == INVALID_HANDLE_VALUE) { LOG4CPLUS_ERROR(logger, "Error in CreateFileA(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileA()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in CreateFileA()"); } this->mapping = CreateFileMappingA(this->file, NULL, PAGE_READONLY, (DWORD)(st.st_size >> 32), (DWORD)st.st_size, NULL); @@ -112,7 +112,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) { CloseHandle(this->file); LOG4CPLUS_ERROR(logger, "Error in CreateFileMappingA(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileMappingA()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in CreateFileMappingA()"); } this->data = static_cast(MapViewOfFile(this->mapping, FILE_MAP_READ, 0, 0, this->st.st_size)); @@ -121,7 +121,7 @@ mrmc::parser::MappedFile::MappedFile(const char* filename) CloseHandle(this->mapping); CloseHandle(this->file); LOG4CPLUS_ERROR(logger, "Error in MapViewOfFile(" << filename << ")."); - throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in MapViewOfFile()"); + throw exceptions::FileIoException("mrmc::parser::MappedFile Error in MapViewOfFile()"); } this->dataend = this->data + this->st.st_size; #endif diff --git a/src/parser/parser.h b/src/parser/parser.h index 78b8dd890..a21cdf1d5 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -8,7 +8,7 @@ #ifndef PARSER_H_ #define PARSER_H_ -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #if defined LINUX || defined MACOSX # include @@ -23,8 +23,8 @@ #include #include -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" namespace mrmc { diff --git a/src/parser/readLabFile.cpp b/src/parser/readLabFile.cpp index 3ef488373..6301f86c3 100644 --- a/src/parser/readLabFile.cpp +++ b/src/parser/readLabFile.cpp @@ -9,8 +9,8 @@ #include "readLabFile.h" -#include "src/exceptions/wrong_file_format.h" -#include "src/exceptions/file_IO_exception.h" +#include "src/exceptions/WrongFileFormatException.h" +#include "src/exceptions/FileIoException.h" #include #include @@ -103,7 +103,7 @@ LabParser::LabParser(uint_fast64_t node_count, const char * filename) LOG4CPLUS_ERROR(logger, "Wrong file format in (" << filename << "). File header is corrupted."); if (! foundDecl) LOG4CPLUS_ERROR(logger, "\tDid not find #DECLARATION token."); if (! foundEnd) LOG4CPLUS_ERROR(logger, "\tDid not find #END token."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } } @@ -135,7 +135,7 @@ LabParser::LabParser(uint_fast64_t node_count, const char * filename) * if token is longer than our buffer, the following strncpy code might get risky... */ LOG4CPLUS_ERROR(logger, "Wrong file format in (" << filename << "). Atomic proposition with length > " << (sizeof(proposition)-1) << " was found."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } else if (cnt > 0) { diff --git a/src/parser/readTraFile.cpp b/src/parser/readTraFile.cpp index 902259f54..e7a1d7cb2 100644 --- a/src/parser/readTraFile.cpp +++ b/src/parser/readTraFile.cpp @@ -8,8 +8,8 @@ #include "parser.h" #include "src/parser/readTraFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include "boost/integer/integer_mask.hpp" #include #include @@ -142,7 +142,7 @@ TraParser::TraParser(const char * filename) if (non_zero == 0) { LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": erroneous file format."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } /* @@ -195,7 +195,7 @@ TraParser::TraParser(const char * filename) if ((val <= 0.0) || (val > 1.0)) { LOG4CPLUS_ERROR(logger, "Found transition probability of " << val << ", but we think probabilities should be from (0,1]."); - throw mrmc::exceptions::wrong_file_format(); + throw mrmc::exceptions::WrongFileFormatException(); } this->matrix->addNextValue(row,col,val); buf = skipWS(buf); diff --git a/src/solver/GraphAnalyzer.h b/src/solver/GraphAnalyzer.h index 34864520e..e1f062798 100644 --- a/src/solver/GraphAnalyzer.h +++ b/src/solver/GraphAnalyzer.h @@ -9,7 +9,7 @@ #define GRAPHANALYZER_H_ #include "src/models/Dtmc.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -38,7 +38,7 @@ public: // Check for valid parameter. if (existsPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'existsPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'existsPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'existsPhiUntilPhiStates' must not be null."); } // Get the backwards transition relation from the model to ease the search. @@ -85,7 +85,7 @@ public: // Check for valid parameter. if (alwaysPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'alwaysPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'alwaysPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'alwaysPhiUntilPhiStates' must not be null."); } GraphAnalyzer::getExistsPhiUntilPsiStates(model, ~psiStates, ~existsPhiUntilPsiStates, alwaysPhiUntilPsiStates); @@ -109,11 +109,11 @@ public: // Check for valid parameters. if (existsPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'existsPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'existsPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'existsPhiUntilPhiStates' must not be null."); } if (alwaysPhiUntilPsiStates == nullptr) { LOG4CPLUS_ERROR(logger, "Parameter 'alwaysPhiUntilPhiStates' must not be null."); - throw mrmc::exceptions::invalid_argument("Parameter 'alwaysPhiUntilPhiStates' must not be null."); + throw mrmc::exceptions::InvalidArgumentException("Parameter 'alwaysPhiUntilPhiStates' must not be null."); } // Perform search. diff --git a/src/storage/BitVector.h b/src/storage/BitVector.h index a7c063eb4..7610a85a1 100644 --- a/src/storage/BitVector.h +++ b/src/storage/BitVector.h @@ -6,11 +6,11 @@ #include #include "boost/integer/integer_mask.hpp" -#include "src/exceptions/invalid_state.h" -#include "src/exceptions/invalid_argument.h" -#include "src/exceptions/out_of_range.h" +#include "src/exceptions/InvalidStateException.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" -#include "src/utility/osDetection.h" +#include "src/utility/OsDetection.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" @@ -102,7 +102,7 @@ public: // Check whether the given length is valid. if (length == 0) { LOG4CPLUS_ERROR(logger, "Trying to create bit vector of size 0."); - throw mrmc::exceptions::invalid_argument("Trying to create a bit vector of size 0."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create a bit vector of size 0."); } // Compute the correct number of buckets needed to store the given number of bits @@ -205,7 +205,7 @@ public: */ void set(const uint_fast64_t index, const bool value) { uint_fast64_t bucket = index >> 6; - if (bucket >= this->bucketCount) throw mrmc::exceptions::out_of_range(); + if (bucket >= this->bucketCount) throw mrmc::exceptions::OutOfRangeException(); uint_fast64_t mask = static_cast(1) << (index & mod64mask); if (value) { this->bucketArray[bucket] |= mask; @@ -223,7 +223,7 @@ public: */ bool get(const uint_fast64_t index) const { uint_fast64_t bucket = index >> 6; - if (bucket >= this->bucketCount) throw mrmc::exceptions::out_of_range(); + if (bucket >= this->bucketCount) throw mrmc::exceptions::OutOfRangeException(); uint_fast64_t mask = static_cast(1) << (index & mod64mask); return ((this->bucketArray[bucket] & mask) == mask); } diff --git a/src/storage/SquareSparseMatrix.h b/src/storage/SquareSparseMatrix.h index 4fe87daed..9fb363d42 100644 --- a/src/storage/SquareSparseMatrix.h +++ b/src/storage/SquareSparseMatrix.h @@ -7,14 +7,14 @@ #include #include "boost/integer/integer_mask.hpp" -#include "src/exceptions/invalid_state.h" -#include "src/exceptions/invalid_argument.h" -#include "src/exceptions/out_of_range.h" -#include "src/exceptions/file_IO_exception.h" +#include "src/exceptions/InvalidStateException.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" +#include "src/exceptions/FileIoException.h" #include "src/storage/BitVector.h" #include "src/storage/JacobiDecomposition.h" -#include "src/utility/const_templates.h" +#include "src/utility/ConstTemplates.h" #include "Eigen/Sparse" #include "gmm/gmm_matrix.h" @@ -78,7 +78,7 @@ public: // Check whether copying the matrix is safe. if (!ssm.hasError()) { LOG4CPLUS_ERROR(logger, "Trying to copy sparse matrix in error state."); - throw mrmc::exceptions::invalid_argument("Trying to copy sparse matrix in error state."); + throw mrmc::exceptions::InvalidArgumentException("Trying to copy sparse matrix in error state."); } else { // Try to prepare the internal storage and throw an error in case // of a failure. @@ -142,15 +142,15 @@ public: if (internalStatus != MatrixStatus::UnInitialized) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize matrix that is not uninitialized."); - throw mrmc::exceptions::invalid_state("Trying to initialize matrix that is not uninitialized."); + throw mrmc::exceptions::InvalidStateException("Trying to initialize matrix that is not uninitialized."); } else if (rowCount == 0) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to create initialize a matrix with 0 rows."); - throw mrmc::exceptions::invalid_argument("Trying to create initialize a matrix with 0 rows."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create initialize a matrix with 0 rows."); } else if (((rowCount * rowCount) - rowCount) < nonZeroEntries) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize a matrix with more non-zero entries than there can be."); - throw mrmc::exceptions::invalid_argument("Trying to initialize a matrix with more non-zero entries than there can be."); + throw mrmc::exceptions::InvalidArgumentException("Trying to initialize a matrix with more non-zero entries than there can be."); } else { // If it is safe, initialize necessary members and prepare the // internal storage. @@ -181,7 +181,7 @@ public: if (!eigenSparseMatrix.isCompressed()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to initialize from an Eigen matrix that is not in compressed form."); - throw mrmc::exceptions::invalid_argument("Trying to initialize from an Eigen matrix that is not in compressed form."); + throw mrmc::exceptions::InvalidArgumentException("Trying to initialize from an Eigen matrix that is not in compressed form."); } // Compute the actual (i.e. non-diagonal) number of non-zero entries. @@ -274,7 +274,7 @@ public: if ((row > rowCount) || (col > rowCount)) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to add a value at illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to add a value at illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to add a value at illegal position."); } if (row == col) { // Set a diagonal element. @@ -307,11 +307,11 @@ public: if (!isInitialized()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to finalize an uninitialized matrix."); - throw mrmc::exceptions::invalid_state("Trying to finalize an uninitialized matrix."); + throw mrmc::exceptions::InvalidStateException("Trying to finalize an uninitialized matrix."); } else if (currentSize != nonZeroEntryCount) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to finalize a matrix that was initialized with more non-zero entries than given."); - throw mrmc::exceptions::invalid_state("Trying to finalize a matrix that was initialized with more non-zero entries than given."); + throw mrmc::exceptions::InvalidStateException("Trying to finalize a matrix that was initialized with more non-zero entries than given."); } else { // Fill in the missing entries in the row_indications array. // (Can happen because of empty rows at the end.) @@ -345,7 +345,7 @@ public: // Check for illegal access indices. if ((row > rowCount) || (col > rowCount)) { LOG4CPLUS_ERROR(logger, "Trying to read a value from illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to read a value from illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to read a value from illegal position."); return false; } @@ -395,7 +395,7 @@ public: // Check for illegal access indices. if ((row > rowCount) || (col > rowCount)) { LOG4CPLUS_ERROR(logger, "Trying to read a value from illegal position (" << row << ", " << col << ")."); - throw mrmc::exceptions::out_of_range("Trying to read a value from illegal position."); + throw mrmc::exceptions::OutOfRangeException("Trying to read a value from illegal position."); return false; } @@ -423,7 +423,7 @@ public: ++rowStart; } - throw mrmc::exceptions::invalid_argument("Trying to get a reference to a non-existant value."); + throw mrmc::exceptions::InvalidArgumentException("Trying to get a reference to a non-existant value."); } /*! @@ -515,7 +515,7 @@ public: if (!isReadReady()) { triggerErrorState(); LOG4CPLUS_ERROR(logger, "Trying to convert a matrix that is not in a readable state to an Eigen matrix."); - throw mrmc::exceptions::invalid_state("Trying to convert a matrix that is not in a readable state to an Eigen matrix."); + throw mrmc::exceptions::InvalidStateException("Trying to convert a matrix that is not in a readable state to an Eigen matrix."); } else { // Create the resulting matrix. int_fast32_t eigenRows = static_cast(rowCount); @@ -733,7 +733,7 @@ public: // Check whether the accessed state exists. if (row > rowCount) { LOG4CPLUS_ERROR(logger, "Trying to make an illegal row " << row << " absorbing."); - throw mrmc::exceptions::out_of_range("Trying to make an illegal row absorbing."); + throw mrmc::exceptions::OutOfRangeException("Trying to make an illegal row absorbing."); return false; } @@ -797,7 +797,7 @@ public: // Check for valid constraint. if (constraint.getNumberOfSetBits() == 0) { LOG4CPLUS_ERROR(logger, "Trying to create a sub-matrix of size 0."); - throw mrmc::exceptions::invalid_argument("Trying to create a sub-matrix of size 0."); + throw mrmc::exceptions::InvalidArgumentException("Trying to create a sub-matrix of size 0."); } // First, we need to determine the number of non-zero entries of the diff --git a/src/utility/const_templates.h b/src/utility/ConstTemplates.h similarity index 94% rename from src/utility/const_templates.h rename to src/utility/ConstTemplates.h index ea2231cba..8a4abef6a 100644 --- a/src/utility/const_templates.h +++ b/src/utility/ConstTemplates.h @@ -1,12 +1,12 @@ /* - * const_templates.h + * ConstTemplates.h * * Created on: 11.10.2012 * Author: Thomas Heinemann */ -#ifndef CONST_TEMPLATES_H_ -#define CONST_TEMPLATES_H_ +#ifndef MRMC_UTILITY_CONSTTEMPLATES_H_ +#define MRMC_UTILITY_CONSTTEMPLATES_H_ namespace mrmc { @@ -93,4 +93,4 @@ inline double constGetOne(double&) { } //namespace mrmc -#endif /* CONST_TEMPLATES_H_ */ +#endif /* MRMC_UTILITY_CONSTTEMPLATES_H_ */ diff --git a/src/utility/ioUtility.cpp b/src/utility/IoUtility.cpp similarity index 97% rename from src/utility/ioUtility.cpp rename to src/utility/IoUtility.cpp index 01872a3c9..2beddb5cd 100644 --- a/src/utility/ioUtility.cpp +++ b/src/utility/IoUtility.cpp @@ -1,11 +1,11 @@ /* - * ioUtility.cpp + * IoUtility.cpp * * Created on: 17.10.2012 * Author: Thomas Heinemann */ -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" #include "src/parser/readTraFile.h" #include "src/parser/readLabFile.h" diff --git a/src/utility/ioUtility.h b/src/utility/IoUtility.h similarity index 90% rename from src/utility/ioUtility.h rename to src/utility/IoUtility.h index 04a389a1d..5b691d9b2 100644 --- a/src/utility/ioUtility.h +++ b/src/utility/IoUtility.h @@ -1,12 +1,12 @@ /* - * ioUtility.h + * IoUtility.h * * Created on: 17.10.2012 * Author: Thomas Heinemann */ -#ifndef UTILITY_H_ -#define UTILITY_H_ +#ifndef MRMC_UTILITY_IOUTILITY_H_ +#define MRMC_UTILITY_IOUTILITY_H_ #include "src/models/Dtmc.h" @@ -42,4 +42,4 @@ mrmc::models::Dtmc* parseDTMC(const char* tra_file, const char* lab_file } //namespace mrmc -#endif /* UTILITY_H_ */ +#endif /* MRMC_UTILITY_IOUTILITY_H_ */ diff --git a/src/utility/osDetection.h b/src/utility/OsDetection.h similarity index 100% rename from src/utility/osDetection.h rename to src/utility/OsDetection.h diff --git a/src/utility/settings.cpp b/src/utility/Settings.cpp similarity index 99% rename from src/utility/settings.cpp rename to src/utility/Settings.cpp index e22e72eaa..62a56d4b7 100644 --- a/src/utility/settings.cpp +++ b/src/utility/Settings.cpp @@ -1,11 +1,11 @@ /* - * settings.cpp + * Settings.cpp * * Created on: 22.11.2012 * Author: Gereon Kremer */ -#include "src/utility/settings.h" +#include "src/utility/Settings.h" #include "src/exceptions/BaseException.h" diff --git a/src/utility/settings.h b/src/utility/Settings.h similarity index 98% rename from src/utility/settings.h rename to src/utility/Settings.h index d7387392d..931842006 100644 --- a/src/utility/settings.h +++ b/src/utility/Settings.h @@ -1,12 +1,12 @@ /* - * settings.h + * Settings.h * * Created on: 22.11.2012 * Author: Gereon Kremer */ -#ifndef SETTINGS_H_ -#define SETTINGS_H_ +#ifndef MRMC_SETTINGS_SETTINGS_H_ +#define MRMC_SETTINGS_SETTINGS_H_ #include #include @@ -212,4 +212,4 @@ namespace settings { } // namespace settings } // namespace mrmc -#endif // SETTINGS_H_ +#endif // MRMC_SETTINGS_SETTINGS_H_ diff --git a/src/utility/vector.h b/src/utility/Vector.h similarity index 88% rename from src/utility/vector.h rename to src/utility/Vector.h index d872fc124..d33de256c 100644 --- a/src/utility/vector.h +++ b/src/utility/Vector.h @@ -1,12 +1,12 @@ /* - * vector.h + * Vector.h * * Created on: 06.12.2012 * Author: Christian Dehnert */ -#ifndef VECTOR_H_ -#define VECTOR_H_ +#ifndef MRMC_UTILITY_VECTOR_H_ +#define MRMC_UTILITY_VECTOR_H_ #include "Eigen/src/Core/Matrix.h" @@ -40,4 +40,4 @@ void setVectorValues(Eigen::Matrix* eigenVector, const mrmc: } //namespace mrmc -#endif /* VECTOR_H_ */ +#endif /* MRMC_UTILITY_VECTOR_H_ */ diff --git a/test/eigen/sparse_matrix_test.cpp b/test/eigen/sparse_matrix_test.cpp index 39f6d274d..67b70f986 100644 --- a/test/eigen/sparse_matrix_test.cpp +++ b/test/eigen/sparse_matrix_test.cpp @@ -1,7 +1,7 @@ #include "gtest/gtest.h" #include "Eigen/Sparse" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "boost/integer/integer_mask.hpp" TEST(EigenSparseMatrixTest, BasicReadWriteTest) { diff --git a/test/parser/parse_dtmc_test.cpp b/test/parser/parse_dtmc_test.cpp index 239ba735f..fc5578509 100644 --- a/test/parser/parse_dtmc_test.cpp +++ b/test/parser/parse_dtmc_test.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "mrmc-config.h" -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" TEST(ParseDtmcTest, parseAndOutput) { mrmc::models::Dtmc* myDtmc; diff --git a/test/parser/read_lab_file_test.cpp b/test/parser/read_lab_file_test.cpp index 24eb98356..adc5d3a2c 100644 --- a/test/parser/read_lab_file_test.cpp +++ b/test/parser/read_lab_file_test.cpp @@ -9,14 +9,14 @@ #include "mrmc-config.h" #include "src/models/AtomicPropositionsLabeling.h" #include "src/parser/readLabFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" #include TEST(ReadLabFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) - ASSERT_THROW(mrmc::parser::LabParser(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception); + ASSERT_THROW(mrmc::parser::LabParser(0,MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); } TEST(ReadLabFileTest, ParseTest) { @@ -86,14 +86,14 @@ TEST(ReadLabFileTest, ParseTest) { } TEST(ReadLabFileTest, WrongHeaderTest1) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header1.lab"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadLabFileTest, WrongHeaderTest2) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_header2.lab"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadLabFileTest, WrongPropositionTest) { - ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::LabParser(3, MRMC_CPP_TESTS_BASE_PATH "/parser/lab_files/wrong_format_proposition.lab"), mrmc::exceptions::WrongFileFormatException); } diff --git a/test/parser/read_tra_file_test.cpp b/test/parser/read_tra_file_test.cpp index 509ea79d8..f8bc8715b 100644 --- a/test/parser/read_tra_file_test.cpp +++ b/test/parser/read_tra_file_test.cpp @@ -9,14 +9,14 @@ #include "mrmc-config.h" #include "src/storage/SquareSparseMatrix.h" #include "src/parser/readTraFile.h" -#include "src/exceptions/file_IO_exception.h" -#include "src/exceptions/wrong_file_format.h" +#include "src/exceptions/FileIoException.h" +#include "src/exceptions/WrongFileFormatException.h" -#include "src/utility/ioUtility.h" +#include "src/utility/IoUtility.h" TEST(ReadTraFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::file_IO_exception); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); } /* The following test case is based on one of the original MRMC test cases @@ -69,13 +69,13 @@ TEST(ReadTraFileTest, ParseFileTest1) { } TEST(ReadTraFileTest, WrongFormatTestHeader1) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestHeader2) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestTransition) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::wrong_file_format); + ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::WrongFileFormatException); } diff --git a/test/reward/reward_model_test.cpp b/test/reward/reward_model_test.cpp index 58a77fa1c..7cdf52b5e 100644 --- a/test/reward/reward_model_test.cpp +++ b/test/reward/reward_model_test.cpp @@ -1,7 +1,7 @@ #include "gtest/gtest.h" #include "Eigen/Sparse" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" #include "boost/integer/integer_mask.hpp" #include diff --git a/test/storage/BitVectorTest.cpp b/test/storage/BitVectorTest.cpp index a556fb790..02c52c728 100644 --- a/test/storage/BitVectorTest.cpp +++ b/test/storage/BitVectorTest.cpp @@ -1,6 +1,6 @@ #include "gtest/gtest.h" #include "src/storage/BitVector.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" TEST(BitVectorTest, GetSetTest) { mrmc::storage::BitVector *bv = NULL; diff --git a/test/storage/SquareSparseMatrixTest.cpp b/test/storage/SquareSparseMatrixTest.cpp index da42aacc4..40648118e 100644 --- a/test/storage/SquareSparseMatrixTest.cpp +++ b/test/storage/SquareSparseMatrixTest.cpp @@ -1,12 +1,13 @@ #include "gtest/gtest.h" #include "src/storage/SquareSparseMatrix.h" -#include "src/exceptions/invalid_argument.h" +#include "src/exceptions/InvalidArgumentException.h" +#include "src/exceptions/OutOfRangeException.h" TEST(SquareSparseMatrixTest, ZeroRowsTest) { mrmc::storage::SquareSparseMatrix *ssm = new mrmc::storage::SquareSparseMatrix(0); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::UnInitialized); - ASSERT_THROW(ssm->initialize(50), mrmc::exceptions::invalid_argument); + ASSERT_THROW(ssm->initialize(50), mrmc::exceptions::InvalidArgumentException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -16,7 +17,7 @@ TEST(SquareSparseMatrixTest, TooManyEntriesTest) { mrmc::storage::SquareSparseMatrix *ssm = new mrmc::storage::SquareSparseMatrix(2); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::UnInitialized); - ASSERT_THROW(ssm->initialize(10), mrmc::exceptions::invalid_argument); + ASSERT_THROW(ssm->initialize(10), mrmc::exceptions::InvalidArgumentException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -29,16 +30,16 @@ TEST(SquareSparseMatrixTest, addNextValueTest) { ASSERT_NO_THROW(ssm->initialize(1)); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Initialized); - ASSERT_THROW(ssm->addNextValue(-1, 1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(-1, 1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(1, -1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(1, -1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(6, 1, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(6, 1, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); - ASSERT_THROW(ssm->addNextValue(1, 6, 1), mrmc::exceptions::out_of_range); + ASSERT_THROW(ssm->addNextValue(1, 6, 1), mrmc::exceptions::OutOfRangeException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; @@ -57,7 +58,7 @@ TEST(SquareSparseMatrixTest, finalizeTest) { ASSERT_NO_THROW(ssm->addNextValue(1, 5, 1)); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Initialized); - ASSERT_THROW(ssm->finalize(), mrmc::exceptions::invalid_state); + ASSERT_THROW(ssm->finalize(), mrmc::exceptions::InvalidStateException); ASSERT_EQ(ssm->getState(), mrmc::storage::SquareSparseMatrix::MatrixStatus::Error); delete ssm; From 08f87d545c508803cf3bb76458d0bf57fcff7b4b Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 02:56:15 +0100 Subject: [PATCH 2/7] Some more refactoring, renaming, adding #ifndef guards... Fixed a warning in SquareSparseMatrix.h regarding a conversion from uint64 to uint --- src/exceptions/BaseException.h | 6 +++--- src/exceptions/InvalidSettings.h | 16 ---------------- src/exceptions/InvalidSettingsException.h | 16 ++++++++++++++++ ...oConvergence.h => NoConvergenceException.h} | 18 +++++++++--------- src/modelChecker/EigenDtmcPrctlModelChecker.h | 4 ++-- src/modelChecker/GmmxxDtmcPrctlModelChecker.h | 4 ++-- src/mrmc.cpp | 13 ++++++------- src/parser/{readLabFile.cpp => LabParser.cpp} | 4 ++-- src/parser/{readLabFile.h => LabParser.h} | 6 +++--- .../{readPrctlFile.cpp => PrctlParser.cpp} | 4 ++-- src/parser/{readPrctlFile.h => PrctlParser.h} | 10 +++++----- src/parser/{readTraFile.cpp => TraParser.cpp} | 4 ++-- src/parser/{readTraFile.h => TraParser.h} | 6 +++--- src/storage/SquareSparseMatrix.h | 2 +- src/utility/IoUtility.cpp | 4 ++-- src/utility/Settings.cpp | 8 ++++---- src/utility/Settings.h | 4 ++-- test/parser/ReadLabFileTest.cpp | 2 +- test/parser/ReadTraFileTest.cpp | 2 +- 19 files changed, 66 insertions(+), 67 deletions(-) delete mode 100644 src/exceptions/InvalidSettings.h create mode 100644 src/exceptions/InvalidSettingsException.h rename src/exceptions/{NoConvergence.h => NoConvergenceException.h} (63%) rename src/parser/{readLabFile.cpp => LabParser.cpp} (98%) rename src/parser/{readLabFile.h => LabParser.h} (88%) rename src/parser/{readPrctlFile.cpp => PrctlParser.cpp} (97%) rename src/parser/{readPrctlFile.h => PrctlParser.h} (70%) rename src/parser/{readTraFile.cpp => TraParser.cpp} (98%) rename src/parser/{readTraFile.h => TraParser.h} (87%) diff --git a/src/exceptions/BaseException.h b/src/exceptions/BaseException.h index cfba4218e..fcf92ee2c 100644 --- a/src/exceptions/BaseException.h +++ b/src/exceptions/BaseException.h @@ -1,5 +1,5 @@ -#ifndef BASEEXCEPTION_H_ -#define BASEEXCEPTION_H_ +#ifndef MRMC_EXCEPTIONS_BASEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_BASEEXCEPTION_H_ #include #include @@ -38,4 +38,4 @@ class BaseException : public std::exception } // namespace exceptions } // namespace mrmc -#endif // BASEEXCEPTION_H_ +#endif // MRMC_EXCEPTIONS_BASEEXCEPTION_H_ diff --git a/src/exceptions/InvalidSettings.h b/src/exceptions/InvalidSettings.h deleted file mode 100644 index 0ac7b14b8..000000000 --- a/src/exceptions/InvalidSettings.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef INVALIDSETTINGS_H_ -#define INVALIDSETTINGS_H_ - -#include "src/exceptions/BaseException.h" - -namespace mrmc { -namespace exceptions { - -class InvalidSettings : public BaseException -{ -}; - -} // namespace exceptions -} // namespace mrmc - -#endif // INVALIDSETTINGS_H_ diff --git a/src/exceptions/InvalidSettingsException.h b/src/exceptions/InvalidSettingsException.h new file mode 100644 index 000000000..315ec64e7 --- /dev/null +++ b/src/exceptions/InvalidSettingsException.h @@ -0,0 +1,16 @@ +#ifndef MRMC_EXCEPTIONS_INVALIDSETTINGSEXCEPTION_H_ +#define MRMC_EXCEPTIONS_INVALIDSETTINGSEXCEPTION_H_ + +#include "src/exceptions/BaseException.h" + +namespace mrmc { +namespace exceptions { + +class InvalidSettingsException : public BaseException +{ +}; + +} // namespace exceptions +} // namespace mrmc + +#endif // MRMC_EXCEPTIONS_INVALIDSETTINGSEXCEPTION_H_ diff --git a/src/exceptions/NoConvergence.h b/src/exceptions/NoConvergenceException.h similarity index 63% rename from src/exceptions/NoConvergence.h rename to src/exceptions/NoConvergenceException.h index bd5b71af9..1ea6bd655 100644 --- a/src/exceptions/NoConvergence.h +++ b/src/exceptions/NoConvergenceException.h @@ -1,5 +1,5 @@ -#ifndef MRMC_EXCEPTIONS_NO_CONVERGENCE_H_ -#define MRMC_EXCEPTIONS_NO_CONVERGENCE_H_ +#ifndef MRMC_EXCEPTIONS_NOCONVERGENCEEXCEPTION_H_ +#define MRMC_EXCEPTIONS_NOCONVERGENCEEXCEPTION_H_ #include @@ -7,7 +7,7 @@ namespace mrmc { namespace exceptions { //!This exception is thrown when an iterative solver failed to converge with the given maxIterations -class NoConvergence : public std::exception +class NoConvergenceException : public std::exception { public: /* The Visual C++-Version of the exception class has constructors accepting @@ -17,27 +17,27 @@ class NoConvergence : public std::exception * constructor is used under linux (which will ignore the parameter) */ #ifdef _WIN32 - NoConvergence() : exception("::mrmc::NoConvergence"){ + NoConvergenceException() : exception("::mrmc::exceptions::NoConvergenceException"){ iterations = -1; maxIterations = -1; } - NoConvergence(const char * const s, int iterations, int maxIterations): exception(s) { + NoConvergenceException(const char * const s, int iterations, int maxIterations): exception(s) { this->iterations = iterations; this->maxIterations = maxIterations; } #else - NoConvergence() : exception() { + NoConvergenceException() : exception() { iterations = -1; maxIterations = -1; } - NoConvergence(const char * const s, int iterations, int maxIterations): exception() { + NoConvergenceException(const char * const s, int iterations, int maxIterations): exception() { this->iterations = iterations; this->maxIterations = maxIterations; } #endif virtual const char* what() const throw() - { return "mrmc::NoConvergence"; } + { return "mrmc::exceptions::NoConvergenceException"; } int getIterationCount() const { return iterations; @@ -53,4 +53,4 @@ class NoConvergence : public std::exception } // namespace exceptions } // namespace mrmc -#endif // MRMC_EXCEPTIONS_NO_CONVERGENCE_H_ +#endif // MRMC_EXCEPTIONS_NOCONVERGENCEEXCEPTION_H_ diff --git a/src/modelChecker/EigenDtmcPrctlModelChecker.h b/src/modelChecker/EigenDtmcPrctlModelChecker.h index 084c576f4..a11efe4ae 100644 --- a/src/modelChecker/EigenDtmcPrctlModelChecker.h +++ b/src/modelChecker/EigenDtmcPrctlModelChecker.h @@ -14,7 +14,7 @@ #include "src/modelChecker/DtmcPrctlModelChecker.h" #include "src/solver/GraphAnalyzer.h" #include "src/utility/ConstTemplates.h" -#include "src/exceptions/NoConvergence.h" +#include "src/exceptions/NoConvergenceException.h" #include "Eigen/Sparse" #include "Eigen/src/IterativeLinearSolvers/BiCGSTAB.h" @@ -197,7 +197,7 @@ public: LOG4CPLUS_ERROR(logger, "Solving of Submatrix failed: InvalidInput"); } else if(solver.info() == Eigen::ComputationInfo::NoConvergence) { // NoConvergence - throw mrmc::exceptions::NoConvergence("Solving of Submatrix with Eigen failed", solver.iterations(), solver.maxIterations()); + throw mrmc::exceptions::NoConvergenceException("Solving of Submatrix with Eigen failed", solver.iterations(), solver.maxIterations()); } else if(solver.info() == Eigen::ComputationInfo::NumericalIssue) { // NumericalIssue LOG4CPLUS_ERROR(logger, "Solving of Submatrix failed: NumericalIssue"); diff --git a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h index a3b1a57c4..1ebcfb574 100644 --- a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h +++ b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h @@ -250,7 +250,7 @@ public: */ static void validateLeMethod(const std::string& lemethod) { if (lemethod.compare("bicgstab") != 0 && lemethod.compare("qmr") != 0) { - throw exceptions::InvalidSettings() << "Argument " << lemethod << " for option 'lemethod' is invalid."; + throw exceptions::InvalidSettingsException() << "Argument " << lemethod << " for option 'lemethod' is invalid."; } } @@ -260,7 +260,7 @@ public: */ static void validatePreconditioner(const std::string& preconditioner) { if (preconditioner.compare("ilu") != 0 && preconditioner.compare("diagonal") != 0 && preconditioner.compare("ildlt") && preconditioner.compare("none") != 0) { - throw exceptions::InvalidSettings() << "Argument " << preconditioner << " for option 'precond' is invalid."; + throw exceptions::InvalidSettingsException() << "Argument " << preconditioner << " for option 'precond' is invalid."; } } }; diff --git a/src/mrmc.cpp b/src/mrmc.cpp index 882c096a8..9bb62172a 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -24,20 +24,19 @@ #include "src/models/AtomicPropositionsLabeling.h" #include "src/modelChecker/EigenDtmcPrctlModelChecker.h" #include "src/modelChecker/GmmxxDtmcPrctlModelChecker.h" -#include "src/parser/readLabFile.h" -#include "src/parser/readTraFile.h" -#include "src/parser/readPrctlFile.h" +#include "src/parser/LabParser.h" +#include "src/parser/TraParser.h" +#include "src/parser/PrctlParser.h" #include "src/solver/GraphAnalyzer.h" #include "src/utility/Settings.h" #include "src/formula/Formulas.h" -#include "src/exceptions/NoConvergence.h" #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" #include "log4cplus/consoleappender.h" #include "log4cplus/fileappender.h" -#include "src/exceptions/InvalidSettings.h" +#include "src/exceptions/InvalidSettingsException.h" log4cplus::Logger logger; @@ -76,7 +75,7 @@ int main(const int argc, const char* argv[]) { try { mrmc::settings::Settings::registerModule >(); s = mrmc::settings::newInstance(argc, argv, nullptr); - } catch (mrmc::exceptions::InvalidSettings& e) { + } catch (mrmc::exceptions::InvalidSettingsException& e) { LOG4CPLUS_FATAL(logger, "InvalidSettings error: " << e.what() << "."); LOG4CPLUS_FATAL(logger, "Could not recover from settings error, terminating."); std::cout << "Could not recover from settings error: " << e.what() << "." << std::endl; @@ -91,7 +90,7 @@ int main(const int argc, const char* argv[]) { return 0; } if (s->isSet("test-prctl")) { - mrmc::parser::PRCTLParser parser(s->getString("test-prctl").c_str()); + mrmc::parser::PrctlParser parser(s->getString("test-prctl").c_str()); delete s; return 0; } diff --git a/src/parser/readLabFile.cpp b/src/parser/LabParser.cpp similarity index 98% rename from src/parser/readLabFile.cpp rename to src/parser/LabParser.cpp index 17a47a5db..8f0b18117 100644 --- a/src/parser/readLabFile.cpp +++ b/src/parser/LabParser.cpp @@ -1,11 +1,11 @@ /*! - * readLabFile.cpp + * LabParser.cpp * * Created on: 21.11.2012 * Author: Gereon Kremer */ -#include "readLabFile.h" +#include "src/parser/LabParser.h" #include "src/exceptions/WrongFileFormatException.h" #include "src/exceptions/FileIoException.h" diff --git a/src/parser/readLabFile.h b/src/parser/LabParser.h similarity index 88% rename from src/parser/readLabFile.h rename to src/parser/LabParser.h index 6884226e5..bb1e2d992 100644 --- a/src/parser/readLabFile.h +++ b/src/parser/LabParser.h @@ -1,5 +1,5 @@ -#ifndef READLABFILE_H_ -#define READLABFILE_H_ +#ifndef MRMC_PARSER_LABPARSER_H_ +#define MRMC_PARSER_LABPARSER_H_ #include "src/models/AtomicPropositionsLabeling.h" #include "boost/integer/integer_mask.hpp" @@ -32,4 +32,4 @@ class LabParser : Parser { } // namespace parser } // namespace mrmc -#endif /* READLABFILE_H_ */ +#endif /* MRMC_PARSER_LABPARSER_H_ */ diff --git a/src/parser/readPrctlFile.cpp b/src/parser/PrctlParser.cpp similarity index 97% rename from src/parser/readPrctlFile.cpp rename to src/parser/PrctlParser.cpp index f0b669d34..695d64a78 100644 --- a/src/parser/readPrctlFile.cpp +++ b/src/parser/PrctlParser.cpp @@ -1,4 +1,4 @@ -#include "src/parser/readPrctlFile.h" +#include "src/parser/PrctlParser.h" #include #include @@ -130,7 +130,7 @@ namespace }; } -mrmc::parser::PRCTLParser::PRCTLParser(const char* filename) +mrmc::parser::PrctlParser::PrctlParser(const char* filename) { SpiritParser p; mrmc::parser::MappedFile file(filename); diff --git a/src/parser/readPrctlFile.h b/src/parser/PrctlParser.h similarity index 70% rename from src/parser/readPrctlFile.h rename to src/parser/PrctlParser.h index e6ec06fdc..0cd5ee7cf 100644 --- a/src/parser/readPrctlFile.h +++ b/src/parser/PrctlParser.h @@ -1,5 +1,5 @@ -#ifndef READPRCTLFILE_H_ -#define READPRCTLFILE_H_ +#ifndef MRMC_PARSER_PRCTLPARSER_H_ +#define MRMC_PARSER_PRCTLPARSER_H_ #include "src/formula/PCTLformula.h" #include "src/parser/Parser.h" @@ -10,10 +10,10 @@ namespace parser { /*! * @brief Load PRCTL file */ -class PRCTLParser : Parser +class PrctlParser : Parser { public: - PRCTLParser(const char * filename); + PrctlParser(const char * filename); /*! * @brief return formula object parsed from file. @@ -30,4 +30,4 @@ class PRCTLParser : Parser } // namespace parser } // namespace mrmc -#endif /* READPRCTLFILE_H_ */ +#endif /* MRMC_PARSER_PRCTLPARSER_H_ */ diff --git a/src/parser/readTraFile.cpp b/src/parser/TraParser.cpp similarity index 98% rename from src/parser/readTraFile.cpp rename to src/parser/TraParser.cpp index 484c7d3cf..5b98a9dda 100644 --- a/src/parser/readTraFile.cpp +++ b/src/parser/TraParser.cpp @@ -1,11 +1,11 @@ /*! - * readTraFile.cpp + * TraParser.cpp * * Created on: 20.11.2012 * Author: Gereon Kremer */ -#include "src/parser/readTraFile.h" +#include "src/parser/TraParser.h" #include "src/exceptions/FileIoException.h" #include "src/exceptions/WrongFileFormatException.h" #include "boost/integer/integer_mask.hpp" diff --git a/src/parser/readTraFile.h b/src/parser/TraParser.h similarity index 87% rename from src/parser/readTraFile.h rename to src/parser/TraParser.h index 2b72583f9..4626fab72 100644 --- a/src/parser/readTraFile.h +++ b/src/parser/TraParser.h @@ -1,5 +1,5 @@ -#ifndef READTRAFILE_H_ -#define READTRAFILE_H_ +#ifndef MRMC_PARSER_TRAPARSER_H_ +#define MRMC_PARSER_TRAPARSER_H_ #include "src/storage/SquareSparseMatrix.h" @@ -35,4 +35,4 @@ class TraParser : Parser { } // namespace parser } // namespace mrmc -#endif /* READTRAFILE_H_ */ +#endif /* MRMC_PARSER_TRAPARSER_H_ */ diff --git a/src/storage/SquareSparseMatrix.h b/src/storage/SquareSparseMatrix.h index 9fb363d42..d8cf24760 100644 --- a/src/storage/SquareSparseMatrix.h +++ b/src/storage/SquareSparseMatrix.h @@ -670,7 +670,7 @@ public: } } // Fill in sentinel element at the end. - result->jc[rowCount] = realNonZeros; + result->jc[rowCount] = static_cast(realNonZeros); // Now, we can copy the temporary array to the GMMXX format. result->ir.resize(realNonZeros); diff --git a/src/utility/IoUtility.cpp b/src/utility/IoUtility.cpp index 2beddb5cd..299527044 100644 --- a/src/utility/IoUtility.cpp +++ b/src/utility/IoUtility.cpp @@ -6,8 +6,8 @@ */ #include "src/utility/IoUtility.h" -#include "src/parser/readTraFile.h" -#include "src/parser/readLabFile.h" +#include "src/parser/TraParser.h" +#include "src/parser/LabParser.h" #include diff --git a/src/utility/Settings.cpp b/src/utility/Settings.cpp index e6fea77c7..bf79a0441 100644 --- a/src/utility/Settings.cpp +++ b/src/utility/Settings.cpp @@ -102,16 +102,16 @@ Settings::Settings(const int argc, const char* argv[], const char* filename) { LOG4CPLUS_ERROR(logger, "Could not read config file"); } catch (bpo::required_option e) { - throw mrmc::exceptions::InvalidSettings() << "Required option missing"; + throw mrmc::exceptions::InvalidSettingsException() << "Required option missing"; } catch (bpo::validation_error e) { - throw mrmc::exceptions::InvalidSettings() << "Validation failed: " << e.what(); + throw mrmc::exceptions::InvalidSettingsException() << "Validation failed: " << e.what(); } catch (bpo::invalid_command_line_syntax e) { - throw mrmc::exceptions::InvalidSettings() << e.what(); + throw mrmc::exceptions::InvalidSettingsException() << e.what(); } catch (bpo::error e) { - throw mrmc::exceptions::InvalidSettings() << e.what(); + throw mrmc::exceptions::InvalidSettingsException() << e.what(); } } diff --git a/src/utility/Settings.h b/src/utility/Settings.h index 66b63890f..5b76d839e 100644 --- a/src/utility/Settings.h +++ b/src/utility/Settings.h @@ -14,7 +14,7 @@ #include #include #include -#include "src/exceptions/InvalidSettings.h" +#include "src/exceptions/InvalidSettingsException.h" namespace mrmc { @@ -52,7 +52,7 @@ namespace settings { */ template const T& get(const std::string &name) const { - if (this->vm.count(name) == 0) throw mrmc::exceptions::InvalidSettings() << "Could not read option " << name << "."; + if (this->vm.count(name) == 0) throw mrmc::exceptions::InvalidSettingsException() << "Could not read option " << name << "."; return this->vm[name].as(); } diff --git a/test/parser/ReadLabFileTest.cpp b/test/parser/ReadLabFileTest.cpp index 658076490..97e201151 100644 --- a/test/parser/ReadLabFileTest.cpp +++ b/test/parser/ReadLabFileTest.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "mrmc-config.h" #include "src/models/AtomicPropositionsLabeling.h" -#include "src/parser/readLabFile.h" +#include "src/parser/LabParser.h" #include "src/exceptions/FileIoException.h" #include "src/exceptions/WrongFileFormatException.h" diff --git a/test/parser/ReadTraFileTest.cpp b/test/parser/ReadTraFileTest.cpp index bac78d971..99c374a6b 100644 --- a/test/parser/ReadTraFileTest.cpp +++ b/test/parser/ReadTraFileTest.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "mrmc-config.h" #include "src/storage/SquareSparseMatrix.h" -#include "src/parser/readTraFile.h" +#include "src/parser/TraParser.h" #include "src/exceptions/FileIoException.h" #include "src/exceptions/WrongFileFormatException.h" From 96c7dd9a791d8116401e1b507306d779c51bf043 Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 03:08:30 +0100 Subject: [PATCH 3/7] Added the (default) external build path /build to git ignore. Added, fixed, refactored Include Guards in ALL Files, should be consistent now. --- .gitignore | 1 + src/exceptions/WrongFileFormatException.h | 6 +++--- src/formula/AP.h | 6 +++--- src/formula/And.h | 6 +++--- src/formula/BoundedUntil.h | 6 +++--- src/formula/Formulas.h | 6 +++--- src/formula/Next.h | 6 +++--- src/formula/Not.h | 6 +++--- src/formula/Or.h | 6 +++--- src/formula/PCTLPathFormula.h | 6 +++--- src/formula/PCTLStateFormula.h | 6 +++--- src/formula/PCTLformula.h | 6 +++--- src/formula/ProbabilisticIntervalOperator.h | 6 +++--- src/formula/ProbabilisticNoBoundsOperator.h | 7 ++++--- src/formula/ProbabilisticOperator.h | 7 ++++--- src/formula/Until.h | 6 +++--- src/modelChecker/DtmcPrctlModelChecker.h | 6 +++--- src/modelChecker/EigenDtmcPrctlModelChecker.h | 6 +++--- src/modelChecker/GmmxxDtmcPrctlModelChecker.h | 6 +++--- src/models/AtomicPropositionsLabeling.h | 8 ++++---- src/models/Dtmc.h | 8 ++++---- src/models/GraphTransitions.h | 8 ++++---- src/solver/GraphAnalyzer.h | 6 +++--- src/storage/BitVector.h | 6 +++--- src/utility/OsDetection.h | 5 ++++- 25 files changed, 79 insertions(+), 73 deletions(-) diff --git a/.gitignore b/.gitignore index 268c6f690..6f15a4cb4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ ipch/ obj/ CMakeFiles/ # The build Dir +build/ build//CMakeLists.txt /*.vcxproj /*.filters diff --git a/src/exceptions/WrongFileFormatException.h b/src/exceptions/WrongFileFormatException.h index 11dafe38b..13cb53b2d 100644 --- a/src/exceptions/WrongFileFormatException.h +++ b/src/exceptions/WrongFileFormatException.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ -#define MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ +#ifndef MRMC_EXCEPTIONS_WRONGFILEFORMATEXCEPTION_H_ +#define MRMC_EXCEPTIONS_WRONGFILEFORMATEXCEPTION_H_ #include @@ -32,4 +32,4 @@ class WrongFileFormatException : public std::exception { } //namespace mrmc -#endif /* MRMC_EXCEPTIONS_WRONGFILEFORMAT_H_ */ +#endif /* MRMC_EXCEPTIONS_WRONGFILEFORMATEXCEPTION_H_ */ diff --git a/src/formula/AP.h b/src/formula/AP.h index 990365ff0..05f200c2c 100644 --- a/src/formula/AP.h +++ b/src/formula/AP.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef AP_H_ -#define AP_H_ +#ifndef MRMC_FORMULA_AP_H_ +#define MRMC_FORMULA_AP_H_ #include "PCTLStateFormula.h" @@ -89,4 +89,4 @@ private: } //namespace mrmc -#endif /* AP_H_ */ +#endif /* MRMC_FORMULA_AP_H_ */ diff --git a/src/formula/And.h b/src/formula/And.h index 7a42193b8..910e23e8f 100644 --- a/src/formula/And.h +++ b/src/formula/And.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef AND_H_ -#define AND_H_ +#ifndef MRMC_FORMULA_AND_H_ +#define MRMC_FORMULA_AND_H_ #include "PCTLStateFormula.h" #include @@ -154,4 +154,4 @@ private: } //namespace mrmc -#endif /* AND_H_ */ +#endif /* MRMC_FORMULA_AND_H_ */ diff --git a/src/formula/BoundedUntil.h b/src/formula/BoundedUntil.h index 51131602d..edc447375 100644 --- a/src/formula/BoundedUntil.h +++ b/src/formula/BoundedUntil.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef BOUNDEDUNTIL_H_ -#define BOUNDEDUNTIL_H_ +#ifndef MRMC_FORMULA_BOUNDEDUNTIL_H_ +#define MRMC_FORMULA_BOUNDEDUNTIL_H_ #include "PCTLPathFormula.h" #include "PCTLStateFormula.h" @@ -180,4 +180,4 @@ private: } //namespace mrmc -#endif /* BOUNDEDUNTIL_H_ */ +#endif /* MRMC_FORMULA_BOUNDEDUNTIL_H_ */ diff --git a/src/formula/Formulas.h b/src/formula/Formulas.h index 5b8b4bffc..cd2370a24 100644 --- a/src/formula/Formulas.h +++ b/src/formula/Formulas.h @@ -5,8 +5,8 @@ * Author: chris */ -#ifndef FORMULAS_H_ -#define FORMULAS_H_ +#ifndef MRMC_FORMULA_FORMULAS_H_ +#define MRMC_FORMULA_FORMULAS_H_ #include "And.h" #include "AP.h" @@ -22,4 +22,4 @@ #include "ProbabilisticIntervalOperator.h" #include "Until.h" -#endif /* FORMULAS_H_ */ +#endif /* MRMC_FORMULA_FORMULAS_H_ */ diff --git a/src/formula/Next.h b/src/formula/Next.h index 2eb00be05..3ffa8451d 100644 --- a/src/formula/Next.h +++ b/src/formula/Next.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef NEXT_H_ -#define NEXT_H_ +#ifndef MRMC_FORMULA_NEXT_H_ +#define MRMC_FORMULA_NEXT_H_ #include "PCTLPathFormula.h" #include "PCTLStateFormula.h" @@ -124,4 +124,4 @@ private: } //namespace mrmc -#endif /* NEXT_H_ */ +#endif /* MRMC_FORMULA_NEXT_H_ */ diff --git a/src/formula/Not.h b/src/formula/Not.h index 574d287a1..b4afb7d72 100644 --- a/src/formula/Not.h +++ b/src/formula/Not.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef NOT_H_ -#define NOT_H_ +#ifndef MRMC_FORMULA_NOT_H_ +#define MRMC_FORMULA_NOT_H_ #include "PCTLStateFormula.h" @@ -117,4 +117,4 @@ private: } //namespace MRMC -#endif /* NOT_H_ */ +#endif /* MRMC_FORMULA_NOT_H_ */ diff --git a/src/formula/Or.h b/src/formula/Or.h index 5a60d9770..110ee5228 100644 --- a/src/formula/Or.h +++ b/src/formula/Or.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef OR_H_ -#define OR_H_ +#ifndef MRMC_FORMULA_OR_H_ +#define MRMC_FORMULA_OR_H_ #include "PCTLStateFormula.h" @@ -153,4 +153,4 @@ private: } //namespace mrmc -#endif /* OR_H_ */ +#endif /* MRMC_FORMULA_OR_H_ */ diff --git a/src/formula/PCTLPathFormula.h b/src/formula/PCTLPathFormula.h index a70a35f53..c8230f621 100644 --- a/src/formula/PCTLPathFormula.h +++ b/src/formula/PCTLPathFormula.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef PCTLPATHFORMULA_H_ -#define PCTLPATHFORMULA_H_ +#ifndef MRMC_FORMULA_PCTLPATHFORMULA_H_ +#define MRMC_FORMULA_PCTLPATHFORMULA_H_ #include "PCTLformula.h" #include "modelChecker/DtmcPrctlModelChecker.h" @@ -62,4 +62,4 @@ public: } //namespace mrmc -#endif /* PCTLPATHFORMULA_H_ */ +#endif /* MRMC_FORMULA_PCTLPATHFORMULA_H_ */ diff --git a/src/formula/PCTLStateFormula.h b/src/formula/PCTLStateFormula.h index a8ca831c3..c9ed0b5fe 100644 --- a/src/formula/PCTLStateFormula.h +++ b/src/formula/PCTLStateFormula.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef PCTLSTATEFORMULA_H_ -#define PCTLSTATEFORMULA_H_ +#ifndef MRMC_FORMULA_PCTLSTATEFORMULA_H_ +#define MRMC_FORMULA_PCTLSTATEFORMULA_H_ #include "PCTLformula.h" #include "storage/BitVector.h" @@ -63,4 +63,4 @@ public: } //namespace mrmc -#endif /* PCTLSTATEFORMULA_H_ */ +#endif /* MRMC_FORMULA_PCTLSTATEFORMULA_H_ */ diff --git a/src/formula/PCTLformula.h b/src/formula/PCTLformula.h index add5c5198..26c805b3e 100644 --- a/src/formula/PCTLformula.h +++ b/src/formula/PCTLformula.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef PCTLFORMULA_H_ -#define PCTLFORMULA_H_ +#ifndef MRMC_FORMULA_PCTLFORMULA_H_ +#define MRMC_FORMULA_PCTLFORMULA_H_ #include @@ -45,4 +45,4 @@ public: } //namespace mrmc -#endif /* PCTLFORMULA_H_ */ +#endif /* MRMC_FORMULA_PCTLFORMULA_H_ */ diff --git a/src/formula/ProbabilisticIntervalOperator.h b/src/formula/ProbabilisticIntervalOperator.h index 8bd86d393..6fe054366 100644 --- a/src/formula/ProbabilisticIntervalOperator.h +++ b/src/formula/ProbabilisticIntervalOperator.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef PROBABILISTICINTERVALOPERATOR_H_ -#define PROBABILISTICINTERVALOPERATOR_H_ +#ifndef MRMC_FORMULA_PROBABILISTICINTERVALOPERATOR_H_ +#define MRMC_FORMULA_PROBABILISTICINTERVALOPERATOR_H_ #include "PCTLStateFormula.h" #include "PCTLPathFormula.h" @@ -173,4 +173,4 @@ private: } //namespace mrmc -#endif /* PROBABILISTICINTERVALOPERATOR_H_ */ +#endif /* MRMC_FORMULA_PROBABILISTICINTERVALOPERATOR_H_ */ diff --git a/src/formula/ProbabilisticNoBoundsOperator.h b/src/formula/ProbabilisticNoBoundsOperator.h index 09a2fc4c3..0082fe33f 100644 --- a/src/formula/ProbabilisticNoBoundsOperator.h +++ b/src/formula/ProbabilisticNoBoundsOperator.h @@ -5,8 +5,8 @@ * Author: thomas */ -#ifndef PROBABILISTICNOBOUNDSOPERATOR_H_ -#define PROBABILISTICNOBOUNDSOPERATOR_H_ +#ifndef MRMC_FORMULA_PROBABILISTICNOBOUNDSOPERATOR_H_ +#define MRMC_FORMULA_PROBABILISTICNOBOUNDSOPERATOR_H_ #include "PCTLformula.h" #include "PCTLPathFormula.h" @@ -97,4 +97,5 @@ private: } /* namespace formula */ } /* namespace mrmc */ -#endif /* PROBABILISTICNOBOUNDSOPERATOR_H_ */ + +#endif /* MRMC_FORMULA_PROBABILISTICNOBOUNDSOPERATOR_H_ */ diff --git a/src/formula/ProbabilisticOperator.h b/src/formula/ProbabilisticOperator.h index cbceee0d4..8905e030d 100644 --- a/src/formula/ProbabilisticOperator.h +++ b/src/formula/ProbabilisticOperator.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef PROBABILISTICOPERATOR_H_ -#define PROBABILISTICOPERATOR_H_ +#ifndef MRMC_FORMULA_PROBABILISTICOPERATOR_H_ +#define MRMC_FORMULA_PROBABILISTICOPERATOR_H_ #include "PCTLStateFormula.h" @@ -153,4 +153,5 @@ private: } /* namespace formula */ } /* namespace mrmc */ -#endif /* PROBABILISTICOPERATOR_H_ */ + +#endif /* MRMC_FORMULA_PROBABILISTICOPERATOR_H_ */ diff --git a/src/formula/Until.h b/src/formula/Until.h index 1b492e68b..fb0b67f47 100644 --- a/src/formula/Until.h +++ b/src/formula/Until.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef UNTIL_H_ -#define UNTIL_H_ +#ifndef MRMC_FORMULA_UNTIL_H_ +#define MRMC_FORMULA_UNTIL_H_ #include "PCTLPathFormula.h" #include "PCTLStateFormula.h" @@ -153,4 +153,4 @@ private: } //namespace mrmc -#endif /* UNTIL_H_ */ +#endif /* MRMC_FORMULA_UNTIL_H_ */ diff --git a/src/modelChecker/DtmcPrctlModelChecker.h b/src/modelChecker/DtmcPrctlModelChecker.h index 76aa00531..984655aa9 100644 --- a/src/modelChecker/DtmcPrctlModelChecker.h +++ b/src/modelChecker/DtmcPrctlModelChecker.h @@ -5,8 +5,8 @@ * Author: Thomas Heinemann */ -#ifndef DTMCPRCTLMODELCHECKER_H_ -#define DTMCPRCTLMODELCHECKER_H_ +#ifndef MRMC_MODELCHECKER_DTMCPRCTLMODELCHECKER_H_ +#define MRMC_MODELCHECKER_DTMCPRCTLMODELCHECKER_H_ namespace mrmc { @@ -262,4 +262,4 @@ private: } //namespace mrmc -#endif /* DTMCPRCTLMODELCHECKER_H_ */ +#endif /* MRMC_MODELCHECKER_DTMCPRCTLMODELCHECKER_H_ */ diff --git a/src/modelChecker/EigenDtmcPrctlModelChecker.h b/src/modelChecker/EigenDtmcPrctlModelChecker.h index a11efe4ae..9a1760292 100644 --- a/src/modelChecker/EigenDtmcPrctlModelChecker.h +++ b/src/modelChecker/EigenDtmcPrctlModelChecker.h @@ -5,8 +5,8 @@ * Author: */ -#ifndef EIGENDTMCPRCTLMODELCHECKER_H_ -#define EIGENDTMCPRCTLMODELCHECKER_H_ +#ifndef MRMC_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_ +#define MRMC_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_ #include "src/utility/Vector.h" @@ -226,4 +226,4 @@ public: } //namespace mrmc -#endif /* EIGENDTMCPRCTLMODELCHECKER_H_ */ +#endif /* MRMC_MODELCHECKER_EIGENDTMCPRCTLMODELCHECKER_H_ */ diff --git a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h index 1ebcfb574..5dde36fc4 100644 --- a/src/modelChecker/GmmxxDtmcPrctlModelChecker.h +++ b/src/modelChecker/GmmxxDtmcPrctlModelChecker.h @@ -5,8 +5,8 @@ * Author: Christian Dehnert */ -#ifndef GMMXXDTMCPRCTLMODELCHECKER_H_ -#define GMMXXDTMCPRCTLMODELCHECKER_H_ +#ifndef MRMC_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_ +#define MRMC_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_ #include @@ -269,4 +269,4 @@ public: } //namespace mrmc -#endif /* GMMXXDTMCPRCTLMODELCHECKER_H_ */ +#endif /* MRMC_MODELCHECKER_GMMXXDTMCPRCTLMODELCHECKER_H_ */ diff --git a/src/models/AtomicPropositionsLabeling.h b/src/models/AtomicPropositionsLabeling.h index a35fd693a..d7632445f 100644 --- a/src/models/AtomicPropositionsLabeling.h +++ b/src/models/AtomicPropositionsLabeling.h @@ -1,12 +1,12 @@ /* - * labeling.h + * AtomicPropositionsLabeling.h * * Created on: 10.09.2012 * Author: Thomas Heinemann */ -#ifndef MRMC_MODELS_ATOMIC_PROPOSITIONS_LABELING_H_ -#define MRMC_MODELS_ATOMIC_PROPOSITIONS_LABELING_H_ +#ifndef MRMC_MODELS_ATOMICPROPOSITIONSLABELING_H_ +#define MRMC_MODELS_ATOMICPROPOSITIONSLABELING_H_ #include "src/storage/BitVector.h" #include "src/exceptions/OutOfRangeException.h" @@ -231,4 +231,4 @@ private: } // namespace mrmc -#endif /* MRMC_MODELS_ATOMIC_PROPOSITIONS_LABELING_H_ */ +#endif /* MRMC_MODELS_ATOMICPROPOSITIONSLABELING_H_ */ diff --git a/src/models/Dtmc.h b/src/models/Dtmc.h index 8fa263f54..dc871e143 100644 --- a/src/models/Dtmc.h +++ b/src/models/Dtmc.h @@ -1,12 +1,12 @@ /* - * dtmc.h + * Dtmc.h * * Created on: 14.11.2012 * Author: Christian Dehnert */ -#ifndef DTMC_H_ -#define DTMC_H_ +#ifndef MRMC_MODELS_DTMC_H_ +#define MRMC_MODELS_DTMC_H_ #include #include @@ -155,4 +155,4 @@ private: } // namespace mrmc -#endif /* DTMC_H_ */ +#endif /* MRMC_MODELS_DTMC_H_ */ diff --git a/src/models/GraphTransitions.h b/src/models/GraphTransitions.h index 4563bfc59..6d45bad88 100644 --- a/src/models/GraphTransitions.h +++ b/src/models/GraphTransitions.h @@ -1,12 +1,12 @@ /* - * backward_transitions.h + * GraphTransitions.h * * Created on: 17.11.2012 * Author: Christian Dehnert */ -#ifndef GRAPHTRANSITIONS_H_ -#define BACKWARDTRANSITIONS_H_ +#ifndef MRMC_MODELS_GRAPHTRANSITIONS_H_ +#define MRMC_MODELS_GRAPHTRANSITIONS_H_ #include "src/storage/SquareSparseMatrix.h" @@ -175,4 +175,4 @@ private: } // namespace mrmc -#endif /* GRAPHTRANSITIONS_H_ */ +#endif /* MRMC_MODELS_GRAPHTRANSITIONS_H_ */ diff --git a/src/solver/GraphAnalyzer.h b/src/solver/GraphAnalyzer.h index e1f062798..6660ad2f9 100644 --- a/src/solver/GraphAnalyzer.h +++ b/src/solver/GraphAnalyzer.h @@ -5,8 +5,8 @@ * Author: Christian Dehnert */ -#ifndef GRAPHANALYZER_H_ -#define GRAPHANALYZER_H_ +#ifndef MRMC_SOLVER_GRAPHANALYZER_H_ +#define MRMC_SOLVER_GRAPHANALYZER_H_ #include "src/models/Dtmc.h" #include "src/exceptions/InvalidArgumentException.h" @@ -127,4 +127,4 @@ public: } // namespace mrmc -#endif /* GRAPHANALYZER_H_ */ +#endif /* MRMC_SOLVER_GRAPHANALYZER_H_ */ diff --git a/src/storage/BitVector.h b/src/storage/BitVector.h index 7610a85a1..041272daf 100644 --- a/src/storage/BitVector.h +++ b/src/storage/BitVector.h @@ -1,5 +1,5 @@ -#ifndef MRMC_VECTOR_BITVECTOR_H_ -#define MRMC_VECTOR_BITVECTOR_H_ +#ifndef MRMC_STORAGE_BITVECTOR_H_ +#define MRMC_STORAGE_BITVECTOR_H_ #include #include @@ -544,4 +544,4 @@ private: } // namespace mrmc -#endif // MRMC_SPARSE_STATIC_SPARSE_MATRIX_H_ +#endif // MRMC_STORAGE_BITVECTOR_H_ diff --git a/src/utility/OsDetection.h b/src/utility/OsDetection.h index a88e8354c..6cda4c781 100644 --- a/src/utility/OsDetection.h +++ b/src/utility/OsDetection.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef MRMC_UTILITY_OSDETECTION_H_ +#define MRMC_UTILITY_OSDETECTION_H_ #if defined __linux__ || defined __linux # define LINUX @@ -13,3 +14,5 @@ #else # error Could not detect Operating System #endif + +#endif // MRMC_UTILITY_OSDETECTION_H_ \ No newline at end of file From 9e5b69b211603b962e2c91402052569f93a6d108 Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 03:20:01 +0100 Subject: [PATCH 4/7] Further naming scheme enforcement. --- src/formula/And.h | 24 ++++++++-------- src/formula/{AP.h => Ap.h} | 28 +++++++++---------- src/formula/BoundedUntil.h | 26 ++++++++--------- src/formula/Formulas.h | 8 +++--- src/formula/Next.h | 20 ++++++------- src/formula/Not.h | 18 ++++++------ src/formula/Or.h | 24 ++++++++-------- src/formula/{PCTLformula.h => PctlFormula.h} | 8 +++--- .../{PCTLPathFormula.h => PctlPathFormula.h} | 10 +++---- ...{PCTLStateFormula.h => PctlStateFormula.h} | 10 +++---- src/formula/ProbabilisticIntervalOperator.h | 22 +++++++-------- src/formula/ProbabilisticNoBoundsOperator.h | 22 +++++++-------- src/formula/ProbabilisticOperator.h | 24 ++++++++-------- src/formula/Until.h | 26 ++++++++--------- src/modelChecker/DtmcPrctlModelChecker.h | 18 ++++++------ src/parser/PrctlParser.cpp | 2 +- src/parser/PrctlParser.h | 6 ++-- 17 files changed, 148 insertions(+), 148 deletions(-) rename src/formula/{AP.h => Ap.h} (75%) rename src/formula/{PCTLformula.h => PctlFormula.h} (87%) rename src/formula/{PCTLPathFormula.h => PctlPathFormula.h} (90%) rename src/formula/{PCTLStateFormula.h => PctlStateFormula.h} (90%) diff --git a/src/formula/And.h b/src/formula/And.h index 910e23e8f..62cc46964 100644 --- a/src/formula/And.h +++ b/src/formula/And.h @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_AND_H_ #define MRMC_FORMULA_AND_H_ -#include "PCTLStateFormula.h" +#include "PctlStateFormula.h" #include namespace mrmc { @@ -27,11 +27,11 @@ namespace formula { * The subtrees are seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLStateFormula - * @see PCTLFormula + * @see PctlStateFormula + * @see PctlFormula */ template -class And : public PCTLStateFormula { +class And : public PctlStateFormula { public: /*! @@ -50,7 +50,7 @@ public: * @param left The left sub formula * @param right The right sub formula */ - And(PCTLStateFormula* left, PCTLStateFormula* right) { + And(PctlStateFormula* left, PctlStateFormula* right) { this->left = left; this->right = right; } @@ -75,7 +75,7 @@ public: * * @param newLeft the new left child. */ - void setLeft(PCTLStateFormula* newLeft) { + void setLeft(PctlStateFormula* newLeft) { left = newLeft; } @@ -84,21 +84,21 @@ public: * * @param newRight the new right child. */ - void setRight(PCTLStateFormula* newRight) { + void setRight(PctlStateFormula* newRight) { right = newRight; } /*! * @returns a pointer to the left child node */ - const PCTLStateFormula& getLeft() const { + const PctlStateFormula& getLeft() const { return *left; } /*! * @returns a pointer to the right child node */ - const PCTLStateFormula& getRight() const { + const PctlStateFormula& getRight() const { return *right; } @@ -121,7 +121,7 @@ public: * * @returns a new AND-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const { + virtual PctlStateFormula* clone() const { And* result = new And(); if (this->left != NULL) { result->setLeft(left->clone()); @@ -146,8 +146,8 @@ public: } private: - PCTLStateFormula* left; - PCTLStateFormula* right; + PctlStateFormula* left; + PctlStateFormula* right; }; } //namespace formula diff --git a/src/formula/AP.h b/src/formula/Ap.h similarity index 75% rename from src/formula/AP.h rename to src/formula/Ap.h index 05f200c2c..1f636d7df 100644 --- a/src/formula/AP.h +++ b/src/formula/Ap.h @@ -1,5 +1,5 @@ /* - * AP.h + * Ap.h * * Created on: 19.10.2012 * Author: Thomas Heinemann @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_AP_H_ #define MRMC_FORMULA_AP_H_ -#include "PCTLStateFormula.h" +#include "PctlStateFormula.h" namespace mrmc { @@ -20,21 +20,21 @@ namespace formula { * * This class represents the leaves in the formula tree. * - * @see PCTLStateFormula - * @see PCTLFormula + * @see PctlStateFormula + * @see PctlFormula */ template -class AP : public PCTLStateFormula { +class Ap : public PctlStateFormula { public: /*! * Constructor * - * Creates a new atomic proposition leaf, with the label AP + * Creates a new atomic proposition leaf, with the label Ap * * @param ap The string representing the atomic proposition */ - AP(std::string ap) { + Ap(std::string ap) { this->ap = ap; } @@ -42,12 +42,12 @@ public: * Destructor. * At this time, empty... */ - virtual ~AP() { } + virtual ~Ap() { } /*! * @returns the name of the atomic proposition */ - const std::string& getAP() const { + const std::string& getAp() const { return ap; } @@ -56,16 +56,16 @@ public: * */ virtual std::string toString() const { - return getAP(); + return getAp(); } /*! * Clones the called object. * - * @returns a new AP-object that is identical the called object. + * @returns a new Ap-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const { - return new AP(ap); + virtual PctlStateFormula* clone() const { + return new Ap(ap); } /*! @@ -78,7 +78,7 @@ public: * @returns A bit vector indicating all states that satisfy the formula represented by the called object. */ virtual mrmc::storage::BitVector *check(const mrmc::modelChecker::DtmcPrctlModelChecker& modelChecker) const { - return modelChecker.checkAP(*this); + return modelChecker.checkAp(*this); } private: diff --git a/src/formula/BoundedUntil.h b/src/formula/BoundedUntil.h index edc447375..281c112bc 100644 --- a/src/formula/BoundedUntil.h +++ b/src/formula/BoundedUntil.h @@ -8,8 +8,8 @@ #ifndef MRMC_FORMULA_BOUNDEDUNTIL_H_ #define MRMC_FORMULA_BOUNDEDUNTIL_H_ -#include "PCTLPathFormula.h" -#include "PCTLStateFormula.h" +#include "PctlPathFormula.h" +#include "PctlStateFormula.h" #include "boost/integer/integer_mask.hpp" #include @@ -30,11 +30,11 @@ namespace formula { * The subtrees are seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLPathFormula - * @see PCTLFormula + * @see PctlPathFormula + * @see PctlFormula */ template -class BoundedUntil : public PCTLPathFormula { +class BoundedUntil : public PctlPathFormula { public: /*! @@ -53,7 +53,7 @@ public: * @param right The left formula subtree * @param bound The maximal number of steps */ - BoundedUntil(PCTLStateFormula* left, PCTLStateFormula* right, + BoundedUntil(PctlStateFormula* left, PctlStateFormula* right, uint_fast64_t bound) { this->left = left; this->right = right;; @@ -80,7 +80,7 @@ public: * * @param newLeft the new left child. */ - void setLeft(PCTLStateFormula* newLeft) { + void setLeft(PctlStateFormula* newLeft) { left = newLeft; } @@ -89,21 +89,21 @@ public: * * @param newRight the new right child. */ - void setRight(PCTLStateFormula* newRight) { + void setRight(PctlStateFormula* newRight) { right = newRight; } /*! * @returns a pointer to the left child node */ - const PCTLStateFormula& getLeft() const { + const PctlStateFormula& getLeft() const { return *left; } /*! * @returns a pointer to the right child node */ - const PCTLStateFormula& getRight() const { + const PctlStateFormula& getRight() const { return *right; } @@ -144,7 +144,7 @@ public: * * @returns a new BoundedUntil-object that is identical the called object. */ - virtual PCTLPathFormula* clone() const { + virtual PctlPathFormula* clone() const { BoundedUntil* result = new BoundedUntil(); result->setBound(bound); if (left != NULL) { @@ -171,8 +171,8 @@ public: } private: - PCTLStateFormula* left; - PCTLStateFormula* right; + PctlStateFormula* left; + PctlStateFormula* right; uint_fast64_t bound; }; diff --git a/src/formula/Formulas.h b/src/formula/Formulas.h index cd2370a24..8db8c1f0d 100644 --- a/src/formula/Formulas.h +++ b/src/formula/Formulas.h @@ -9,14 +9,14 @@ #define MRMC_FORMULA_FORMULAS_H_ #include "And.h" -#include "AP.h" +#include "Ap.h" #include "BoundedUntil.h" #include "Next.h" #include "Not.h" #include "Or.h" -#include "PCTLformula.h" -#include "PCTLPathFormula.h" -#include "PCTLStateFormula.h" +#include "PctlFormula.h" +#include "PctlPathFormula.h" +#include "PctlStateFormula.h" #include "ProbabilisticOperator.h" #include "ProbabilisticNoBoundsOperator.h" #include "ProbabilisticIntervalOperator.h" diff --git a/src/formula/Next.h b/src/formula/Next.h index 3ffa8451d..07924846e 100644 --- a/src/formula/Next.h +++ b/src/formula/Next.h @@ -8,8 +8,8 @@ #ifndef MRMC_FORMULA_NEXT_H_ #define MRMC_FORMULA_NEXT_H_ -#include "PCTLPathFormula.h" -#include "PCTLStateFormula.h" +#include "PctlPathFormula.h" +#include "PctlStateFormula.h" namespace mrmc { @@ -27,11 +27,11 @@ namespace formula { * The subtree is seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLPathFormula - * @see PCTLFormula + * @see PctlPathFormula + * @see PctlFormula */ template -class Next : public PCTLPathFormula { +class Next : public PctlPathFormula { public: /*! @@ -46,7 +46,7 @@ public: * * @param child The child node */ - Next(PCTLStateFormula* child) { + Next(PctlStateFormula* child) { this->child = child; } @@ -65,7 +65,7 @@ public: /*! * @returns the child node */ - const PCTLStateFormula& getChild() const { + const PctlStateFormula& getChild() const { return *child; } @@ -73,7 +73,7 @@ public: * Sets the subtree * @param child the new child node */ - void setChild(PCTLStateFormula* child) { + void setChild(PctlStateFormula* child) { this->child = child; } @@ -95,7 +95,7 @@ public: * * @returns a new BoundedUntil-object that is identical the called object. */ - virtual PCTLPathFormula* clone() const { + virtual PctlPathFormula* clone() const { Next* result = new Next(); if (child != NULL) { result->setChild(child); @@ -117,7 +117,7 @@ public: } private: - PCTLStateFormula* child; + PctlStateFormula* child; }; } //namespace formula diff --git a/src/formula/Not.h b/src/formula/Not.h index b4afb7d72..26ae6320c 100644 --- a/src/formula/Not.h +++ b/src/formula/Not.h @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_NOT_H_ #define MRMC_FORMULA_NOT_H_ -#include "PCTLStateFormula.h" +#include "PctlStateFormula.h" namespace mrmc { @@ -23,11 +23,11 @@ namespace formula { * The subtree is seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLStateFormula - * @see PCTLFormula + * @see PctlStateFormula + * @see PctlFormula */ template -class Not : public PCTLStateFormula { +class Not : public PctlStateFormula { public: /*! @@ -41,7 +41,7 @@ public: * Constructor * @param child The child node */ - Not(PCTLStateFormula* child) { + Not(PctlStateFormula* child) { this->child = child; } @@ -60,7 +60,7 @@ public: /*! * @returns The child node */ - const PCTLStateFormula& getChild() const { + const PctlStateFormula& getChild() const { return *child; } @@ -68,7 +68,7 @@ public: * Sets the subtree * @param child the new child node */ - void setChild(PCTLStateFormula* child) { + void setChild(PctlStateFormula* child) { this->child = child; } @@ -88,7 +88,7 @@ public: * * @returns a new AND-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const { + virtual PctlStateFormula* clone() const { Not* result = new Not(); if (child != NULL) { result->setChild(child); @@ -110,7 +110,7 @@ public: } private: - PCTLStateFormula* child; + PctlStateFormula* child; }; } //namespace formula diff --git a/src/formula/Or.h b/src/formula/Or.h index 110ee5228..bc1302185 100644 --- a/src/formula/Or.h +++ b/src/formula/Or.h @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_OR_H_ #define MRMC_FORMULA_OR_H_ -#include "PCTLStateFormula.h" +#include "PctlStateFormula.h" namespace mrmc { @@ -26,11 +26,11 @@ namespace formula { * The subtrees are seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLStateFormula - * @see PCTLFormula + * @see PctlStateFormula + * @see PctlFormula */ template -class Or : public PCTLStateFormula { +class Or : public PctlStateFormula { public: /*! @@ -49,7 +49,7 @@ public: * @param left The left sub formula * @param right The right sub formula */ - Or(PCTLStateFormula* left, PCTLStateFormula* right) { + Or(PctlStateFormula* left, PctlStateFormula* right) { this->left = left; this->right = right; } @@ -74,7 +74,7 @@ public: * * @param newLeft the new left child. */ - void setLeft(PCTLStateFormula* newLeft) { + void setLeft(PctlStateFormula* newLeft) { left = newLeft; } @@ -83,21 +83,21 @@ public: * * @param newRight the new right child. */ - void setRight(PCTLStateFormula* newRight) { + void setRight(PctlStateFormula* newRight) { right = newRight; } /*! * @returns a pointer to the left child node */ - const PCTLStateFormula& getLeft() const { + const PctlStateFormula& getLeft() const { return *left; } /*! * @returns a pointer to the right child node */ - const PCTLStateFormula& getRight() const { + const PctlStateFormula& getRight() const { return *right; } @@ -120,7 +120,7 @@ public: * * @returns a new AND-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const { + virtual PctlStateFormula* clone() const { Or* result = new Or(); if (this->left != NULL) { result->setLeft(left->clone()); @@ -145,8 +145,8 @@ public: } private: - PCTLStateFormula* left; - PCTLStateFormula* right; + PctlStateFormula* left; + PctlStateFormula* right; }; } //namespace formula diff --git a/src/formula/PCTLformula.h b/src/formula/PctlFormula.h similarity index 87% rename from src/formula/PCTLformula.h rename to src/formula/PctlFormula.h index 26c805b3e..a4d910483 100644 --- a/src/formula/PCTLformula.h +++ b/src/formula/PctlFormula.h @@ -1,5 +1,5 @@ /* - * PCTLformula.h + * Pctlformula.h * * Created on: 19.10.2012 * Author: Thomas Heinemann @@ -23,16 +23,16 @@ namespace formula { * @attention This class is abstract. * @note Formula classes do not have copy constructors. The parameters of the constructors are usually the subtrees, so * the syntax conflicts with copy constructors for unary operators. To produce an identical object, the classes - * PCTLPathFormula and PCTLStateFormula offer the method clone(). + * PctlPathFormula and PctlStateFormula offer the method clone(). */ template -class PCTLFormula { +class PctlFormula { public: /*! * virtual destructor */ - virtual ~PCTLFormula() { } + virtual ~PctlFormula() { } /*! * @note This function is not implemented in this class. diff --git a/src/formula/PCTLPathFormula.h b/src/formula/PctlPathFormula.h similarity index 90% rename from src/formula/PCTLPathFormula.h rename to src/formula/PctlPathFormula.h index c8230f621..9b6a38b94 100644 --- a/src/formula/PCTLPathFormula.h +++ b/src/formula/PctlPathFormula.h @@ -1,5 +1,5 @@ /* - * PCTLPathFormula.h + * PctlPathFormula.h * * Created on: 19.10.2012 * Author: Thomas Heinemann @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_PCTLPATHFORMULA_H_ #define MRMC_FORMULA_PCTLPATHFORMULA_H_ -#include "PCTLformula.h" +#include "PctlFormula.h" #include "modelChecker/DtmcPrctlModelChecker.h" #include @@ -26,13 +26,13 @@ namespace formula { * clone(). */ template -class PCTLPathFormula : public PCTLFormula { +class PctlPathFormula : public PctlFormula { public: /*! * empty destructor */ - virtual ~PCTLPathFormula() { } + virtual ~PctlPathFormula() { } /*! * Clones the called object. @@ -42,7 +42,7 @@ public: * @note This function is not implemented in this class. * @returns a new AND-object that is identical the called object. */ - virtual PCTLPathFormula* clone() const = 0; + virtual PctlPathFormula* clone() const = 0; /*! * Calls the model checker to check this formula. diff --git a/src/formula/PCTLStateFormula.h b/src/formula/PctlStateFormula.h similarity index 90% rename from src/formula/PCTLStateFormula.h rename to src/formula/PctlStateFormula.h index c9ed0b5fe..c4eee14f2 100644 --- a/src/formula/PCTLStateFormula.h +++ b/src/formula/PctlStateFormula.h @@ -1,5 +1,5 @@ /* - * PCTLStateFormula.h + * PctlStateFormula.h * * Created on: 19.10.2012 * Author: Thomas Heinemann @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_PCTLSTATEFORMULA_H_ #define MRMC_FORMULA_PCTLSTATEFORMULA_H_ -#include "PCTLformula.h" +#include "PctlFormula.h" #include "storage/BitVector.h" #include "modelChecker/DtmcPrctlModelChecker.h" @@ -26,13 +26,13 @@ namespace formula { * clone(). */ template -class PCTLStateFormula : public PCTLFormula { +class PctlStateFormula : public PctlFormula { public: /*! * empty destructor */ - virtual ~PCTLStateFormula() { } + virtual ~PctlStateFormula() { } /*! * Clones the called object. @@ -42,7 +42,7 @@ public: * @note This function is not implemented in this class. * @returns a new AND-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const = 0; + virtual PctlStateFormula* clone() const = 0; /*! * Calls the model checker to check this formula. diff --git a/src/formula/ProbabilisticIntervalOperator.h b/src/formula/ProbabilisticIntervalOperator.h index 6fe054366..5fd2943af 100644 --- a/src/formula/ProbabilisticIntervalOperator.h +++ b/src/formula/ProbabilisticIntervalOperator.h @@ -8,8 +8,8 @@ #ifndef MRMC_FORMULA_PROBABILISTICINTERVALOPERATOR_H_ #define MRMC_FORMULA_PROBABILISTICINTERVALOPERATOR_H_ -#include "PCTLStateFormula.h" -#include "PCTLPathFormula.h" +#include "PctlStateFormula.h" +#include "PctlPathFormula.h" #include "utility/ConstTemplates.h" namespace mrmc { @@ -35,14 +35,14 @@ namespace formula { * (this behavior can be prevented by setting them to NULL before deletion) * * - * @see PCTLStateFormula - * @see PCTLPathFormula + * @see PctlStateFormula + * @see PctlPathFormula * @see ProbabilisticOperator * @see ProbabilisticNoBoundsOperator - * @see PCTLFormula + * @see PctlFormula */ template -class ProbabilisticIntervalOperator : public PCTLStateFormula { +class ProbabilisticIntervalOperator : public PctlStateFormula { public: /*! @@ -61,7 +61,7 @@ public: * @param upperBound The upper bound for the probability * @param pathFormula The child node */ - ProbabilisticIntervalOperator(T lowerBound, T upperBound, PCTLPathFormula& pathFormula) { + ProbabilisticIntervalOperator(T lowerBound, T upperBound, PctlPathFormula& pathFormula) { this->lower = lowerBound; this->upper = upperBound; this->pathFormula = &pathFormula; @@ -82,7 +82,7 @@ public: /*! * @returns the child node (representation of a PCTL path formula) */ - const PCTLPathFormula& getPathFormula () const { + const PctlPathFormula& getPathFormula () const { return *pathFormula; } @@ -105,7 +105,7 @@ public: * * @param pathFormula the path formula that becomes the new child node */ - void setPathFormula(PCTLPathFormula* pathFormula) { + void setPathFormula(PctlPathFormula* pathFormula) { this->pathFormula = pathFormula; } @@ -141,7 +141,7 @@ public: * * @returns a new AND-object that is identical the called object. */ - virtual PCTLStateFormula* clone() const { + virtual PctlStateFormula* clone() const { ProbabilisticIntervalOperator* result = new ProbabilisticIntervalOperator(); result->setInterval(lower, upper); if (pathFormula != NULL) { @@ -166,7 +166,7 @@ public: private: T lower; T upper; - PCTLPathFormula* pathFormula; + PctlPathFormula* pathFormula; }; } //namespace formula diff --git a/src/formula/ProbabilisticNoBoundsOperator.h b/src/formula/ProbabilisticNoBoundsOperator.h index 0082fe33f..b89080ca7 100644 --- a/src/formula/ProbabilisticNoBoundsOperator.h +++ b/src/formula/ProbabilisticNoBoundsOperator.h @@ -8,8 +8,8 @@ #ifndef MRMC_FORMULA_PROBABILISTICNOBOUNDSOPERATOR_H_ #define MRMC_FORMULA_PROBABILISTICNOBOUNDSOPERATOR_H_ -#include "PCTLformula.h" -#include "PCTLPathFormula.h" +#include "PctlFormula.h" +#include "PctlPathFormula.h" namespace mrmc { namespace formula { @@ -26,20 +26,20 @@ namespace formula { * * @note * This class is a hybrid of a state and path formula, and may only appear as the outermost operator. - * Hence, it is seen as neither a state nor a path formula, but is directly derived from PCTLformula. + * Hence, it is seen as neither a state nor a path formula, but is directly derived from PctlFormula. * * The subtree is seen as part of the object and deleted with it * (this behavior can be prevented by setting them to NULL before deletion) * * - * @see PCTLStateFormula - * @see PCTLPathFormula + * @see PctlStateFormula + * @see PctlPathFormula * @see ProbabilisticOperator * @see ProbabilisticIntervalOperator - * @see PCTLFormula + * @see PctlFormula */ template -class ProbabilisticNoBoundsOperator: public mrmc::formula::PCTLFormula { +class ProbabilisticNoBoundsOperator: public mrmc::formula::PctlFormula { public: /*! * Empty constructor @@ -54,7 +54,7 @@ public: * * @param pathFormula The child node. */ - ProbabilisticNoBoundsOperator(PCTLPathFormula &pathFormula) { + ProbabilisticNoBoundsOperator(PctlPathFormula &pathFormula) { this->pathFormula = &pathFormula; } @@ -68,7 +68,7 @@ public: /*! * @returns the child node (representation of a PCTL path formula) */ - const PCTLPathFormula& getPathFormula () const { + const PctlPathFormula& getPathFormula () const { return *pathFormula; } @@ -77,7 +77,7 @@ public: * * @param pathFormula the path formula that becomes the new child node */ - void setPathFormula(PCTLPathFormula* pathFormula) { + void setPathFormula(PctlPathFormula* pathFormula) { this->pathFormula = pathFormula; } @@ -92,7 +92,7 @@ public: } private: - PCTLPathFormula* pathFormula; + PctlPathFormula* pathFormula; }; } /* namespace formula */ diff --git a/src/formula/ProbabilisticOperator.h b/src/formula/ProbabilisticOperator.h index 8905e030d..b1131ef4b 100644 --- a/src/formula/ProbabilisticOperator.h +++ b/src/formula/ProbabilisticOperator.h @@ -8,7 +8,7 @@ #ifndef MRMC_FORMULA_PROBABILISTICOPERATOR_H_ #define MRMC_FORMULA_PROBABILISTICOPERATOR_H_ -#include "PCTLStateFormula.h" +#include "PctlStateFormula.h" namespace mrmc { namespace formula { @@ -32,14 +32,14 @@ namespace formula { * (this behavior can be prevented by setting them to NULL before deletion) * * - * @see PCTLStateFormula - * @see PCTLPathFormula + * @see PctlStateFormula + * @see PctlPathFormula * @see ProbabilisticIntervalOperator * @see ProbabilisticNoBoundsOperator - * @see PCTLFormula + * @see PctlFormula */ template -class ProbabilisticOperator : public mrmc::formula::PCTLStateFormula { +class ProbabilisticOperator : public mrmc::formula::PctlStateFormula { public: /*! * Empty constructor @@ -55,7 +55,7 @@ public: * @param bound The expected value for path formulas * @param pathFormula The child node */ - ProbabilisticOperator(T bound, PCTLPathFormula& pathFormula) { + ProbabilisticOperator(T bound, PctlPathFormula& pathFormula) { this->bound = bound; this->pathFormula = &pathFormula; } @@ -73,7 +73,7 @@ public: /*! * @returns the child node (representation of a PCTL path formula) */ - const PCTLPathFormula& getPathFormula () const { + const PctlPathFormula& getPathFormula () const { return *pathFormula; } @@ -89,7 +89,7 @@ public: * * @param pathFormula the path formula that becomes the new child node */ - void setPathFormula(PCTLPathFormula* pathFormula) { + void setPathFormula(PctlPathFormula* pathFormula) { this->pathFormula = pathFormula; } @@ -109,7 +109,7 @@ public: * * @returns a new ProbabilisticOperator-object that is identical to the called object. */ - virtual PCTLStateFormula* clone() const { + virtual PctlStateFormula* clone() const { ProbabilisticOperator* result = new ProbabilisticOperator(); result->setBound(bound); if (pathFormula != NULL) { @@ -134,9 +134,9 @@ public: } /*! - * Returns a string representation of this PCTLStateFormula + * Returns a string representation of this PctlStateFormula * - * @returns a string representation of this PCTLStateFormula + * @returns a string representation of this PctlStateFormula */ virtual std::string toString() const { std::string result = " P="; @@ -148,7 +148,7 @@ public: } private: T bound; - PCTLPathFormula* pathFormula; + PctlPathFormula* pathFormula; }; } /* namespace formula */ diff --git a/src/formula/Until.h b/src/formula/Until.h index fb0b67f47..3f094e3a3 100644 --- a/src/formula/Until.h +++ b/src/formula/Until.h @@ -8,8 +8,8 @@ #ifndef MRMC_FORMULA_UNTIL_H_ #define MRMC_FORMULA_UNTIL_H_ -#include "PCTLPathFormula.h" -#include "PCTLStateFormula.h" +#include "PctlPathFormula.h" +#include "PctlStateFormula.h" namespace mrmc { @@ -28,11 +28,11 @@ namespace formula { * The subtrees are seen as part of the object and deleted with the object * (this behavior can be prevented by setting them to NULL before deletion) * - * @see PCTLPathFormula - * @see PCTLFormula + * @see PctlPathFormula + * @see PctlFormula */ template -class Until : public PCTLPathFormula { +class Until : public PctlPathFormula { public: /*! @@ -49,7 +49,7 @@ public: * @param left The left formula subtree * @param right The left formula subtree */ - Until(PCTLStateFormula* left, PCTLStateFormula* right) { + Until(PctlStateFormula* left, PctlStateFormula* right) { this->left = left; this->right = right; } @@ -74,7 +74,7 @@ public: * * @param newLeft the new left child. */ - void setLeft(PCTLStateFormula* newLeft) { + void setLeft(PctlStateFormula* newLeft) { left = newLeft; } @@ -83,21 +83,21 @@ public: * * @param newRight the new right child. */ - void setRight(PCTLStateFormula* newRight) { + void setRight(PctlStateFormula* newRight) { right = newRight; } /*! * @returns a pointer to the left child node */ - const PCTLStateFormula& getLeft() const { + const PctlStateFormula& getLeft() const { return *left; } /*! * @returns a pointer to the right child node */ - const PCTLStateFormula& getRight() const { + const PctlStateFormula& getRight() const { return *right; } @@ -120,7 +120,7 @@ public: * * @returns a new BoundedUntil-object that is identical the called object. */ - virtual PCTLPathFormula* clone() const { + virtual PctlPathFormula* clone() const { Until* result = new Until(); if (left != NULL) { result->setLeft(left->clone()); @@ -145,8 +145,8 @@ public: } private: - PCTLStateFormula* left; - PCTLStateFormula* right; + PctlStateFormula* left; + PctlStateFormula* right; }; } //namespace formula diff --git a/src/modelChecker/DtmcPrctlModelChecker.h b/src/modelChecker/DtmcPrctlModelChecker.h index 984655aa9..9556fd966 100644 --- a/src/modelChecker/DtmcPrctlModelChecker.h +++ b/src/modelChecker/DtmcPrctlModelChecker.h @@ -23,8 +23,8 @@ class DtmcPrctlModelChecker; } -#include "src/formula/PCTLPathFormula.h" -#include "src/formula/PCTLStateFormula.h" +#include "src/formula/PctlPathFormula.h" +#include "src/formula/PctlStateFormula.h" #include "src/formula/Formulas.h" @@ -96,7 +96,7 @@ public: * @param formula The state formula to check * @returns The set of states satisfying the formula, represented by a bit vector */ - mrmc::storage::BitVector* checkStateFormula(const mrmc::formula::PCTLStateFormula& formula) const { + mrmc::storage::BitVector* checkStateFormula(const mrmc::formula::PctlStateFormula& formula) const { return formula.check(*this); } @@ -117,16 +117,16 @@ public: /*! * The check method for a formula with an AP node as root in its formula tree * - * @param formula The AP state formula to check + * @param formula The Ap state formula to check * @returns The set of states satisfying the formula, represented by a bit vector */ - mrmc::storage::BitVector* checkAP(const mrmc::formula::AP& formula) const { - if (formula.getAP().compare("true") == 0) { + mrmc::storage::BitVector* checkAp(const mrmc::formula::Ap& formula) const { + if (formula.getAp().compare("true") == 0) { return new mrmc::storage::BitVector(model->getNumberOfStates(), 1); - } else if (formula.getAP().compare("false") == 0) { + } else if (formula.getAp().compare("false") == 0) { return new mrmc::storage::BitVector(model->getNumberOfStates()); } - return new mrmc::storage::BitVector(*model->getLabeledStates(formula.getAP())); + return new mrmc::storage::BitVector(*model->getLabeledStates(formula.getAp())); } /*! @@ -226,7 +226,7 @@ public: * @param formula The path formula to check * @returns for each state the probability that the path formula holds. */ - std::vector* checkPathFormula(const mrmc::formula::PCTLPathFormula& formula) const { + std::vector* checkPathFormula(const mrmc::formula::PctlPathFormula& formula) const { return formula.check(*this); } diff --git a/src/parser/PrctlParser.cpp b/src/parser/PrctlParser.cpp index 695d64a78..f1a23077a 100644 --- a/src/parser/PrctlParser.cpp +++ b/src/parser/PrctlParser.cpp @@ -58,7 +58,7 @@ namespace /*! * @brief Resulting formula. */ - mrmc::formula::PCTLFormula* result; + mrmc::formula::PctlFormula* result; struct dump { diff --git a/src/parser/PrctlParser.h b/src/parser/PrctlParser.h index 0cd5ee7cf..24dc746bb 100644 --- a/src/parser/PrctlParser.h +++ b/src/parser/PrctlParser.h @@ -1,7 +1,7 @@ #ifndef MRMC_PARSER_PRCTLPARSER_H_ #define MRMC_PARSER_PRCTLPARSER_H_ -#include "src/formula/PCTLformula.h" +#include "src/formula/PctlFormula.h" #include "src/parser/Parser.h" namespace mrmc { @@ -18,13 +18,13 @@ class PrctlParser : Parser /*! * @brief return formula object parsed from file. */ - mrmc::formula::PCTLFormula* getFormula() + mrmc::formula::PctlFormula* getFormula() { return this->formula; } private: - mrmc::formula::PCTLFormula* formula; + mrmc::formula::PctlFormula* formula; }; } // namespace parser From 01ea2c8427e9644c6c462c48505b7512c30c44db Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 03:25:59 +0100 Subject: [PATCH 5/7] Moved os specific includes into OsDetection.h --- src/parser/LabParser.cpp | 7 +------ src/parser/Parser.cpp | 9 --------- src/parser/Parser.h | 7 ------- src/parser/TraParser.cpp | 4 ---- src/parser/TraParser.h | 1 + src/utility/OsDetection.h | 3 +++ 6 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/parser/LabParser.cpp b/src/parser/LabParser.cpp index 8f0b18117..45274347d 100644 --- a/src/parser/LabParser.cpp +++ b/src/parser/LabParser.cpp @@ -10,6 +10,7 @@ #include "src/exceptions/WrongFileFormatException.h" #include "src/exceptions/FileIoException.h" +#include "src/utility/OsDetection.h" #include #include #include @@ -21,12 +22,6 @@ #include #include -#if defined LINUX || defined MACOSX - #include -#elif defined WINDOWS - #define strncpy strncpy_s -#endif - #include "log4cplus/logger.h" #include "log4cplus/loggingmacros.h" extern log4cplus::Logger logger; diff --git a/src/parser/Parser.cpp b/src/parser/Parser.cpp index aeb43f867..1e25ee404 100644 --- a/src/parser/Parser.cpp +++ b/src/parser/Parser.cpp @@ -1,14 +1,5 @@ #include "src/parser/Parser.h" -#if defined LINUX || defined MACOSX -# include -# include -#elif defined WINDOWS -#endif - -#include -#include -#include #include #include diff --git a/src/parser/Parser.h b/src/parser/Parser.h index 95b6db552..81938ecf7 100644 --- a/src/parser/Parser.h +++ b/src/parser/Parser.h @@ -10,13 +10,6 @@ #include "src/utility/OsDetection.h" -#if defined LINUX || defined MACOSX -# include -#elif defined WINDOWS -# include -# include -#endif - #include #include #include diff --git a/src/parser/TraParser.cpp b/src/parser/TraParser.cpp index 5b98a9dda..7f38187d7 100644 --- a/src/parser/TraParser.cpp +++ b/src/parser/TraParser.cpp @@ -17,10 +17,6 @@ #include #include #include -#if defined LINUX || defined MACOSX - #include -#elif defined WINDOWS -#endif #include #include diff --git a/src/parser/TraParser.h b/src/parser/TraParser.h index 4626fab72..a7079ea66 100644 --- a/src/parser/TraParser.h +++ b/src/parser/TraParser.h @@ -4,6 +4,7 @@ #include "src/storage/SquareSparseMatrix.h" #include "src/parser/Parser.h" +#include "src/utility/OsDetection.h" #include diff --git a/src/utility/OsDetection.h b/src/utility/OsDetection.h index 6cda4c781..af8896adf 100644 --- a/src/utility/OsDetection.h +++ b/src/utility/OsDetection.h @@ -6,11 +6,14 @@ #elif defined TARGET_OS_MAC || defined __apple__ || defined __APPLE__ # define MACOSX # define _DARWIN_USE_64_BIT_INODE +# include +# include #elif defined _WIN32 || defined _WIN64 # define WINDOWS # define NOMINMAX # include # include +# define strncpy strncpy_s #else # error Could not detect Operating System #endif From fe95c2225b801518317a2580c8bff2a0e256a931 Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 04:01:21 +0100 Subject: [PATCH 6/7] Added missing contructors to all exceptions. --- src/exceptions/BaseException.h | 18 ++++++++ src/exceptions/FileIoException.h | 22 +++++----- src/exceptions/InvalidArgumentException.h | 30 +++++-------- src/exceptions/InvalidSettingsException.h | 10 ++++- src/exceptions/InvalidStateException.h | 33 +++++--------- src/exceptions/NoConvergenceException.h | 53 +++++------------------ src/exceptions/OutOfRangeException.h | 30 +++++-------- src/exceptions/WrongFileFormatException.h | 26 +++++------ src/models/AtomicPropositionsLabeling.h | 4 +- 9 files changed, 95 insertions(+), 131 deletions(-) diff --git a/src/exceptions/BaseException.h b/src/exceptions/BaseException.h index fcf92ee2c..d8767e8d9 100644 --- a/src/exceptions/BaseException.h +++ b/src/exceptions/BaseException.h @@ -16,6 +16,10 @@ class BaseException : public std::exception : exception(cp), stream(cp.stream.str()) { } + + BaseException(const char* cstr) { + stream << cstr; + } ~BaseException() throw() { } @@ -38,4 +42,18 @@ class BaseException : public std::exception } // namespace exceptions } // namespace mrmc +/* Macro to generate descendant exception classes. + * As all classes are nearly the same, this makes changing common features much easier. + */ +#define MRMC_EXCEPTION_DEFINE_NEW(exception_name) class exception_name : public BaseException { \ +public: \ + exception_name() : BaseException() { \ + } \ + exception_name(const char* cstr) : BaseException(cstr) { \ + } \ + exception_name(const exception_name& cp) : BaseException(cp) { \ + } \ +}; + + #endif // MRMC_EXCEPTIONS_BASEEXCEPTION_H_ diff --git a/src/exceptions/FileIoException.h b/src/exceptions/FileIoException.h index 5fd72dad9..6ae8a9fb8 100644 --- a/src/exceptions/FileIoException.h +++ b/src/exceptions/FileIoException.h @@ -8,22 +8,20 @@ #ifndef MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ #define MRMC_EXCEPTIONS_FILEIOEXCEPTION_H_ +#include "src/exceptions/BaseException.h" + namespace mrmc { namespace exceptions { -class FileIoException : public std::exception { - public: -#ifdef _WIN32 - FileIoException() : exception("::mrmc::FileIoException"){}; - FileIoException(const char * const s): exception(s) {}; -#else - FileIoException() {}; - FileIoException(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::FileIoException"; } - } +class FileIoException : public BaseException { +public: + FileIoException() : BaseException() { + } + FileIoException(const char* cstr) : BaseException(cstr) { + } + FileIoException(const FileIoException& cp) : BaseException(cp) { + } }; } diff --git a/src/exceptions/InvalidArgumentException.h b/src/exceptions/InvalidArgumentException.h index 051e4c000..c25c31fd9 100644 --- a/src/exceptions/InvalidArgumentException.h +++ b/src/exceptions/InvalidArgumentException.h @@ -1,31 +1,23 @@ #ifndef MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ #define MRMC_EXCEPTIONS_INVALIDARGUMENTEXCEPTION_H_ -#include +#include "src/exceptions/BaseException.h" namespace mrmc { namespace exceptions { -//!This exception is thrown when a parameter is invalid in this context -class InvalidArgumentException : public std::exception -{ - public: -/* The Visual C++-Version of the exception class has constructors accepting - * a char*-constant; The GCC version does not have these - * - * As the "extended" constructor is used in the sparse matrix code, a dummy - * constructor is used under linux (which will ignore the parameter) +/*! + * @brief This exception is thrown when a parameter is invalid in this context */ -#ifdef _WIN32 - InvalidArgumentException() : exception("::mrmc::InvalidArgumentException"){} - InvalidArgumentException(const char * const s): exception(s) {} -#else - InvalidArgumentException() : exception() {} - InvalidArgumentException(const char * const s): exception() {} -#endif - virtual const char* what() const throw() - { return "mrmc::InvalidArgumentException"; } +class InvalidArgumentException : public BaseException { +public: + InvalidArgumentException() { + } + InvalidArgumentException(const char* cstr) : BaseException(cstr) { + } + InvalidArgumentException(const InvalidArgumentException& cp) : BaseException(cp) { + } }; } // namespace exceptions diff --git a/src/exceptions/InvalidSettingsException.h b/src/exceptions/InvalidSettingsException.h index 315ec64e7..cd51fa549 100644 --- a/src/exceptions/InvalidSettingsException.h +++ b/src/exceptions/InvalidSettingsException.h @@ -6,8 +6,14 @@ namespace mrmc { namespace exceptions { -class InvalidSettingsException : public BaseException -{ +class InvalidSettingsException : public BaseException { +public: + InvalidSettingsException() { + } + InvalidSettingsException(const char* cstr) : BaseException(cstr) { + } + InvalidSettingsException(const InvalidSettingsException& cp) : BaseException(cp) { + } }; } // namespace exceptions diff --git a/src/exceptions/InvalidStateException.h b/src/exceptions/InvalidStateException.h index 32b07a659..7959e71dc 100644 --- a/src/exceptions/InvalidStateException.h +++ b/src/exceptions/InvalidStateException.h @@ -1,33 +1,24 @@ #ifndef MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ #define MRMC_EXCEPTIONS_INVALIDSTATEEXCEPTION_H_ -#include +#include "src/exceptions/BaseException.h" namespace mrmc { namespace exceptions { -//!This exception is thrown when a memory request can't be -//!fulfilled. -class InvalidStateException : public std::exception -{ - public: -/* The Visual C++-Version of the exception class has constructors accepting - * a char*-constant; The GCC version does not have these - * - * As the "extended" constructor is used in the sparse matrix code, a dummy - * constructor is used under linux (which will ignore the parameter) +/*! + * @brief This exception is thrown when a memory request can't be + * fulfilled. */ -#ifdef _WIN32 - InvalidStateException() : exception("::mrmc::InvalidStateException"){} - InvalidStateException(const char * const s): exception(s) {} -#else - InvalidStateException() : exception() {} - InvalidStateException(const char * const s): exception() {} - -#endif - virtual const char* what() const throw() - { return "mrmc::InvalidStateException"; } +class InvalidStateException : public BaseException { +public: + InvalidStateException() { + } + InvalidStateException(const char* cstr) : BaseException(cstr) { + } + InvalidStateException(const InvalidStateException& cp) : BaseException(cp) { + } }; } // namespace exceptions diff --git a/src/exceptions/NoConvergenceException.h b/src/exceptions/NoConvergenceException.h index 1ea6bd655..c67fa54fa 100644 --- a/src/exceptions/NoConvergenceException.h +++ b/src/exceptions/NoConvergenceException.h @@ -1,53 +1,22 @@ #ifndef MRMC_EXCEPTIONS_NOCONVERGENCEEXCEPTION_H_ #define MRMC_EXCEPTIONS_NOCONVERGENCEEXCEPTION_H_ -#include +#include "src/exceptions/BaseException.h" namespace mrmc { namespace exceptions { -//!This exception is thrown when an iterative solver failed to converge with the given maxIterations -class NoConvergenceException : public std::exception -{ - public: -/* The Visual C++-Version of the exception class has constructors accepting - * a char*-constant; The GCC version does not have these - * - * As the "extended" constructor is used in the sparse matrix code, a dummy - * constructor is used under linux (which will ignore the parameter) +/*! + * @brief This exception is thrown when an iterative solver failed to converge with the given maxIterations */ -#ifdef _WIN32 - NoConvergenceException() : exception("::mrmc::exceptions::NoConvergenceException"){ - iterations = -1; - maxIterations = -1; - } - NoConvergenceException(const char * const s, int iterations, int maxIterations): exception(s) { - this->iterations = iterations; - this->maxIterations = maxIterations; - } -#else - NoConvergenceException() : exception() { - iterations = -1; - maxIterations = -1; - } - NoConvergenceException(const char * const s, int iterations, int maxIterations): exception() { - this->iterations = iterations; - this->maxIterations = maxIterations; - } - -#endif - virtual const char* what() const throw() - { return "mrmc::exceptions::NoConvergenceException"; } - - int getIterationCount() const { - return iterations; - } - int getMaxIterationCount() const { - return maxIterations; - } - private: - int iterations; - int maxIterations; +class NoConvergenceException : public BaseException { +public: + NoConvergenceException() { + } + NoConvergenceException(const char* cstr) : BaseException(cstr) { + } + NoConvergenceException(const NoConvergenceException& cp) : BaseException(cp) { + } }; } // namespace exceptions diff --git a/src/exceptions/OutOfRangeException.h b/src/exceptions/OutOfRangeException.h index dffcd4e78..f5b2660b9 100644 --- a/src/exceptions/OutOfRangeException.h +++ b/src/exceptions/OutOfRangeException.h @@ -1,31 +1,23 @@ #ifndef MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ #define MRMC_EXCEPTIONS_OUTOFRANGEEXCEPTION_H_ -#include +#include "src/exceptions/BaseException.h" namespace mrmc { namespace exceptions { -//!This exception is thrown when a parameter is not in the range of valid values -class OutOfRangeException : public std::exception -{ - public: -/* The Visual C++-Version of the exception class has constructors accepting - * a char*-constant; The GCC version does not have these - * - * As the "extended" constructor is used in the sparse matrix code, a dummy - * constructor is used under linux (which will ignore the parameter) +/* + * @briefThis exception is thrown when a parameter is not in the range of valid values */ -#ifdef _WIN32 - OutOfRangeException() : exception("::mrmc::OutOfRangeException"){} - OutOfRangeException(const char * const s): exception(s) {} -#else - OutOfRangeException() : exception() {} - OutOfRangeException(const char * const s): exception() {} -#endif - virtual const char* what() const throw() - { return "mrmc::OutOfRangeException"; } +class OutOfRangeException : public BaseException { +public: + OutOfRangeException() { + } + OutOfRangeException(const char* cstr) : BaseException(cstr) { + } + OutOfRangeException(const OutOfRangeException& cp) : BaseException(cp) { + } }; } // namespace exceptions diff --git a/src/exceptions/WrongFileFormatException.h b/src/exceptions/WrongFileFormatException.h index 13cb53b2d..490623440 100644 --- a/src/exceptions/WrongFileFormatException.h +++ b/src/exceptions/WrongFileFormatException.h @@ -8,24 +8,24 @@ #ifndef MRMC_EXCEPTIONS_WRONGFILEFORMATEXCEPTION_H_ #define MRMC_EXCEPTIONS_WRONGFILEFORMATEXCEPTION_H_ -#include +#include "src/exceptions/BaseException.h" namespace mrmc { namespace exceptions { -class WrongFileFormatException : public std::exception { - public: -#ifdef _WIN32 - WrongFileFormatException() : exception("::mrmc::WrongFileFormatException"){}; - WrongFileFormatException(const char * const s): exception(s) {}; -#else - WrongFileFormatException() {}; - WrongFileFormatException(const char * const s): exception() {}; -#endif - virtual const char* what() const throw(){ - { return "mrmc::WrongFileFormatException"; } - } +/*! + * @brief This exception is thrown when an input file + * contains invalid or missing keys. + */ +class WrongFileFormatException : public BaseException { +public: + WrongFileFormatException() { + } + WrongFileFormatException(const char* cstr) : BaseException(cstr) { + } + WrongFileFormatException(const WrongFileFormatException& cp) : BaseException(cp) { + } }; } //namespace exceptions diff --git a/src/models/AtomicPropositionsLabeling.h b/src/models/AtomicPropositionsLabeling.h index d7632445f..f4d52b783 100644 --- a/src/models/AtomicPropositionsLabeling.h +++ b/src/models/AtomicPropositionsLabeling.h @@ -110,9 +110,7 @@ public: */ void addAtomicPropositionToState(std::string ap, const uint_fast64_t state) { if (nameToLabelingMap.count(ap) == 0) { - /*throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '" << ap << "' unknown.");*/ - // TODO !!! - throw mrmc::exceptions::OutOfRangeException("Atomic Proposition '' unknown."); + throw mrmc::exceptions::OutOfRangeException() << "Atomic Proposition '" << ap << "' unknown."; } if (state >= stateCount) { throw mrmc::exceptions::OutOfRangeException("State index out of range."); From 2f05d035fe53a7730335fc899b9c714e724c17e4 Mon Sep 17 00:00:00 2001 From: PBerger Date: Mon, 17 Dec 2012 04:05:15 +0100 Subject: [PATCH 7/7] Refactored all exceptions to use the macro generator to remove all redundant base code. --- src/exceptions/FileIoException.h | 10 +--------- src/exceptions/InvalidArgumentException.h | 10 +--------- src/exceptions/InvalidSettingsException.h | 10 +--------- src/exceptions/InvalidStateException.h | 10 +--------- src/exceptions/NoConvergenceException.h | 10 +--------- src/exceptions/OutOfRangeException.h | 10 +--------- src/exceptions/WrongFileFormatException.h | 10 +--------- 7 files changed, 7 insertions(+), 63 deletions(-) diff --git a/src/exceptions/FileIoException.h b/src/exceptions/FileIoException.h index 6ae8a9fb8..0d31af7fd 100644 --- a/src/exceptions/FileIoException.h +++ b/src/exceptions/FileIoException.h @@ -14,15 +14,7 @@ namespace mrmc { namespace exceptions { -class FileIoException : public BaseException { -public: - FileIoException() : BaseException() { - } - FileIoException(const char* cstr) : BaseException(cstr) { - } - FileIoException(const FileIoException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(FileIoException) } diff --git a/src/exceptions/InvalidArgumentException.h b/src/exceptions/InvalidArgumentException.h index c25c31fd9..c6c07e68a 100644 --- a/src/exceptions/InvalidArgumentException.h +++ b/src/exceptions/InvalidArgumentException.h @@ -10,15 +10,7 @@ namespace exceptions { /*! * @brief This exception is thrown when a parameter is invalid in this context */ -class InvalidArgumentException : public BaseException { -public: - InvalidArgumentException() { - } - InvalidArgumentException(const char* cstr) : BaseException(cstr) { - } - InvalidArgumentException(const InvalidArgumentException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(InvalidArgumentException) } // namespace exceptions diff --git a/src/exceptions/InvalidSettingsException.h b/src/exceptions/InvalidSettingsException.h index cd51fa549..a399d82ae 100644 --- a/src/exceptions/InvalidSettingsException.h +++ b/src/exceptions/InvalidSettingsException.h @@ -6,15 +6,7 @@ namespace mrmc { namespace exceptions { -class InvalidSettingsException : public BaseException { -public: - InvalidSettingsException() { - } - InvalidSettingsException(const char* cstr) : BaseException(cstr) { - } - InvalidSettingsException(const InvalidSettingsException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(InvalidSettingsException) } // namespace exceptions } // namespace mrmc diff --git a/src/exceptions/InvalidStateException.h b/src/exceptions/InvalidStateException.h index 7959e71dc..c971321bf 100644 --- a/src/exceptions/InvalidStateException.h +++ b/src/exceptions/InvalidStateException.h @@ -11,15 +11,7 @@ namespace exceptions { * @brief This exception is thrown when a memory request can't be * fulfilled. */ -class InvalidStateException : public BaseException { -public: - InvalidStateException() { - } - InvalidStateException(const char* cstr) : BaseException(cstr) { - } - InvalidStateException(const InvalidStateException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(InvalidStateException) } // namespace exceptions diff --git a/src/exceptions/NoConvergenceException.h b/src/exceptions/NoConvergenceException.h index c67fa54fa..1e7753b1c 100644 --- a/src/exceptions/NoConvergenceException.h +++ b/src/exceptions/NoConvergenceException.h @@ -9,15 +9,7 @@ namespace exceptions { /*! * @brief This exception is thrown when an iterative solver failed to converge with the given maxIterations */ -class NoConvergenceException : public BaseException { -public: - NoConvergenceException() { - } - NoConvergenceException(const char* cstr) : BaseException(cstr) { - } - NoConvergenceException(const NoConvergenceException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(NoConvergenceException) } // namespace exceptions } // namespace mrmc diff --git a/src/exceptions/OutOfRangeException.h b/src/exceptions/OutOfRangeException.h index f5b2660b9..decd36fda 100644 --- a/src/exceptions/OutOfRangeException.h +++ b/src/exceptions/OutOfRangeException.h @@ -10,15 +10,7 @@ namespace exceptions { /* * @briefThis exception is thrown when a parameter is not in the range of valid values */ -class OutOfRangeException : public BaseException { -public: - OutOfRangeException() { - } - OutOfRangeException(const char* cstr) : BaseException(cstr) { - } - OutOfRangeException(const OutOfRangeException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(OutOfRangeException) } // namespace exceptions diff --git a/src/exceptions/WrongFileFormatException.h b/src/exceptions/WrongFileFormatException.h index 490623440..182660a30 100644 --- a/src/exceptions/WrongFileFormatException.h +++ b/src/exceptions/WrongFileFormatException.h @@ -18,15 +18,7 @@ namespace exceptions { * @brief This exception is thrown when an input file * contains invalid or missing keys. */ -class WrongFileFormatException : public BaseException { -public: - WrongFileFormatException() { - } - WrongFileFormatException(const char* cstr) : BaseException(cstr) { - } - WrongFileFormatException(const WrongFileFormatException& cp) : BaseException(cp) { - } -}; +MRMC_EXCEPTION_DEFINE_NEW(WrongFileFormatException) } //namespace exceptions