From 3c741fae4a74716bd10f16510536cb531d5d1cbd Mon Sep 17 00:00:00 2001 From: Lanchid Date: Wed, 19 Dec 2012 18:35:10 +0100 Subject: [PATCH] Changed filename parameter for DeterministicSparseTransitionParser to a const reference to an std::string, instead of char pointer --- src/mrmc.cpp | 2 +- src/parser/DeterministicSparseTransitionParser.cpp | 4 ++-- src/parser/DeterministicSparseTransitionParser.h | 2 +- src/utility/IoUtility.cpp | 2 +- src/utility/IoUtility.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mrmc.cpp b/src/mrmc.cpp index 6659b8e13..478b6425a 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -101,7 +101,7 @@ int main(const int argc, const char* argv[]) { LOG4CPLUS_INFO(logger, "Enable verbose mode, log output gets printed to console."); } - mrmc::parser::DeterministicSparseTransitionParser traparser(s->getString("trafile").c_str()); + mrmc::parser::DeterministicSparseTransitionParser traparser(s->getString("trafile")); mrmc::parser::LabParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile").c_str()); mrmc::models::Dtmc dtmc(traparser.getMatrix(), labparser.getLabeling()); diff --git a/src/parser/DeterministicSparseTransitionParser.cpp b/src/parser/DeterministicSparseTransitionParser.cpp index d62661521..2c4f86c04 100644 --- a/src/parser/DeterministicSparseTransitionParser.cpp +++ b/src/parser/DeterministicSparseTransitionParser.cpp @@ -106,7 +106,7 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fas * @return a pointer to the created sparse matrix. */ -DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(const char * filename) +DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::string const &filename) : matrix(nullptr) { /* @@ -117,7 +117,7 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(const c /* * open file */ - MappedFile file(filename); + MappedFile file(filename.c_str()); char* buf = file.data; /* diff --git a/src/parser/DeterministicSparseTransitionParser.h b/src/parser/DeterministicSparseTransitionParser.h index 561f9aa50..9dd3b18e7 100644 --- a/src/parser/DeterministicSparseTransitionParser.h +++ b/src/parser/DeterministicSparseTransitionParser.h @@ -20,7 +20,7 @@ namespace parser { */ class DeterministicSparseTransitionParser : Parser { public: - DeterministicSparseTransitionParser(const char* filename); + DeterministicSparseTransitionParser(std::string const &filename); std::shared_ptr> getMatrix() { return this->matrix; diff --git a/src/utility/IoUtility.cpp b/src/utility/IoUtility.cpp index 73f0f7d17..9667a3ff8 100644 --- a/src/utility/IoUtility.cpp +++ b/src/utility/IoUtility.cpp @@ -60,7 +60,7 @@ void dtmcToDot(mrmc::models::Dtmc* dtmc, std::string filename) { } //TODO: Should this stay here or be integrated in the new parser structure? -mrmc::models::Dtmc* parseDTMC(const char* tra_file, const char* lab_file) { +mrmc::models::Dtmc* parseDTMC(std::string const &tra_file, const char* lab_file) { mrmc::parser::DeterministicSparseTransitionParser tp(tra_file); uint_fast64_t node_count = tp.getMatrix()->getRowCount(); diff --git a/src/utility/IoUtility.h b/src/utility/IoUtility.h index 5b691d9b2..d05bf2afb 100644 --- a/src/utility/IoUtility.h +++ b/src/utility/IoUtility.h @@ -36,7 +36,7 @@ void dtmcToDot(mrmc::models::Dtmc* dtmc, std::string filename); @returns The DTMC described by the two files. */ -mrmc::models::Dtmc* parseDTMC(const char* tra_file, const char* lab_file); +mrmc::models::Dtmc* parseDTMC(std::string const &tra_file, const char* lab_file); } //namespace utility