diff --git a/src/formula/ProbabilisticOperator.h b/src/formula/ProbabilisticOperator.h index 622c2effc..4b87ce869 100644 --- a/src/formula/ProbabilisticOperator.h +++ b/src/formula/ProbabilisticOperator.h @@ -10,7 +10,7 @@ #include "PCTLStateFormula.h" #include "PCTLPathFormula.h" -#include "misc/const_templates.h" +#include "utility/const_templates.h" namespace mrmc { @@ -40,8 +40,8 @@ public: * Empty constructor */ ProbabilisticOperator() { - upper = mrmc::misc::constGetZero(&upper); - lower = mrmc::misc::constGetZero(&lower); + upper = mrmc::utility::constGetZero(upper); + lower = mrmc::utility::constGetZero(lower); pathFormula = NULL; } diff --git a/src/storage/SquareSparseMatrix.h b/src/storage/SquareSparseMatrix.h index fd9c0b904..02cdec904 100644 --- a/src/storage/SquareSparseMatrix.h +++ b/src/storage/SquareSparseMatrix.h @@ -12,7 +12,7 @@ #include "src/exceptions/file_IO_exception.h" #include "src/storage/BitVector.h" -#include "src/misc/const_templates.h" +#include "src/utility/const_templates.h" #include "Eigen/Sparse" #include "gmm/gmm_matrix.h" @@ -658,12 +658,12 @@ public: uint_fast64_t rowEnd = rowIndications[row + 1]; while (rowStart < rowEnd) { - valueStorage[rowStart] = mrmc::misc::constGetZero(valueStorage); + valueStorage[rowStart] = mrmc::utility::constGetZero(valueStorage[rowStart]); ++rowStart; } // Set the element on the diagonal to one. - diagonalStorage[row] = mrmc::misc::constGetOne(diagonalStorage); + diagonalStorage[row] = mrmc::utility::constGetOne(diagonalStorage[row]); return true; } diff --git a/src/misc/const_templates.h b/src/utility/const_templates.h similarity index 66% rename from src/misc/const_templates.h rename to src/utility/const_templates.h index aeedf7632..0261cdecc 100644 --- a/src/misc/const_templates.h +++ b/src/utility/const_templates.h @@ -10,7 +10,7 @@ namespace mrmc { -namespace misc { +namespace utility { /*! * Returns a constant value of 0 that is fit to the type it is being written to. @@ -19,20 +19,19 @@ namespace misc { * * Parameter * - * The parameter is a pointer which is used to infer the return type (So, if you want - * the return value to be of type double, the parameter has to be of type double*). - * In most cases, it is a good choice to use the address of the variable that is to be - * set. + * The parameter is a reference which is used to infer the return type (So, if you want + * the return value to be of type double, the parameter has to be a double variable). + * In most cases, it is a good choice to use the the variable that is to be set. */ template -static inline _Scalar constGetZero(_Scalar*) { +static inline _Scalar constGetZero(_Scalar&) { return _Scalar(0); } /*! @cond TEMPLATE_SPECIALIZATION * (exclude the specializations from the documentation) */ template <> -inline int_fast32_t constGetZero(int_fast32_t*) { +inline int_fast32_t constGetZero(int_fast32_t&) { return 0; } @@ -40,7 +39,7 @@ inline int_fast32_t constGetZero(int_fast32_t*) { * Specialization of constGetZero for int_fast32_t */ template <> -inline double constGetZero(double*) { +inline double constGetZero(double&) { return 0.0; } /*! @endcond */ @@ -52,30 +51,28 @@ inline double constGetZero(double*) { * * Parameter * - * The parameter is a pointer which is used to infer the return type (So, if you want - * the return value to be of type double, the parameter has to be of type double*). - * In most cases, it is a good choice to use the address of the variable that is to be - * set. - */ + * The parameter is a reference which is used to infer the return type (So, if you want + * the return value to be of type double, the parameter has to be a double variable). + * In most cases, it is a good choice to use the the variable that is to be set. */ template -static inline _Scalar constGetOne(_Scalar*) { +static inline _Scalar constGetOne(_Scalar&) { return _Scalar(1); } /*! @cond TEMPLATE_SPECIALIZATION * (exclude the specializations from the documentation) */ template<> -inline int_fast32_t constGetOne(int_fast32_t*) { +inline int_fast32_t constGetOne(int_fast32_t&) { return 1; } template<> -inline double constGetOne(double*) { +inline double constGetOne(double&) { return 1.0; } /*! @endcond */ -} //namespace misc +} //namespace utility } //namespace mrmc diff --git a/src/utility/utility.cpp b/src/utility/ioUtility.cpp similarity index 97% rename from src/utility/utility.cpp rename to src/utility/ioUtility.cpp index e2ef43833..6a9a0808f 100644 --- a/src/utility/utility.cpp +++ b/src/utility/ioUtility.cpp @@ -1,11 +1,11 @@ /* - * utility.cpp + * ioUtility.cpp * * Created on: 17.10.2012 * Author: Thomas Heinemann */ -#include "src/utility/utility.h" +#include "src/utility/ioUtility.h" #include "src/parser/readTraFile.h" #include "src/parser/readLabFile.h" diff --git a/src/utility/utility.h b/src/utility/ioUtility.h similarity index 98% rename from src/utility/utility.h rename to src/utility/ioUtility.h index ebfa964b7..04a389a1d 100644 --- a/src/utility/utility.h +++ b/src/utility/ioUtility.h @@ -1,5 +1,5 @@ /* - * utility.h + * ioUtility.h * * Created on: 17.10.2012 * Author: Thomas Heinemann diff --git a/test/parser/parse_dtmc_test.cpp b/test/parser/parse_dtmc_test.cpp index e89ec331e..239ba735f 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/utility.h" +#include "src/utility/ioUtility.h" TEST(ParseDtmcTest, parseAndOutput) { mrmc::models::Dtmc* myDtmc; diff --git a/test/parser/read_tra_file_test.cpp b/test/parser/read_tra_file_test.cpp index d8cf64c8e..5e8e230f8 100644 --- a/test/parser/read_tra_file_test.cpp +++ b/test/parser/read_tra_file_test.cpp @@ -12,7 +12,7 @@ #include "src/exceptions/file_IO_exception.h" #include "src/exceptions/wrong_file_format.h" -#include "src/utility/utility.h" +#include "src/utility/ioUtility.h" TEST(ReadTraFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-)