From daa5cf297a6b7595cf20e1f9feeb302d8d39ce04 Mon Sep 17 00:00:00 2001 From: Lanchid Date: Wed, 19 Dec 2012 18:46:25 +0100 Subject: [PATCH] Changed type of parameter filename to std::string const & (was const char*) --- src/mrmc.cpp | 2 +- src/parser/AtomicPropositionLabelingParser.cpp | 5 +++-- src/parser/AtomicPropositionLabelingParser.h | 2 +- src/utility/IoUtility.cpp | 2 +- src/utility/IoUtility.h | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mrmc.cpp b/src/mrmc.cpp index d9b938e2d..b107844ef 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -102,7 +102,7 @@ int main(const int argc, const char* argv[]) { } mrmc::parser::DeterministicSparseTransitionParser traparser(s->getString("trafile")); - mrmc::parser::AtomicPropositionLabelingParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile").c_str()); + mrmc::parser::AtomicPropositionLabelingParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile")); mrmc::models::Dtmc dtmc(traparser.getMatrix(), labparser.getLabeling()); dtmc.printModelInformationToStream(std::cout); diff --git a/src/parser/AtomicPropositionLabelingParser.cpp b/src/parser/AtomicPropositionLabelingParser.cpp index 8c4d7b5a5..1f307450a 100644 --- a/src/parser/AtomicPropositionLabelingParser.cpp +++ b/src/parser/AtomicPropositionLabelingParser.cpp @@ -38,13 +38,14 @@ namespace parser { * @param filename input .lab file's name. * @return The pointer to the created labeling object. */ -AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t node_count, const char * filename) +AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t node_count, + std::string const & filename) : labeling(nullptr) { /* * open file */ - MappedFile file(filename); + MappedFile file(filename.c_str()); char* buf = file.data; /* diff --git a/src/parser/AtomicPropositionLabelingParser.h b/src/parser/AtomicPropositionLabelingParser.h index e1b5c4211..d6d7fa84c 100644 --- a/src/parser/AtomicPropositionLabelingParser.h +++ b/src/parser/AtomicPropositionLabelingParser.h @@ -19,7 +19,7 @@ namespace parser { */ class AtomicPropositionLabelingParser : Parser { public: - AtomicPropositionLabelingParser(uint_fast64_t node_count, const char* filename); + AtomicPropositionLabelingParser(uint_fast64_t node_count, std::string const &filename); std::shared_ptr getLabeling() { return this->labeling; diff --git a/src/utility/IoUtility.cpp b/src/utility/IoUtility.cpp index a8d61d32c..5f7e4c691 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(std::string const &tra_file, const char* lab_file) { +mrmc::models::Dtmc* parseDTMC(std::string const &tra_file, std::string const &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 d05bf2afb..08f529380 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(std::string const &tra_file, const char* lab_file); +mrmc::models::Dtmc* parseDTMC(std::string const &tra_file, std::string const &lab_file); } //namespace utility