Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
vite
Commits
be838038
Commit
be838038
authored
Dec 02, 2018
by
Mathieu Faverge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply patch 9 from issue
#13
- modernize loop convert
parent
68d76d81
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
155 additions
and
262 deletions
+155
-262
src/common/Palette.cpp
src/common/Palette.cpp
+2
-3
src/common/Tools.cpp
src/common/Tools.cpp
+1
-1
src/common/Tools.hpp
src/common/Tools.hpp
+1
-1
src/core/Core.cpp
src/core/Core.cpp
+7
-13
src/interface/Interface_graphic.cpp
src/interface/Interface_graphic.cpp
+5
-5
src/interface/Node_select.cpp
src/interface/Node_select.cpp
+12
-18
src/interface/qxtspanslider.cpp
src/interface/qxtspanslider.cpp
+1
-4
src/parser/PajeParser/ParserVite.cpp
src/parser/PajeParser/ParserVite.cpp
+2
-3
src/plugin/Command_window.cpp
src/plugin/Command_window.cpp
+6
-10
src/plugin/Plugin_window.cpp
src/plugin/Plugin_window.cpp
+10
-13
src/render/GanttDiagram.hpp
src/render/GanttDiagram.hpp
+5
-5
src/statistics/DrawCounter.hpp
src/statistics/DrawCounter.hpp
+5
-9
src/statistics/DrawHDiagram.hpp
src/statistics/DrawHDiagram.hpp
+5
-7
src/statistics/DrawStats.hpp
src/statistics/DrawStats.hpp
+3
-5
src/statistics/DrawVDiagram.hpp
src/statistics/DrawVDiagram.hpp
+4
-6
src/statistics/Statistic.cpp
src/statistics/Statistic.cpp
+2
-4
src/statistics/Stats_window.cpp
src/statistics/Stats_window.cpp
+8
-12
src/trace/Container.cpp
src/trace/Container.cpp
+2
-4
src/trace/DrawTrace.hpp
src/trace/DrawTrace.hpp
+34
-63
src/trace/Entity.cpp
src/trace/Entity.cpp
+2
-9
src/trace/EntityValue.cpp
src/trace/EntityValue.cpp
+2
-4
src/trace/Trace.cpp
src/trace/Trace.cpp
+33
-60
src/trace/Variable.cpp
src/trace/Variable.cpp
+1
-1
src/trace/values/Color.cpp
src/trace/values/Color.cpp
+2
-2
No files found.
src/common/Palette.cpp
View file @
be838038
...
...
@@ -13,9 +13,8 @@ Palette::Palette(const std::string &name) : _name(name) {
}
Palette
::~
Palette
()
{
for
(
std
::
map
<
std
::
string
,
Color
*>::
iterator
it
=
_pairs
.
begin
()
;
it
!=
_pairs
.
end
()
;
++
it
)
{
Color
*
c
=
(
*
it
).
second
;
for
(
auto
&
_pair
:
_pairs
)
{
Color
*
c
=
_pair
.
second
;
delete
c
;
}
}
...
...
src/common/Tools.cpp
View file @
be838038
...
...
@@ -93,7 +93,7 @@ bool convert_to_double(const std::string &arg, double *val) {
}
}
double
clockGet
(
void
)
double
clockGet
()
{
#if (defined X_ARCHalpha_compaq_osf1) || (defined X_ARCHi686_mac)
struct
rusage
data
;
...
...
src/common/Tools.hpp
View file @
be838038
...
...
@@ -66,6 +66,6 @@ bool convert_to_double(const std::string &arg, double *val);
Uses different timing routines depending on the machine architecture.
\return Returns the time ellapsed since 'clockStart'.
*/
double
clockGet
(
void
);
double
clockGet
();
#endif // TOOLS_HPP
src/core/Core.cpp
View file @
be838038
...
...
@@ -930,16 +930,12 @@ void Core::launch_action(int state, void* arg) {
const
Container
::
Vector
*
root_containers
=
_trace
->
get_view_root_containers
();
if
(
root_containers
->
empty
())
root_containers
=
_trace
->
get_root_containers
();
if
(
!
root_containers
->
empty
()){
for
(
Container
::
VectorIt
i
=
root_containers
->
begin
();
i
!=
root_containers
->
end
();
i
++
)
if
((
container
=
buf
.
search_container_by_position
(
*
i
,
yr
)))
for
(
const
auto
&
root_container
:
*
root_containers
)
if
((
container
=
buf
.
search_container_by_position
(
root_container
,
yr
)))
break
;
for
(
Container
::
VectorIt
i
=
root_containers
->
begin
();
i
!=
root_containers
->
end
();
i
++
)
if
((
container2
=
buf
.
search_container_by_position
(
*
i
,
yr2
)))
for
(
const
auto
&
root_container
:
*
root_containers
)
if
((
container2
=
buf
.
search_container_by_position
(
root_container
,
yr2
)))
break
;
...
...
@@ -1159,11 +1155,9 @@ void Core::export_variable(Variable *var, const string &filename) {
const
double
min
=
var
->
get_min
().
get_value
();
const
double
max
=
var
->
get_max
().
get_value
();
for
(
list
<
pair
<
Date
,
Double
>
>::
const_iterator
value
=
variable_values
->
begin
();
value
!=
variable_values
->
end
();
value
++
)
{
first_value
=
(
*
value
).
first
.
get_value
();
second_value
=
((
*
value
).
second
.
get_value
()
-
min
)
/
(
max
-
min
)
;
for
(
const
auto
&
variable_value
:
*
variable_values
)
{
first_value
=
variable_value
.
first
.
get_value
();
second_value
=
(
variable_value
.
second
.
get_value
()
-
min
)
/
(
max
-
min
)
;
file
<<
first_value
<<
"
\t
"
<<
second_value
<<
endl
;
}
...
...
src/interface/Interface_graphic.cpp
View file @
be838038
...
...
@@ -235,8 +235,8 @@ void Interface_graphic::load_windows(){
_ui_help_window
,
SLOT
(
close
()));
// For the recent files menu
for
(
int
i
=
0
;
i
<
Session
::
_MAX_NB_RECENT_FILES
;
++
i
)
{
_recent_file_action
s
[
i
]
=
nullptr
;
for
(
auto
&
_recent_file_action
:
_recent_file_actions
)
{
_recent_file_action
=
nullptr
;
}
update_recent_files_menu
();
...
...
@@ -601,9 +601,9 @@ void Interface_graphic::open_recent_file() {
void
Interface_graphic
::
on_clear_recent_files_triggered
()
{
Session
::
clear_recent_files
();
// We remove the elements from the menu
for
(
int
i
=
0
;
i
<
Session
::
_MAX_NB_RECENT_FILES
;
++
i
)
{
if
(
_recent_file_action
s
[
i
]
!=
nullptr
)
{
_ui_recent_files_menu
->
removeAction
(
_recent_file_action
s
[
i
]
);
for
(
auto
&
_recent_file_action
:
_recent_file_actions
)
{
if
(
_recent_file_action
!=
nullptr
)
{
_ui_recent_files_menu
->
removeAction
(
_recent_file_action
);
}
}
}
...
...
src/interface/Node_select.cpp
View file @
be838038
...
...
@@ -101,17 +101,15 @@ void Node_select::set_initial_container_names(){
// Add the root container names
QList
<
QTreeWidgetItem
*>
items
;
QFlags
<
Qt
::
ItemFlag
>
flg
;
for
(
Container
::
VectorIt
it
=
root_containers
->
begin
();
it
!=
root_containers
->
end
();
it
++
)
{
string
name
=
(
*
it
)
->
get_Name
().
to_string
();
for
(
const
auto
&
root_container
:
*
root_containers
)
{
string
name
=
root_container
->
get_Name
().
to_string
();
QStringList
temp
(
QString
::
fromStdString
(
name
));
QTreeWidgetItem
*
current_node
=
new
QTreeWidgetItem
((
QTreeWidgetItem
*
)
nullptr
,
temp
);
current_node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
*
it
));
//store the pointer to the container in the Data field
current_node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
root_container
));
//store the pointer to the container in the Data field
items
.
append
(
current_node
);
// Recursivity to add the children names
set_container_names_rec
(
current_node
,
(
*
it
)
,
flg
,
false
);
set_container_names_rec
(
current_node
,
root_container
,
flg
,
false
);
}
_nodes_original
->
insertTopLevelItems
(
0
,
items
);
...
...
@@ -136,20 +134,18 @@ void Node_select::set_displayed_container_names(){
// Add the root container names
QList
<
QTreeWidgetItem
*>
items
;
QFlags
<
Qt
::
ItemFlag
>
flg
=
Qt
::
ItemIsDragEnabled
|
Qt
::
ItemIsDropEnabled
|
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsTristate
;
for
(
Container
::
VectorIt
it
=
root_containers
->
begin
();
it
!=
root_containers
->
end
();
it
++
)
{
string
name
=
(
*
it
)
->
get_Name
().
to_string
();
for
(
const
auto
&
root_container
:
*
root_containers
)
{
string
name
=
root_container
->
get_Name
().
to_string
();
QStringList
temp
(
QString
::
fromStdString
(
name
));
QTreeWidgetItem
*
current_node
=
new
QTreeWidgetItem
((
QTreeWidgetItem
*
)
nullptr
,
temp
);
current_node
->
setFlags
(
flg
);
current_node
->
setCheckState
(
0
,
Qt
::
Checked
);
current_node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
*
it
));
//store the pointer to the container in the Data field
current_node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
root_container
));
//store the pointer to the container in the Data field
items
.
append
(
current_node
);
// Recursivity to add the children names
set_container_names_rec
(
current_node
,
(
*
it
)
,
flg
,
true
);
set_container_names_rec
(
current_node
,
root_container
,
flg
,
true
);
}
_nodes_displayed
->
insertTopLevelItems
(
0
,
items
);
...
...
@@ -170,18 +166,16 @@ void Node_select::set_container_names_rec(QTreeWidgetItem *current_node, Contain
if
(
load_view
==
false
||
children
->
empty
())
children
=
current_container
->
get_children
();
//QFlags<Qt::ItemFlag> flg= Qt::ItemIsDragEnabled;
for
(
Container
::
VectorIt
it
=
children
->
begin
();
it
!=
children
->
end
();
it
++
)
{
for
(
const
auto
&
child
:
*
children
)
{
// We create the node and we do the recursivity
string
name
=
(
*
it
)
->
get_Name
().
to_string
();
string
name
=
child
->
get_Name
().
to_string
();
QStringList
temp
(
QString
::
fromStdString
(
name
));
QTreeWidgetItem
*
node
=
new
QTreeWidgetItem
(
current_node
,
temp
);
node
->
setFlags
(
flg
);
node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
*
it
));
//store the pointer to the container in the Data field
node
->
setData
(
0
,
Qt
::
UserRole
,
qVariantFromValue
(
child
));
//store the pointer to the container in the Data field
if
(
flg
&
Qt
::
ItemIsUserCheckable
)
node
->
setCheckState
(
0
,
Qt
::
Checked
);
set_container_names_rec
(
node
,
(
*
it
)
,
flg
,
load_view
);
set_container_names_rec
(
node
,
child
,
flg
,
load_view
);
}
}
...
...
src/interface/qxtspanslider.cpp
View file @
be838038
...
...
@@ -30,10 +30,7 @@
#include <QStylePainter>
#include <QStyleOptionSlider>
QxtSpanSliderPrivate
::
QxtSpanSliderPrivate
()
{
}
QxtSpanSliderPrivate
::
QxtSpanSliderPrivate
()
=
default
;
void
QxtSpanSliderPrivate
::
initStyleOption
(
QStyleOptionSlider
*
option
,
QxtSpanSlider
::
SpanHandle
handle
)
const
{
...
...
src/parser/PajeParser/ParserVite.cpp
View file @
be838038
...
...
@@ -107,12 +107,11 @@ void ParserVite::parse(Trace &trace,
/* Loop over root containers to add them in the stack */
root_containers
=
trace
.
get_root_containers
();
for
(
Container
::
VectorIt
it
=
root_containers
->
begin
();
it
!=
root_containers
->
end
();
it
++
)
{
for
(
const
auto
&
root_container
:
*
root_containers
)
{
#ifdef DBG_PARSER_VITE
std
::
cerr
<<
"+"
;
#endif
CTstack
.
push
(
*
it
);
CTstack
.
push
(
root_container
);
}
#ifdef DBG_PARSER_VITE
...
...
src/plugin/Command_window.cpp
View file @
be838038
...
...
@@ -180,10 +180,8 @@ void Command_window::set_container_names() {
QList
<
QTreeWidgetItem
*>
items
;
QFlags
<
Qt
::
ItemFlag
>
flg
=
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsTristate
;
for
(
Container
::
VectorIt
it
=
root_containers
->
begin
();
it
!=
root_containers
->
end
();
it
++
)
{
string
name
=
(
*
it
)
->
get_Name
().
to_string
();
for
(
const
auto
&
root_container
:
*
root_containers
)
{
string
name
=
root_container
->
get_Name
().
to_string
();
QStringList
temp
(
QString
::
fromStdString
(
name
));
QTreeWidgetItem
*
current_node
=
new
QTreeWidgetItem
((
QTreeWidgetItem
*
)
nullptr
,
temp
);
...
...
@@ -192,7 +190,7 @@ void Command_window::set_container_names() {
items
.
append
(
current_node
);
// Recursivity to add the children names
set_container_names_rec
(
current_node
,
(
*
it
)
);
set_container_names_rec
(
current_node
,
root_container
);
}
(
*
(
items
.
begin
()))
->
setExpanded
(
true
);
...
...
@@ -203,16 +201,14 @@ void Command_window::set_container_names_rec(QTreeWidgetItem *current_node, cons
const
Container
::
Vector
*
children
=
current_container
->
get_children
();
QFlags
<
Qt
::
ItemFlag
>
flg
=
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
/* | Qt::ItemIsTristate*/
;
for
(
Container
::
VectorIt
it
=
children
->
begin
();
it
!=
children
->
end
();
it
++
)
{
for
(
const
auto
&
it
:
*
children
)
{
// We create the node and we do the recursivity
string
name
=
(
*
it
)
->
get_Name
().
to_string
();
string
name
=
it
->
get_Name
().
to_string
();
QStringList
temp
(
QString
::
fromStdString
(
name
));
QTreeWidgetItem
*
node
=
new
QTreeWidgetItem
(
current_node
,
temp
);
node
->
setFlags
(
flg
);
node
->
setCheckState
(
0
,
Qt
::
Unchecked
);
set_container_names_rec
(
node
,
(
*
it
)
);
set_container_names_rec
(
node
,
it
);
}
}
...
...
src/plugin/Plugin_window.cpp
View file @
be838038
...
...
@@ -110,9 +110,9 @@ Plugin_window::Plugin_window(Core *c, QWidget *parent)
Plugin_window
::~
Plugin_window
()
{
_plugin_directories
.
clear
();
for
(
unsigned
int
i
=
0
;
i
<
_plugins
.
size
()
;
i
++
)
{
delete
_plugin
s
[
i
]
;
_plugin
s
[
i
]
=
nullptr
;
for
(
auto
&
_plugin
:
_plugins
)
{
delete
_plugin
;
_plugin
=
nullptr
;
}
_plugins
.
clear
();
}
...
...
@@ -134,8 +134,7 @@ void Plugin_window::load_shared_plugins() {
QFileInfoList
list
=
dir
.
entryInfoList
();
for
(
int
i
=
0
;
i
<
list
.
size
()
;
++
i
)
{
const
QFileInfo
&
fileInfo
=
list
.
at
(
i
);
for
(
const
auto
&
fileInfo
:
list
)
{
QString
filename
=
fileInfo
.
absoluteFilePath
();
if
(
!
QLibrary
::
isLibrary
(
filename
))
{
...
...
@@ -144,7 +143,7 @@ void Plugin_window::load_shared_plugins() {
QLibrary
current_plugin
(
filename
);
Plugin
*
(
*
f
)(
void
)
=
(
Plugin
*
(
*
)(
void
))
current_plugin
.
resolve
(
"create"
);
Plugin
*
(
*
f
)(
)
=
(
Plugin
*
(
*
)(
))
current_plugin
.
resolve
(
"create"
);
if
(
!
f
)
{
cerr
<<
"Unable to load "
<<
current_plugin
.
errorString
().
toStdString
()
<<
endl
;
}
...
...
@@ -194,10 +193,8 @@ void Plugin_window::execute_plugin() {
}
void
Plugin_window
::
clear_plugins
()
{
for
(
vector
<
Plugin
*>::
iterator
it
=
_plugins
.
begin
()
;
it
<
_plugins
.
end
()
;
++
it
)
{
(
*
it
)
->
clear
();
for
(
Plugin
*
plugin
:
_plugins
)
{
plugin
->
clear
();
}
}
...
...
@@ -205,9 +202,9 @@ void Plugin_window::reload_plugins() {
// Temporary disconnection for delete current plugins
disconnect
(
_tab_widget
,
SIGNAL
(
currentChanged
(
int
)),
this
,
SLOT
(
reload_plugin
(
int
)));
_plugin_directories
.
clear
();
for
(
unsigned
int
i
=
0
;
i
<
_plugins
.
size
()
;
i
++
)
{
delete
_plugin
s
[
i
]
;
_plugin
s
[
i
]
=
nullptr
;
for
(
auto
&
_plugin
:
_plugins
)
{
delete
_plugin
;
_plugin
=
nullptr
;
}
_plugins
.
clear
();
connect
(
_tab_widget
,
SIGNAL
(
currentChanged
(
int
)),
this
,
SLOT
(
reload_plugin
(
int
)));
...
...
src/render/GanttDiagram.hpp
View file @
be838038
...
...
@@ -218,13 +218,13 @@ public:
/* Before calling start_draw_container(), Info::Container::y_max should have a correct value */
_render
->
start_draw_containers
();
for
(
unsigned
int
i
=
0
;
i
<
_containers
.
size
()
;
i
++
){
for
(
const
auto
&
_container
:
_containers
){
_render
->
set_color
(
0
,
0
,
j
);
_render
->
draw_quad
(
_container
s
[
i
]
.
x
*
coeffx
,
trace_to_render_y
(
_container
s
[
i
]
.
y
),
_render
->
draw_quad
(
_container
.
x
*
coeffx
,
trace_to_render_y
(
_container
.
y
),
_z_container
,
_container
s
[
i
]
.
w
*
coeffx
,
_container
s
[
i
]
.
h
*
coeffy
);
_container
.
w
*
coeffx
,
_container
.
h
*
coeffy
);
}
for
(
unsigned
int
i
=
0
;
i
<
_container_texts
.
size
()
;
i
++
){
...
...
src/statistics/DrawCounter.hpp
View file @
be838038
...
...
@@ -115,10 +115,8 @@ public:
for
(
int
i
=
0
;
i
<
nbcont
;
i
++
)
{
const
std
::
map
<
VariableType
*
,
Variable
*>
*
variables
=
this
->
_containers_to_print
[
i
]
->
get_variables
();
// We print each variable
for
(
std
::
map
<
VariableType
*
,
Variable
*>::
const_iterator
it
=
variables
->
begin
()
;
it
!=
variables
->
end
()
;
it
++
)
{
draw_diagram
(
draw_object
,
i
,
(
*
it
).
second
);
for
(
const
auto
&
variable
:
*
variables
)
{
draw_diagram
(
draw_object
,
i
,
variable
.
second
);
_nb_variables_already_print
++
;
}
}
...
...
@@ -229,11 +227,9 @@ public:
bool
is_last_value
=
false
;
// If we get a time bigger than the end_time
if
(
max_value
!=
min_value
)
{
for
(
std
::
list
<
std
::
pair
<
Date
,
Double
>
>::
const_iterator
it
=
values
->
begin
();
it
!=
values
->
end
();
it
++
)
{
time
=
(
*
it
).
first
.
get_value
();
value
=
(
*
it
).
second
.
get_value
();
for
(
const
auto
&
it
:
*
values
)
{
time
=
it
.
first
.
get_value
();
value
=
it
.
second
.
get_value
();
if
(
time
<
this
->
_start_time
)
{
continue
;
...
...
src/statistics/DrawHDiagram.hpp
View file @
be838038
...
...
@@ -180,11 +180,9 @@ public:
ctname
);
// Draw the stats
for
(
std
::
map
<
const
EntityValue
*
,
stats
*>::
iterator
it
=
temp_states
.
begin
();
it
!=
temp_states
.
end
();
it
++
)
for
(
auto
&
temp_state
:
temp_states
)
{
double
length
=
(
*
it
)
.
second
->
_total_length
;
double
length
=
temp_state
.
second
->
_total_length
;
double
percent
=
length
/
duration
;
double
width
=
percent
*
_graph_width
;
double
red
=
0.7
;
...
...
@@ -192,9 +190,9 @@ public:
double
blue
=
0.75
;
// We search for a color
if
(
(
*
it
).
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
!=
(
*
it
)
.
first
->
get_extra_fields
()
->
end
())
if
(
temp_state
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
!=
temp_state
.
first
->
get_extra_fields
()
->
end
())
{
const
Color
*
color
=
(
const
Color
*
)
(
*
it
)
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
->
second
;
const
Color
*
color
=
(
const
Color
*
)
temp_state
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
->
second
;
red
=
color
->
get_red
();
green
=
color
->
get_green
();
blue
=
color
->
get_blue
();
...
...
@@ -210,7 +208,7 @@ public:
QString
::
number
(
percent
*
100.
,
'f'
,
1
).
toStdString
()
+
"%"
);
pos_x
+=
width
;
this
->
_setstates
.
insert
(
(
*
it
)
.
first
);
this
->
_setstates
.
insert
(
temp_state
.
first
);
}
...
...
src/statistics/DrawStats.hpp
View file @
be838038
...
...
@@ -196,11 +196,9 @@ public:
virtual
double
get_max_percentage
(
std
::
map
<
const
EntityValue
*
,
stats
*>
&
temp_states
)
const
{
double
value
;
double
max_length
=
0.
;
for
(
std
::
map
<
const
EntityValue
*
,
stats
*>::
iterator
it
=
temp_states
.
begin
();
it
!=
temp_states
.
end
();
it
++
)
{
if
((
*
it
).
second
->
_total_length
>=
max_length
)
{
max_length
=
(
*
it
).
second
->
_total_length
;
for
(
auto
&
temp_state
:
temp_states
)
{
if
(
temp_state
.
second
->
_total_length
>=
max_length
)
{
max_length
=
temp_state
.
second
->
_total_length
;
}
}
value
=
max_length
/
(
_end_time
-
_start_time
);
...
...
src/statistics/DrawVDiagram.hpp
View file @
be838038
...
...
@@ -143,17 +143,15 @@ public:
// Draw the stats
for
(
std
::
map
<
const
EntityValue
*
,
stats
*>::
iterator
it
=
temp_states
.
begin
();
it
!=
temp_states
.
end
();
it
++
)
{
for
(
auto
&
temp_state
:
temp_states
)
{
// We have to convert the percentage in a rectangle and print it
const
double
length
=
(
*
it
)
.
second
->
_total_length
;
const
double
length
=
temp_state
.
second
->
_total_length
;
const
double
height
=
length
*
100.
*
this
->
_percentage_height_default
/
(
this
->
_end_time
-
this
->
_start_time
);
// We search for a color
if
(
(
*
it
).
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
!=
(
*
it
)
.
first
->
get_extra_fields
()
->
end
())
{
const
Color
*
color
=
(
const
Color
*
)
(
*
it
)
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
->
second
;
if
(
temp_state
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
!=
temp_state
.
first
->
get_extra_fields
()
->
end
())
{
const
Color
*
color
=
(
const
Color
*
)
temp_state
.
first
->
get_extra_fields
()
->
find
(
std
::
string
(
"Color"
))
->
second
;
draw_object
->
draw_rect
(
pos_x
,
pos_y
,
_WIDTH_HISTOGRAM_DEFAULT
,
height
/
max_percentage
,
color
->
get_red
(),
color
->
get_green
(),
color
->
get_blue
());
}
else
{
...
...
src/statistics/Statistic.cpp
View file @
be838038
...
...
@@ -64,10 +64,8 @@ Statistic::Statistic(){
Statistic
::~
Statistic
(){
// Delete states
for
(
map
<
const
EntityValue
*
,
stats
*>::
iterator
it
=
_states
.
begin
();
it
!=
_states
.
end
();
it
++
)
{
delete
(
*
it
).
second
;
for
(
auto
&
_state
:
_states
)
{
delete
_state
.
second
;
}
}
...
...
src/statistics/Stats_window.cpp
View file @
be838038
...
...
@@ -111,11 +111,9 @@ void Stats_window::set_container_names() {
QList
<
QTreeWidgetItem
*>
items
;
QFlags
<
Qt
::
ItemFlag
>
flg
=
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsTristate
;
for
(
Container
::
VectorIt
it
=
root_containers
->
begin
();
it
!=
root_containers
->
end
();
it
++
)
{
string
name
=
(
*
it
)
->
get_name
();
string
alias
=
(
*
it
)
->
get_alias
();
for
(
const
auto
&
root_container
:
*
root_containers
)
{
string
name
=
root_container
->
get_name
();
string
alias
=
root_container
->
get_alias
();
QStringList
str_name
(
QString
::
fromStdString
(
name
));
QString
str_alias
(
QString
::
fromStdString
(
alias
));
QTreeWidgetItem
*
current_node
=
new
QTreeWidgetItem
((
QTreeWidgetItem
*
)
nullptr
,
str_name
);
...
...
@@ -126,7 +124,7 @@ void Stats_window::set_container_names() {
items
.
append
(
current_node
);
// Recursivity to add the children names
set_container_names_rec
(
current_node
,
(
*
it
)
);
set_container_names_rec
(
current_node
,
root_container
);
}
(
*
(
items
.
begin
()))
->
setExpanded
(
true
);
...
...
@@ -137,20 +135,18 @@ void Stats_window::set_container_names_rec(QTreeWidgetItem *current_node, Contai
const
Container
::
Vector
*
children
=
current_container
->
get_children
();
QFlags
<
Qt
::
ItemFlag
>
flg
=
Qt
::
ItemIsUserCheckable
|
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsEnabled
|
Qt
::
ItemIsTristate
;
for
(
Container
::
VectorIt
it
=
children
->
begin
();
it
!=
children
->
end
();
it
++
)
for
(
const
auto
&
it
:
*
children
)
{
// We create the node and we do the recursivity
string
name
=
(
*
it
)
->
get_name
();
string
alias
=
(
*
it
)
->
get_alias
();
string
name
=
it
->
get_name
();
string
alias
=
it
->
get_alias
();
QStringList
str_name
(
QString
::
fromStdString
(
name
));
QString
str_alias
(
QString
::
fromStdString
(
alias
));
QTreeWidgetItem
*
node
=
new
QTreeWidgetItem
(
current_node
,
str_name
);
node
->
setFlags
(
flg
);
node
->
setCheckState
(
0
,
Qt
::
Checked
);
node
->
setText
(
1
,
str_alias
);
set_container_names_rec
(
node
,
(
*
it
)
);
set_container_names_rec
(
node
,
it
);
}
}
...
...
src/trace/Container.cpp
View file @
be838038
...
...
@@ -134,10 +134,8 @@ Container::~Container()
_links
.
pop_front
();
}
// Delete variables
for
(
map
<
VariableType
*
,
Variable
*>::
iterator
it
=
_variables
.
begin
();
it
!=
_variables
.
end
();
it
++
){
delete
(
*
it
).
second
;
for
(
auto
&
_variable
:
_variables
){
delete
_variable
.
second
;
}
_variables
.
clear
();
#endif
...
...
src/trace/DrawTrace.hpp
View file @
be838038
...
...
@@ -209,11 +209,9 @@ public:
std
::
stack
<
Container
*>
containers
;
const
Container
::
Vector
*
root_containers
=
trace
->
get_view_root_containers
();
if
(
root_containers
->
empty
())
root_containers
=
trace
->
get_root_containers
();
for
(
Container
::
VectorIt
i
=
root_containers
->
begin
();
i
!=
root_containers
->
end
();
i
++
){
containers
.
push
(
*
i
);
container
->
push_back
(
*
i
);
for
(
const
auto
&
root_container
:
*
root_containers
){
containers
.
push
(
root_container
);
container
->
push_back
(
root_container
);
}
add
(
container
,
&
containers
);
...
...
@@ -282,12 +280,10 @@ public:
*
Message
::
get_instance
()
<<
QObject
::
tr
(
"There is no container. The trace can not be drawn."
).
toStdString
()
<<
Message
::
endw
;
}
else
{
for
(
Container
::
VectorIt
i
=
root_containers
->
begin
();
i
!=
root_containers
->
end
();
i
++
)
for
(
const
auto
&
root_container
:
*
root_containers
)
// Use the fact that if a container is selected, then it implies that all his ancestors are
if
(
is_in_set
(
*
i
,
container
))
y
+=
browse_container
(
draw_object
,
*
i
,
0.
,
y
,
_container_width
,
0.
,
container
)
+
_container_v_space
;
if
(
is_in_set
(
root_container
,
container
))
y
+=
browse_container
(
draw_object
,
root_container
,
0.
,
y
,
_container_width
,
0.
,
container
)
+
_container_v_space
;
}
}
/* end browse_container_tree */
...
...
@@ -310,10 +306,8 @@ public:
children
=
container
->
get_children
();
/*if(!children.empty())
h = 0.;*/
for
(
Container
::
VectorIt
i
=
children
->
begin
();
i
!=
children
->
end
();
i
++
)
{
h
+=
browse_container
(
draw_object
,
(
*
i
),
x
+
_container_width
+
_container_h_space
,
y
+
h
,
_container_width
,
0.
,
set_container
)
+
_container_v_space
;
for
(
const
auto
&
i
:
*
children
)
{
h
+=
browse_container
(
draw_object
,
i
,
x
+
_container_width
+
_container_h_space
,
y
+
h
,
_container_width
,
0.
,
set_container
)
+
_container_v_space
;
}
// h -= _container_v_space;
...
...
@@ -452,13 +446,8 @@ public:
// Browse links
link_list
=
container
->
get_links
();
for
(
Link
::
VectorIt
it
=
link_list
->
begin
();
it
!=
link_list
->
end
();
it
++
)
{
link
=
*
it
;
for
(
const
auto
&
it
:
*
link_list
)
{
link
=
it
;
EntityValue
*
value
=
link
->
get_value
();
assert
(
value
);
const
Color
*
color
=
value
->
get_used_color
();
...
...
@@ -521,11 +510,9 @@ public:
// Browse variables
variable_map
=
container
->
get_variables
();
for
(
std
::
map
<
VariableType
*
,
Variable
*>::
const_iterator
i
=
variable_map
->
begin
();
i
!=
variable_map
->
end
();
i
++
)
{
for
(
const
auto
&
i
:
*
variable_map
)
{
var
=
(
*
i
)
.
second
;
var
=
i
.
second
;
double
min
=
var
->
get_min
().
get_value
();
double
max
=
var
->
get_max
().
get_value
();
variable_values
=
var
->
get_values
();
...
...
@@ -537,14 +524,12 @@ public:
draw_object
->
draw_text_value
((
long
int
)
var
,
0.0
,
position
+
0.5
*
_container_height
+
_container_v_space
/
2
);
_var_positions
[
var
]
=
position
;
draw_variable_value
(
draw_object
,
0.0
,
0.0
,
position
);
for
(
std
::
list
<
std
::
pair
<
Date
,
Double
>
>::
const_iterator
value
=
variable_values
->
begin
();
value
!=
variable_values
->
end
();
value
++
)
{
for
(
const
auto
&
variable_value
:
*
variable_values
)
{
/* Call the object state drawing function.
We pass the first value if correspond to the beginning */
first_value
=
(
*
value
)
.
first
.
get_value
();
second_value
=
(
(
*
value
)
.
second
.
get_value
()
-
min
)
/
(
max
-
min
)
;
first_value
=
variable_value
.
first
.
get_value
();
second_value
=
(
variable_value
.
second
.
get_value
()
-
min
)
/
(
max
-
min
)
;
if
(
!
(
first_value
==
0.
&&
second_value
==
0.
))
{
draw_variable_value
(
draw_object
,
first_value
,
second_value
,
position
);
}
...
...
@@ -617,10 +602,8 @@ public:
const
Container
::
Vector
*
root_containers
=
trace
->
get_view_root_containers
();
if
(
root_containers
->
empty
())
root_containers
=
trace
->
get_root_containers
();
if
(
!
root_containers
->
empty
())
for
(
Container
::
VectorIt
i
=
root_containers
->
begin
();
i
!=
root_containers
->
end
();