Browse Source

removing pantheios (new logger will be added soon) and fixed a warning

tempestpy_adaptions
gereon 12 years ago
parent
commit
5ce8355d2b
  1. 8
      src/parser/parser.cpp
  2. 1
      src/parser/parser.h
  3. 4
      src/parser/readLabFile.cpp
  4. 20
      src/parser/readTraFile.cpp

8
src/parser/parser.cpp

@ -10,7 +10,6 @@
#include <errno.h> #include <errno.h>
#include <iostream> #include <iostream>
#include <pantheios/pantheios.hpp>
#include "src/exceptions/file_IO_exception.h" #include "src/exceptions/file_IO_exception.h"
#include "src/exceptions/wrong_file_format.h" #include "src/exceptions/wrong_file_format.h"
@ -56,14 +55,12 @@ mrmc::parser::MappedFile::MappedFile(const char* filename)
*/ */
if (stat64(filename, &(this->st)) != 0) if (stat64(filename, &(this->st)) != 0)
{ {
pantheios::log_ERROR("Could not stat ", filename, ". Does it exist? Is it readable?");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()");
} }
this->file = open(filename, O_RDONLY); this->file = open(filename, O_RDONLY);
if (this->file < 0) if (this->file < 0)
{ {
pantheios::log_ERROR("Could not open ", filename, ". Does it exist? Is it readable?");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in open()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in open()");
} }
@ -71,7 +68,6 @@ mrmc::parser::MappedFile::MappedFile(const char* filename)
if (this->data == (char*)-1) if (this->data == (char*)-1)
{ {
close(this->file); close(this->file);
pantheios::log_ERROR("Could not mmap ", filename, ".");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in mmap()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in mmap()");
} }
this->dataend = this->data + this->st.st_size; this->dataend = this->data + this->st.st_size;
@ -82,14 +78,12 @@ mrmc::parser::MappedFile::MappedFile(const char* filename)
*/ */
if (_stat64(filename, &(this->st)) != 0) if (_stat64(filename, &(this->st)) != 0)
{ {
pantheios::log_ERROR("Could not stat ", filename, ". Does it exist? Is it readable?");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in stat()");
} }
this->file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); this->file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (this->file == INVALID_HANDLE_VALUE) if (this->file == INVALID_HANDLE_VALUE)
{ {
pantheios::log_ERROR("Could not open ", filename, ". Does it exist? Is it readable?");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFile()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFile()");
} }
@ -97,7 +91,6 @@ mrmc::parser::MappedFile::MappedFile(const char* filename)
if (this->mapping == NULL) if (this->mapping == NULL)
{ {
CloseHandle(this->file); CloseHandle(this->file);
pantheios::log_ERROR("Could not create file mapping for ", filename, ".");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileMapping()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in CreateFileMapping()");
} }
@ -106,7 +99,6 @@ mrmc::parser::MappedFile::MappedFile(const char* filename)
{ {
CloseHandle(this->mapping); CloseHandle(this->mapping);
CloseHandle(this->file); CloseHandle(this->file);
pantheios::log_ERROR("Could not create file map view for ", filename, ".");
throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in MapViewOfFile()"); throw exceptions::file_IO_exception("mrmc::parser::MappedFile Error in MapViewOfFile()");
} }
this->dataend = this->data + this->st.st_size; this->dataend = this->data + this->st.st_size;

1
src/parser/parser.h

@ -20,7 +20,6 @@
#include <errno.h> #include <errno.h>
#include <iostream> #include <iostream>
#include <pantheios/pantheios.hpp>
#include "src/exceptions/file_IO_exception.h" #include "src/exceptions/file_IO_exception.h"
#include "src/exceptions/wrong_file_format.h" #include "src/exceptions/wrong_file_format.h"

4
src/parser/readLabFile.cpp

@ -28,9 +28,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <locale.h> #include <locale.h>
#include <pantheios/pantheios.hpp>
#include <pantheios/inserters/integer.hpp>
namespace mrmc { namespace mrmc {
namespace parser { namespace parser {
@ -144,7 +141,6 @@ mrmc::models::AtomicPropositionsLabeling * readLabFile(uint_fast64_t node_count,
*/ */
uint_fast32_t node; uint_fast32_t node;
char proposition[128]; char proposition[128];
char* tmp;
size_t cnt; size_t cnt;
/* /*
* iterate over nodes * iterate over nodes

20
src/parser/readTraFile.cpp

@ -26,10 +26,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <locale.h> #include <locale.h>
#include <pantheios/pantheios.hpp>
#include <pantheios/inserters/integer.hpp>
#include <pantheios/inserters/real.hpp>
namespace mrmc { namespace mrmc {
namespace parser{ namespace parser{
@ -104,7 +100,7 @@ static uint_fast32_t makeFirstPass(char* buf, uint_fast32_t &maxnode)
* @return a pointer to the created sparse matrix. * @return a pointer to the created sparse matrix.
*/ */
sparse::SquareSparseMatrix<double> * readTraFile(const char * filename) {
mrmc::storage::SquareSparseMatrix<double> * readTraFile(const char * filename) {
/* /*
* enforce locale where decimal point is '.' * enforce locale where decimal point is '.'
*/ */
@ -131,7 +127,7 @@ sparse::SquareSparseMatrix<double> * readTraFile(const char * filename) {
* *
* from here on, we already know that the file header is correct * from here on, we already know that the file header is correct
*/ */
sparse::SquareSparseMatrix<double> *sp = NULL;
mrmc::storage::SquareSparseMatrix<double> *sp = NULL;
/* /*
* read file header, extract number of states * read file header, extract number of states
@ -142,16 +138,12 @@ sparse::SquareSparseMatrix<double> * readTraFile(const char * filename) {
buf += 12; // skip "TRANSITIONS " buf += 12; // skip "TRANSITIONS "
checked_strtol(buf, &buf); checked_strtol(buf, &buf);
pantheios::log_DEBUG("Creating matrix with ",
pantheios::integer(maxnode + 1), " maxnodes and ",
pantheios::integer(non_zero), " Non-Zero-Elements");
/* /*
* Creating matrix * Creating matrix
* Memory for diagonal elements is automatically allocated, hence only the number of non-diagonal * Memory for diagonal elements is automatically allocated, hence only the number of non-diagonal
* non-zero elements has to be specified (which is non_zero, computed by make_first_pass) * non-zero elements has to be specified (which is non_zero, computed by make_first_pass)
*/ */
sp = new sparse::SquareSparseMatrix<double>(maxnode + 1);
sp = new mrmc::storage::SquareSparseMatrix<double>(maxnode + 1);
if (sp == NULL) throw std::bad_alloc(); if (sp == NULL) throw std::bad_alloc();
sp->initialize(non_zero); sp->initialize(non_zero);
@ -174,11 +166,6 @@ sparse::SquareSparseMatrix<double> * readTraFile(const char * filename) {
* only values in (0, 1] are meaningful * only values in (0, 1] are meaningful
*/ */
if ((val <= 0.0) || (val > 1.0)) throw mrmc::exceptions::wrong_file_format(); if ((val <= 0.0) || (val > 1.0)) throw mrmc::exceptions::wrong_file_format();
pantheios::log_DEBUG("Write value ",
pantheios::real(val),
" to position ",
pantheios::integer(row), " x ",
pantheios::integer(col));
sp->addNextValue(row,col,val); sp->addNextValue(row,col,val);
buf = skipWS(buf); buf = skipWS(buf);
} }
@ -186,7 +173,6 @@ sparse::SquareSparseMatrix<double> * readTraFile(const char * filename) {
/* /*
* clean up * clean up
*/ */
pantheios::log_DEBUG("Finalizing Matrix");
sp->finalize(); sp->finalize();
return sp; return sp;
} }

Loading…
Cancel
Save