Browse Source

made a run of cpplint and fixed some of the warnings...

main
gereon 13 years ago
parent
commit
ea84f91cf3
  1. 3
      src/models/AbstractModel.cpp
  2. 19
      src/parser/AutoParser.cpp
  3. 3
      src/parser/DeterministicSparseTransitionParser.cpp
  4. 12
      src/parser/DtmcParser.cpp
  5. 4
      src/parser/DtmcParser.h
  6. 5
      src/parser/Parser.cpp
  7. 5
      src/utility/IoUtility.cpp
  8. 8
      src/utility/Settings.cpp

3
src/models/AbstractModel.cpp

@ -12,8 +12,7 @@
* @param type Model type. * @param type Model type.
* @return Output stream os. * @return Output stream os.
*/ */
std::ostream& storm::models::operator<<(std::ostream& os, storm::models::ModelType const type) std::ostream& storm::models::operator<<(std::ostream& os, storm::models::ModelType const type) {
{
switch (type) { switch (type) {
case storm::models::Unknown: os << "Unknown"; break; case storm::models::Unknown: os << "Unknown"; break;
case storm::models::DTMC: os << "DTMC"; break; case storm::models::DTMC: os << "DTMC"; break;

19
src/parser/AutoParser.cpp

@ -1,13 +1,11 @@
#include "src/parser/AutoParser.h" #include "src/parser/AutoParser.h"
#include <string>
#include <cctype>
#include "src/exceptions/WrongFileFormatException.h" #include "src/exceptions/WrongFileFormatException.h"
#include "src/models/AbstractModel.h" #include "src/models/AbstractModel.h"
#include "src/parser/DtmcParser.h" #include "src/parser/DtmcParser.h"
//#include "NonDeterministicSparseTransitionParser.h"
#include <string>
#include <cctype>
namespace storm { namespace storm {
namespace parser { namespace parser {
@ -15,15 +13,13 @@ namespace parser {
AutoParser::AutoParser(std::string const & transitionSystemFile, std::string const & labelingFile, AutoParser::AutoParser(std::string const & transitionSystemFile, std::string const & labelingFile,
std::string const & stateRewardFile, std::string const & transitionRewardFile) std::string const & stateRewardFile, std::string const & transitionRewardFile)
: model(nullptr) { : model(nullptr) {
storm::models::ModelType type = this->analyzeHint(transitionSystemFile); storm::models::ModelType type = this->analyzeHint(transitionSystemFile);
if (type == storm::models::Unknown) { if (type == storm::models::Unknown) {
LOG4CPLUS_ERROR(logger, "Could not determine file type of " << transitionSystemFile << "."); LOG4CPLUS_ERROR(logger, "Could not determine file type of " << transitionSystemFile << ".");
LOG4CPLUS_ERROR(logger, "The first line of the file should contain a format hint. Please fix your file and try again."); LOG4CPLUS_ERROR(logger, "The first line of the file should contain a format hint. Please fix your file and try again.");
throw storm::exceptions::WrongFileFormatException() << "Could not determine type of file " << transitionSystemFile; throw storm::exceptions::WrongFileFormatException() << "Could not determine type of file " << transitionSystemFile;
} } else {
else {
LOG4CPLUS_INFO(logger, "Model type seems to be " << type); LOG4CPLUS_INFO(logger, "Model type seems to be " << type);
} }
@ -43,11 +39,10 @@ AutoParser::AutoParser(std::string const & transitionSystemFile, std::string con
default: ; // Unknown default: ; // Unknown
} }
if (! this->model) std::cout << "model is still null" << std::endl; if (!this->model) std::cout << "model is still null" << std::endl;
} }
storm::models::ModelType AutoParser::analyzeHint(const std::string& filename) { storm::models::ModelType AutoParser::analyzeHint(const std::string& filename) {
storm::models::ModelType hintType = storm::models::Unknown; storm::models::ModelType hintType = storm::models::Unknown;
// Open file // Open file
MappedFile file(filename.c_str()); MappedFile file(filename.c_str());
@ -67,5 +62,5 @@ storm::models::ModelType AutoParser::analyzeHint(const std::string& filename) {
return hintType; return hintType;
} }
} //namespace parser } // namespace parser
} //namespace storm } // namespace storm

3
src/parser/DeterministicSparseTransitionParser.cpp

@ -197,8 +197,9 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st
if (fixDeadlocks) { if (fixDeadlocks) {
this->matrix->addNextValue(node, node, 1); this->matrix->addNextValue(node, node, 1);
LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": node " << node << " has no outgoing transitions. A self-loop was inserted."); LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": node " << node << " has no outgoing transitions. A self-loop was inserted.");
} else {
LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": node " << node << " has no outgoing transitions.");
} }
else LOG4CPLUS_ERROR(logger, "Error while parsing " << filename << ": node " << node << " has no outgoing transitions.");
} }
lastrow = row; lastrow = row;

12
src/parser/DtmcParser.cpp

@ -5,10 +5,14 @@
* Author: thomas * Author: thomas
*/ */
#include "DtmcParser.h" #include "src/parser/DtmcParser.h"
#include "DeterministicSparseTransitionParser.h" #include <string>
#include "AtomicPropositionLabelingParser.h" #include <vector>
#include "SparseStateRewardParser.h" #include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include "src/parser/SparseStateRewardParser.h"
namespace storm { namespace storm {
namespace parser { namespace parser {

4
src/parser/DtmcParser.h

@ -8,8 +8,8 @@
#ifndef DTMCPARSER_H_ #ifndef DTMCPARSER_H_
#define DTMCPARSER_H_ #define DTMCPARSER_H_
#include "Parser.h" #include "src/parser/Parser.h"
#include "models/Dtmc.h" #include "src/models/Dtmc.h"
namespace storm { namespace storm {
namespace parser { namespace parser {

5
src/parser/Parser.cpp

@ -2,6 +2,7 @@
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
#include <string>
#include "src/exceptions/FileIoException.h" #include "src/exceptions/FileIoException.h"
#include "src/exceptions/WrongFileFormatException.h" #include "src/exceptions/WrongFileFormatException.h"
@ -87,8 +88,8 @@ storm::parser::MappedFile::MappedFile(const char* filename) {
throw exceptions::FileIoException("storm::parser::MappedFile Error in open()"); throw exceptions::FileIoException("storm::parser::MappedFile Error in open()");
} }
this->data = (char*) mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0); this->data = reinterpret_cast<char*>(mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0));
if (this->data == (char*)-1) { if (this->data == reinterpret_cast<char*>(-1)) {
close(this->file); close(this->file);
LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << ")."); LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << ").");
throw exceptions::FileIoException("storm::parser::MappedFile Error in mmap()"); throw exceptions::FileIoException("storm::parser::MappedFile Error in mmap()");

5
src/utility/IoUtility.cpp

@ -6,11 +6,12 @@
*/ */
#include "src/utility/IoUtility.h" #include "src/utility/IoUtility.h"
#include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include <fstream> #include <fstream>
#include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
namespace storm { namespace storm {
namespace utility { namespace utility {

8
src/utility/Settings.cpp

@ -7,13 +7,17 @@
#include "src/utility/Settings.h" #include "src/utility/Settings.h"
#include "src/exceptions/BaseException.h" #include <boost/algorithm/string/join.hpp>
#include <utility>
#include <map>
#include <string>
#include <list>
#include "src/exceptions/BaseException.h"
#include "log4cplus/logger.h" #include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h" #include "log4cplus/loggingmacros.h"
extern log4cplus::Logger logger; extern log4cplus::Logger logger;
#include <boost/algorithm/string/join.hpp>
namespace storm { namespace storm {
namespace settings { namespace settings {

|||||||
100:0
Loading…
Cancel
Save