Commit 474edb0e authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

quelques modifs

parent 31049302
......@@ -151,8 +151,8 @@ bool Interface_console::draw_trace(const string & filename, const int format){
cout << "Loading of the trace : " << loaded << "%" ;
if (loaded_f>0.0f){
time_buf = (time_elapsed.elapsed()/loaded_f - time_elapsed.elapsed())/1000;/* divided by to have in second 1000 since time_elapsed.elapsed() returns ms */
/* divided by to have in second 1000 since time_elapsed.elapsed() returns ms */
time_buf = time_elapsed.elapsed() * (1.0 / loaded_f - 1.0) / 1000;
if (time_buf>=3600){/* convert second in hour and min */
buf_txt << "Parsing... Remaining: " << time_buf/3600 << " h " << (time_buf%3600)/60 << " min " << time_buf%60 << " s";
......
......@@ -12,9 +12,10 @@ void ParserPaje::parse(string filename, Trace &trace){
set_file_to_parse(filename);
const unsigned int position_of_dot = filename.find_last_of('.');
if(position_of_dot == string::npos || filename.substr(position_of_dot) != ".trace"){
if ((position_of_dot == (string::npos)) || (filename.substr(position_of_dot) != ".trace")){
Error::set(Error::_BAD_FILE_EXTENSION, Error::_WARNING);
}
ParserDefinitionDecoder *parserdefinition = new ParserDefinitionDecoder();
ParserEventDecoder *parserevent = new ParserEventDecoder();
......
......@@ -45,11 +45,11 @@ Render_opengl::Render_opengl(Interface_console* core, QWidget *parent)
_state = DRAWING_STATE_WAITING;/* At the beginning, no trace is drawing */
/* init the wait animation */
_wait_list = 0;/* init list */
_wait_angle = 0.0f;/* begin with 0 rad angle */
_wait_angle_y = 0.0f;/* begin with 0 rad angle */
_wait_timer = NULL;
_wait_spf = DRAWING_TIMER_DEFAULT;/* DRAWING_TIMER_DEFAULT milliseconds per frame */
_wait_list = 0; /* init list */
_wait_angle = 0.0f; /* begin with 0 rad angle */
_wait_angle_y = 0.0f; /* begin with 0 rad angle */
_wait_timer = NULL;
_wait_spf = DRAWING_TIMER_DEFAULT;/* DRAWING_TIMER_DEFAULT milliseconds per frame */
_counter_last_x = 0.0;
_counter_last_y = 0.0;
......@@ -59,16 +59,16 @@ Render_opengl::Render_opengl(Interface_console* core, QWidget *parent)
/* init main informations about OpenGL scene and QGLWidget size */
_screen_width = width();/* get the QGLWidget visibled width (in pixel) */
_screen_height = height();/* get the QGLWidget visibled height (in pixel) */
_screen_width = width(); /* get the QGLWidget visibled width (in pixel) */
_screen_height = height(); /* get the QGLWidget visibled height (in pixel) */
_render_width = 100;/* 100 OpenGL units for the render scene width */
_render_height = 100;/* 100 OpenGL units for the render scene height */
_render_width = 100; /* 100 OpenGL units for the render scene width */
_render_height = 100; /* 100 OpenGL units for the render scene height */
_x_scale_container_state = 0.2;/* 20% of screen is used for containers then the other part for states */
_ruler_height = 4.0;/* height of the ruler */
_ruler_y = 0.0;/* highness of the ruler */
_ruler_height = 4.0; /* height of the ruler */
_ruler_y = 0.0; /* highness of the ruler */
_default_entity_x_translate = 20;/* _render_width * _x_scale_container_state */
......@@ -101,30 +101,29 @@ Render_opengl::Render_opengl(Interface_console* core, QWidget *parent)
/* OpenGL lists */
_list_containers = 0;
_list_states = 0;
_list_counters = 0;
_list_ruler = 0;
_list_states = 0;
_list_counters = 0;
_list_ruler = 0;
_x_state_scale = 1;/* for states scaling */
_x_state_scale = 1;/* for states scaling */
_x_state_translate = 0;/* for states translation */
_y_state_scale = 1;/* for states scaling */
_y_state_scale = 1;/* for states scaling */
_y_state_translate = 0;/* for states translation */
_x_scroll_pos = 0;/* horizontal bar placed on 0 */
_y_scroll_pos = 0;/* vertical bar placed on 0 */
_x_scroll_pos = 0;/* horizontal bar placed on 0 */
_y_scroll_pos = 0;/* vertical bar placed on 0 */
/* Camera is placed on (0,0,0) and looks to (0,0,-1) */
_z_ruler_over = -0.5;
_z_container = -1.0;
_z_ruler_over = -0.5;
_z_container = -1.0;
_z_container_under = -1.2;
_z_ruler = -1.5;
_z_ruler_under = -1.6;
_z_arrow = -2.0;/* closer to camera than containers or states (MUST be negative)*/
_z_event = -3.0;/* closer to camera than containers or states (MUST be negative)*/
_z_counter = -4.0;
_z_state = -5.0;
_z_ruler = -1.5;
_z_ruler_under = -1.6;
_z_arrow = -2.0;/* closer to camera than containers or states (MUST be negative)*/
_z_event = -3.0;/* closer to camera than containers or states (MUST be negative)*/
_z_counter = -4.0;
_z_state = -5.0;
setAutoFillBackground(false);
setMouseTracking (true);/* to catch mouse events */
......@@ -1086,7 +1085,7 @@ bool Render_opengl::build(){
message << "Cannot unbuild the waiting animation" << Message::endw;
}
if (_wait_timer->isActive())/* if timer for the wait animation is running */
if ((_wait_timer != NULL) && _wait_timer->isActive())/* if timer for the wait animation is running */
_wait_timer->stop();
_state = DRAWING_STATE_DRAWING;/* change the drawing state */
......
......@@ -12,6 +12,8 @@ TARGET = vite
macx:QMAKE_LIBS_OPENGL += -framework GLUT -lobjc
DEPENDPATH += . interface message parser trace trace/values
INCLUDEPATH += . interface message trace trace/values parser
QMAKE_CFLAGS += -O2
QMAKE_CXXFLAGS += -O2
!macx{
LIBS += -lglut
......
......@@ -6,18 +6,9 @@ Container::Container(Name name, Date creation_time, ContainerType *type, Contain
_n_states(0), _state_tree(0), _n_events(0), _event_tree(0), _n_variables(0) {
}
template <class T>
static void clear_list(list<T *> &l) {
for (typename list<T *>::iterator it = l.begin();
it != l.end();
it++) {
delete *it;
}
}
Container::~Container() {
// Delete children
clear_list<Container>(_children);
_children.clear();
// Delete states
delete _state_tree;
......@@ -26,14 +17,10 @@ Container::~Container() {
delete _event_tree;
// Delete links
clear_list<Link>(_links);
_links.clear();
// Delete variables
for (map<VariableType *, Variable *>::iterator it = _variables.begin();
it != _variables.end();
it++) {
delete (*it).second;
}
_variables.clear();
}
void Container::add_child(Container *child) {
......@@ -58,7 +45,7 @@ void Container::add_current_state(Date end) {
_n_states++;
_states.push_back(new StateChange(new_state->get_start_time(), NULL, new_state));
}
// Set the change from the new state
_states.push_back(new StateChange(end, new_state));
_n_states++;
......@@ -157,31 +144,31 @@ void Container::sub_variable(Date time, VariableType *type, Double value) {
(*i).second->add_value(time, (*i).second->get_last_value() - value);
}
}
Name Container::get_name() const {
return _name;
}
const Container *Container::get_parent() const {
return _parent;
}
const ContainerType *Container::get_type() const {
return _type;
}
const list<Container *> *Container::get_children() const {
return &_children;
return &_children;
}
Date Container::get_creation_time() const {
return _creation_time;
}
Date Container::get_destruction_time() const {
return _destruction_time;
}
BinaryTree<StateChange> *Container::get_states() const {
return _state_tree;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment