Browse Source

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

tempestpy_adaptions
gereon 12 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.
* @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) {
case storm::models::Unknown: os << "Unknown"; break;
case storm::models::DTMC: os << "DTMC"; break;

19
src/parser/AutoParser.cpp

@ -1,13 +1,11 @@
#include "src/parser/AutoParser.h"
#include <string>
#include <cctype>
#include "src/exceptions/WrongFileFormatException.h"
#include "src/models/AbstractModel.h"
#include "src/parser/DtmcParser.h"
//#include "NonDeterministicSparseTransitionParser.h"
#include <string>
#include <cctype>
namespace storm {
namespace parser {
@ -15,15 +13,13 @@ namespace parser {
AutoParser::AutoParser(std::string const & transitionSystemFile, std::string const & labelingFile,
std::string const & stateRewardFile, std::string const & transitionRewardFile)
: model(nullptr) {
storm::models::ModelType type = this->analyzeHint(transitionSystemFile);
if (type == storm::models::Unknown) {
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.");
throw storm::exceptions::WrongFileFormatException() << "Could not determine type of file " << transitionSystemFile;
}
else {
} else {
LOG4CPLUS_INFO(logger, "Model type seems to be " << type);
}
@ -43,11 +39,10 @@ AutoParser::AutoParser(std::string const & transitionSystemFile, std::string con
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 hintType = storm::models::Unknown;
// Open file
MappedFile file(filename.c_str());
@ -67,5 +62,5 @@ storm::models::ModelType AutoParser::analyzeHint(const std::string& filename) {
return hintType;
}
} //namespace parser
} //namespace storm
} // namespace parser
} // namespace storm

3
src/parser/DeterministicSparseTransitionParser.cpp

@ -197,8 +197,9 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st
if (fixDeadlocks) {
this->matrix->addNextValue(node, node, 1);
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;

12
src/parser/DtmcParser.cpp

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

4
src/parser/DtmcParser.h

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

5
src/parser/Parser.cpp

@ -2,6 +2,7 @@
#include <iostream>
#include <cstring>
#include <string>
#include "src/exceptions/FileIoException.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()");
}
this->data = (char*) mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0);
if (this->data == (char*)-1) {
this->data = reinterpret_cast<char*>(mmap(NULL, this->st.st_size, PROT_READ, MAP_PRIVATE, this->file, 0));
if (this->data == reinterpret_cast<char*>(-1)) {
close(this->file);
LOG4CPLUS_ERROR(logger, "Error in mmap(" << filename << ").");
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/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
#include <fstream>
#include "src/parser/DeterministicSparseTransitionParser.h"
#include "src/parser/AtomicPropositionLabelingParser.h"
namespace storm {
namespace utility {

8
src/utility/Settings.cpp

@ -7,13 +7,17 @@
#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/loggingmacros.h"
extern log4cplus::Logger logger;
#include <boost/algorithm/string/join.hpp>
namespace storm {
namespace settings {

Loading…
Cancel
Save