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
f4e1aa6a
Commit
f4e1aa6a
authored
Mar 06, 2009
by
Clément Vuchener
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compteurs
parent
132e80c8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
157 additions
and
17 deletions
+157
-17
src/src.pro
src/src.pro
+2
-0
src/trace/Container.cpp
src/trace/Container.cpp
+60
-4
src/trace/Container.hpp
src/trace/Container.hpp
+43
-2
src/trace/DrawTrace.hpp
src/trace/DrawTrace.hpp
+25
-1
src/trace/StateType.hpp
src/trace/StateType.hpp
+0
-3
src/trace/Trace.cpp
src/trace/Trace.cpp
+8
-4
src/trace/Trace.hpp
src/trace/Trace.hpp
+2
-3
src/trace/values/Double.cpp
src/trace/values/Double.cpp
+13
-0
src/trace/values/Double.hpp
src/trace/values/Double.hpp
+4
-0
No files found.
src/src.pro
View file @
f4e1aa6a
...
...
@@ -47,6 +47,7 @@ HEADERS += main_resource.hpp \
trace
/
StateType
.
hpp
\
trace
/
Link
.
hpp
\
trace
/
LinkType
.
hpp
\
trace
/
VariableType
.
hpp
\
trace
/
Trace
.
hpp
\
trace
/
values
/
Color
.
hpp
\
trace
/
values
/
Date
.
hpp
\
...
...
@@ -87,6 +88,7 @@ SOURCES += main.cpp \
trace
/
StateType
.
cpp
\
trace
/
Link
.
cpp
\
trace
/
Linktype
.
cpp
\
trace
/
VariableType
.
cpp
\
trace
/
Trace
.
cpp
\
trace
/
values
/
Color
.
cpp
\
trace
/
values
/
Date
.
cpp
\
...
...
src/trace/Container.cpp
View file @
f4e1aa6a
...
...
@@ -2,7 +2,7 @@
#include <iostream>
Container
::
Container
(
Name
name
,
Date
creation_time
,
ContainerType
*
type
,
Container
*
parent
)
:
_name
(
name
),
_creation_time
(
creation_time
),
_type
(
type
),
_parent
(
parent
)
{
_name
(
name
),
_creation_time
(
creation_time
),
_type
(
type
),
_parent
(
parent
)
,
_n_variables
(
0
)
{
}
template
<
class
T
>
...
...
@@ -23,6 +23,16 @@ Container::~Container() {
// Delete events
clear_list
<
Event
>
(
_events
);
// Delete links
clear_list
<
Link
>
(
_links
);
// Delete variables
for
(
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>::
iterator
it
=
_variables
.
begin
();
it
!=
_variables
.
end
();
it
++
)
{
delete
(
*
it
).
second
;
}
}
void
Container
::
add_child
(
Container
*
child
)
{
...
...
@@ -89,6 +99,44 @@ void Container::end_link(Date time, Container *destination, String key) {
(
*
i
).
second
.
value
));
_current_links
.
erase
(
i
);
}
void
Container
::
set_variable
(
Date
time
,
VariableType
*
type
,
Double
value
)
{
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>::
iterator
i
=
_variables
.
find
(
type
);
if
(
i
==
_variables
.
end
())
{
_variables
[
type
]
=
new
list
<
pair
<
Date
,
Double
>
>
;
_variables
[
type
]
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
value
));
_n_variables
++
;
}
else
{
(
*
i
).
second
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
value
));
}
}
void
Container
::
add_variable
(
Date
time
,
VariableType
*
type
,
Double
value
)
{
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>::
iterator
i
=
_variables
.
find
(
type
);
if
(
i
==
_variables
.
end
())
{
_variables
[
type
]
=
new
list
<
pair
<
Date
,
Double
>
>
;
_variables
[
type
]
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
value
));
_n_variables
++
;
}
else
{
(
*
i
).
second
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
(
*
i
).
second
->
back
().
second
+
value
));
}
}
void
Container
::
sub_variable
(
Date
time
,
VariableType
*
type
,
Double
value
)
{
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>::
iterator
i
=
_variables
.
find
(
type
);
if
(
i
==
_variables
.
end
())
{
_variables
[
type
]
=
new
list
<
pair
<
Date
,
Double
>
>
;
_variables
[
type
]
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
-
value
));
_n_variables
++
;
}
else
{
(
*
i
).
second
->
push_back
(
pair
<
Date
,
Double
>
(
time
,
(
*
i
).
second
->
back
().
second
-
value
));
}
}
Name
Container
::
get_name
()
const
{
return
_name
;
...
...
@@ -115,15 +163,23 @@ Date Container::get_destruction_time() const {
}
const
list
<
State
*>
*
Container
::
get_states
()
const
{
return
&
_states
;
return
&
_states
;
}
const
list
<
Event
*>
*
Container
::
get_events
()
const
{
return
&
_events
;
return
&
_events
;
}
const
list
<
Link
*>
*
Container
::
get_links
()
const
{
return
&
_links
;
return
&
_links
;
}
const
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>
*
Container
::
get_variables
()
const
{
return
&
_variables
;
}
int
Container
::
get_variable_number
()
const
{
return
_n_variables
;
}
void
Container
::
destroy
(
const
Date
&
time
)
{
...
...
src/trace/Container.hpp
View file @
f4e1aa6a
...
...
@@ -16,9 +16,9 @@ using std::list;
using
std
::
map
;
#include <stack>
using
std
::
stack
;
using
std
::
pair
;
#include "values/Name.hpp"
#include "values/Date.hpp"
#include "values/Values.hpp"
#include "ContainerType.hpp"
...
...
@@ -28,6 +28,8 @@ class Container;
#include "Event.hpp"
#include "Link.hpp"
#include "VariableType.hpp"
#define STATE_STACK_SIZE 16
/*!
...
...
@@ -47,6 +49,8 @@ private:
list
<
State
*>
_states
;
list
<
Event
*>
_events
;
list
<
Link
*>
_links
;
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>
_variables
;
int
_n_variables
;
/*
* Temporary stores states before complete definition
...
...
@@ -124,6 +128,27 @@ public:
*/
void
end_link
(
Date
time
,
Container
*
destination
,
String
key
);
/*!
*
* \fn set_variable(Date time, VariableType *type, Double value)
*
*/
void
set_variable
(
Date
time
,
VariableType
*
type
,
Double
value
);
/*!
*
* \fn add_variable(Date time, VariableType *type, Double value)
*
*/
void
add_variable
(
Date
time
,
VariableType
*
type
,
Double
value
);
/*!
*
* \fn set_variable(Date time, VariableType *type, Double value)
*
*/
void
sub_variable
(
Date
time
,
VariableType
*
type
,
Double
value
);
/*!
*
* \fn get_name() const
...
...
@@ -196,6 +221,22 @@ public:
*/
const
list
<
Link
*>
*
get_links
()
const
;
/*!
*
* \fn get_variables() const
* \brief Returns the variables
*
*/
const
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>
*
get_variables
()
const
;
/*!
*
* \fn get_variable_number() const
* \brief Returns the number of variables
*
*/
int
get_variable_number
()
const
;
/*!
*
* \fn destroy(const Date &time)
...
...
src/trace/DrawTrace.hpp
View file @
f4e1aa6a
...
...
@@ -206,7 +206,8 @@ public:
if
(
0
==
number_of_children
(
container
))
{
/* y contains the current height, y_buf the new adding height */
y_buf
=
_container_height
+
_container_v_space
;
int
n
=
container
->
get_variable_number
();
y_buf
=
(
1
+
n
)
*
(
_container_height
+
_container_v_space
);
height_stack
.
push
(
y_buf
);
y
+=
y_buf
;
...
...
@@ -294,6 +295,8 @@ public:
Event
*
event
;
const
list
<
Link
*>
*
link_list
;
Link
*
link
;
const
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>
*
variable_map
;
list
<
pair
<
Date
,
Double
>
>
*
variable_values
;
const
map
<
std
::
string
,
Value
*>
*
extra_fields
;
const
Color
*
color
;
Element_count
i
;
/* for the level (y axis) of the states */
...
...
@@ -339,6 +342,27 @@ public:
draw_object
->
draw_event
(
event
->
get_time
().
get_value
(),
base
,
_state_height
);
}
/* end for */
// Browse events
variable_map
=
container
->
get_variables
();
for
(
map
<
VariableType
*
,
list
<
pair
<
Date
,
Double
>
>
*>::
const_iterator
it
=
variable_map
->
begin
();
it
!=
variable_map
->
end
();
it
++
)
{
i
++
;
// Variable are on another line
variable_values
=
(
*
it
).
second
;
draw_object
->
start_draw_counter
();
for
(
list
<
pair
<
Date
,
Double
>
>::
const_iterator
value
=
variable_values
->
begin
();
value
!=
variable_values
->
end
();
value
++
)
{
Element_pos
base
=
((
Element_pos
)
i
)
*
(
_container_height
+
_container_v_space
)
+
_container_v_space
+
(
*
value
).
second
.
get_value
();
/* Call the object state drawing function */
draw_object
->
draw_counter
((
*
value
).
first
.
get_value
(),
base
);
}
draw_object
->
end_draw_counter
();
}
/* end for */
/* next container */
_leaf_containers
.
pop
();
i
++
;
...
...
src/trace/StateType.hpp
View file @
f4e1aa6a
...
...
@@ -12,9 +12,6 @@ class StateType;
#include "EntityType.hpp"
#include "values/Name.hpp"
#include "ContainerType.hpp"
/*!
*
*\class StateType
...
...
src/trace/Trace.cpp
View file @
f4e1aa6a
...
...
@@ -51,7 +51,8 @@ void Trace::define_state_type(Name &name, ContainerType *container_type, const m
}
void
Trace
::
define_variable_type
(
Name
&
name
,
ContainerType
*
container_type
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
if
(
container_type
)
_variable_types
.
push_back
(
new
VariableType
(
name
,
container_type
));
}
void
Trace
::
define_link_type
(
Name
&
name
,
ContainerType
*
ancestor
,
ContainerType
*
source
,
ContainerType
*
destination
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
...
...
@@ -85,15 +86,18 @@ void Trace::new_event(Date &time, EventType *type, Container *container, EntityV
}
void
Trace
::
set_variable
(
Date
&
time
,
VariableType
*
type
,
Container
*
container
,
Double
value
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
if
(
container
)
container
->
set_variable
(
time
,
type
,
value
);
}
void
Trace
::
add_variable
(
Date
&
time
,
VariableType
*
type
,
Container
*
container
,
Double
value
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
if
(
container
)
container
->
add_variable
(
time
,
type
,
value
);
}
void
Trace
::
sub_variable
(
Date
&
time
,
VariableType
*
type
,
Container
*
container
,
Double
value
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
if
(
container
)
container
->
sub_variable
(
time
,
type
,
value
);
}
void
Trace
::
start_link
(
Date
&
time
,
LinkType
*
type
,
Container
*
ancestor
,
Container
*
source
,
EntityValue
*
value
,
String
key
,
const
map
<
std
::
string
,
Value
*>
&
opt
)
{
...
...
src/trace/Trace.hpp
View file @
f4e1aa6a
...
...
@@ -30,14 +30,12 @@ using std::vector;
#include "StateType.hpp"
#include "EventType.hpp"
#include "LinkType.hpp"
#include "VariableType.hpp"
#include "EntityValue.hpp"
#include "State.hpp"
#include "Event.hpp"
#include "Link.hpp"
class
VariableType
;
class
LinkType
;
/*!
*
* \class Trace
...
...
@@ -52,6 +50,7 @@ private:
list
<
StateType
*>
_state_types
;
list
<
EventType
*>
_event_types
;
list
<
LinkType
*>
_link_types
;
list
<
VariableType
*>
_variable_types
;
public
:
...
...
src/trace/values/Double.cpp
View file @
f4e1aa6a
...
...
@@ -47,3 +47,16 @@ std::string Double::to_string() const{
double
Double
::
get_value
()
const
{
return
_value
;
}
Double
Double
::
operator
+
(
const
Double
&
d
)
{
return
Double
(
_value
+
d
.
_value
);
}
Double
Double
::
operator
-
()
{
return
Double
(
-
_value
);
}
Double
Double
::
operator
-
(
const
Double
&
d
)
{
return
Double
(
_value
-
d
.
_value
);
}
src/trace/values/Double.hpp
View file @
f4e1aa6a
...
...
@@ -60,6 +60,10 @@ public:
*
*/
double
get_value
()
const
;
Double
operator
+
(
const
Double
&
);
Double
operator
-
();
Double
operator
-
(
const
Double
&
);
};
#endif // DOUBLE_HPP
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment