diff --git a/src/interface/Interval_select.cpp b/src/interface/Interval_select.cpp index c7681ae17f3c76cd9db8ff207fb44742200a9643..6ac05e2ce455a657c932a57c375adbad8a61bbd4 100644 --- a/src/interface/Interval_select.cpp +++ b/src/interface/Interval_select.cpp @@ -71,7 +71,7 @@ #include "interface/Interval_select.hpp" -#include "limits.h" +#include <limits> using namespace std; diff --git a/src/parser/ParserSplitted.cpp b/src/parser/ParserSplitted.cpp index 97a9f9d5dd39ba8bf24c146245a56a35a80522b8..23439141901272cd73018d08e3da1fb7d8a06166 100644 --- a/src/parser/ParserSplitted.cpp +++ b/src/parser/ParserSplitted.cpp @@ -70,66 +70,79 @@ Serializer<Container>::Instance().clear(); Serializer<ContainerType>::Instance().clear(); Serializer<EntityType>::Instance().clear(); - std::list<ContainerType*> conts_types; + std::list<ContainerType *> conts_types; std::list<Container*> conts; - std::ifstream ifs(_file_to_parse.c_str()); - boost::archive::text_iarchive ia(ifs); - ia.register_type(static_cast<StateType *>(NULL)); - ia.register_type(static_cast<EventType *>(NULL)); - ia.register_type(static_cast<VariableType *>(NULL)); - ia.register_type(static_cast<LinkType *>(NULL)); - ia.register_type(static_cast<ContainerType *>(NULL)); - ia.register_type(static_cast<Container *>(NULL)); - ia.register_type(static_cast<Color *>(NULL)); - ia.register_type(static_cast<Date *>(NULL)); - ia.register_type(static_cast<Double *>(NULL)); - ia.register_type(static_cast<Hex *>(NULL)); - ia.register_type(static_cast<Integer *>(NULL)); - ia.register_type(static_cast<Name *>(NULL)); - ia.register_type(static_cast<String *>(NULL)); - ia >> conts_types; - trace.set_container_types(conts_types); - //int test; - //ia >> test; - // restore the schedule from the archive - ia >> conts; + std::ifstream ifs(_file_to_parse.c_str(),std::ios::in); + if(ifs.fail()) + { + message << "Error while opening file" << _file_to_parse << Message::ende; + return; + } + QT_TRY { + boost::archive::text_iarchive ia(ifs); + + ia.register_type(static_cast<StateType *>(NULL)); + ia.register_type(static_cast<EventType *>(NULL)); + ia.register_type(static_cast<VariableType *>(NULL)); + ia.register_type(static_cast<LinkType *>(NULL)); + ia.register_type(static_cast<ContainerType *>(NULL)); + ia.register_type(static_cast<Container *>(NULL)); + ia.register_type(static_cast<Color *>(NULL)); + ia.register_type(static_cast<Date *>(NULL)); + ia.register_type(static_cast<Double *>(NULL)); + ia.register_type(static_cast<Hex *>(NULL)); + ia.register_type(static_cast<Integer *>(NULL)); + ia.register_type(static_cast<Name *>(NULL)); + ia.register_type(static_cast<String *>(NULL)); + + printf("test : %d\n", ia.get_library_version()); + ia >> conts_types; + trace.set_container_types(conts_types); + //int test; + //ia >> test; + // restore the schedule from the archive + ia >> conts; - trace.set_root_containers(conts); + trace.set_root_containers(conts); - if(Info::Splitter::xml_filename.length()!=0)//we need to load a config from file - { - bool xml_success = trace.load_config_from_xml(QString(Info::Splitter::xml_filename.c_str())); - if(!xml_success){ - message << "Error while parsing" << Info::Splitter::xml_filename << Message::ende; - } - } + if(Info::Splitter::xml_filename.length()!=0)//we need to load a config from file + { + bool xml_success = trace.load_config_from_xml(QString(Info::Splitter::xml_filename.c_str())); + if(!xml_success){ + std::cerr << "Error while parsing" << Info::Splitter::xml_filename << std::endl; + } + } - std::map<Name, StateType* > _state_types; - std::map<Name, EventType* > _event_types; - std::map<Name, LinkType* > _link_types; - std::map<Name, VariableType* > _variable_types; + std::map<Name, StateType* > _state_types; + std::map<Name, EventType* > _event_types; + std::map<Name, LinkType* > _link_types; + std::map<Name, VariableType* > _variable_types; - ia >> _state_types; - trace.set_state_types(_state_types); + ia >> _state_types; + trace.set_state_types(_state_types); - ia >> _event_types; - trace.set_event_types(_event_types); + ia >> _event_types; + trace.set_event_types(_event_types); - ia >> _link_types; - trace.set_link_types(_link_types); + ia >> _link_types; + trace.set_link_types(_link_types); - ia >> _variable_types; - trace.set_variable_types(_variable_types); - - Date d; - ia >>d; - trace.set_max_date(d); + ia >> _variable_types; + trace.set_variable_types(_variable_types); + Date d; + ia >>d; + trace.set_max_date(d); + }QT_CATCH(boost::archive::archive_exception e) { + std::cerr << "failed while restoring serialized file !" << e.what() << " with file " << _file_to_parse <<std::endl; + + return; + } //we count the number of containers to load, in order to have a pseudo relevant loaded percentage to display_build //we should do this with ITC, but that would mean to handle all of the loading here or to have a feedback from trace and containers @@ -217,6 +230,9 @@ void ParserSplitted::releasefile(){ } float ParserSplitted::get_percent_loaded() const { + if(_nb_itc!=0) return (double)_loaded_itc/(double)_nb_itc; + else + return 0.0; } #endif diff --git a/src/render/Hook_event.cpp b/src/render/Hook_event.cpp index 8815a23bb0fd2b9e9a9babd790f92a56f48d37c9..0fda8069fbf7c5f7b2a5f7cd5ed4193f4d9efe85 100644 --- a/src/render/Hook_event.cpp +++ b/src/render/Hook_event.cpp @@ -693,7 +693,7 @@ void Hook_event::replace_scale(Element_pos new_scale){ _core->launch_action(_core->_STATE_ZOOM_BOX_VALUE, &buf); - // updateRender(); + updateRender(); refresh_scroll_bars(true); } } diff --git a/src/trace/Trace.cpp b/src/trace/Trace.cpp index 7c2d9ec1d362b2238b7a9e743cb53a8cfb545da7..c7c17a36832286cae33c5a02112bbf5a683e5244 100644 --- a/src/trace/Trace.cpp +++ b/src/trace/Trace.cpp @@ -518,7 +518,7 @@ void Trace::dump(std::string path, std::string filename) { std::string file; file += path + "/" + filename + "/" + filename +".vite"; // i = _root_containers.begin(); - std::ofstream ofs(file.c_str()); + std::ofstream ofs(file.c_str(),std::ios::out); boost::archive::text_oarchive oa(ofs);