Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gauthier Quesnel
irritator
Commits
9c20112d
Commit
9c20112d
authored
Apr 29, 2020
by
Gauthier Quesnel
Browse files
gui: fix plot output for integer8/32/64
parent
11af0c74
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/gui/node-editor.cpp
View file @
9c20112d
...
...
@@ -85,7 +85,7 @@ observation_output_observe(const irt::observer& obs,
return
;
auto
*
output
=
reinterpret_cast
<
observation_output
*>
(
obs
.
user_data
);
const
auto
value
=
static_cast
<
float
>
(
msg
.
to_real_64
(
0
));
const
auto
value
=
static_cast
<
float
>
(
msg
.
cast_
to_real_64
(
0
));
if
(
output
->
observation_type
==
observation_output
::
type
::
plot
||
output
->
observation_type
==
observation_output
::
type
::
both
)
{
...
...
lib/include/irritator/core.hpp
View file @
9c20112d
...
...
@@ -684,6 +684,28 @@ struct message
return
real_64
[
i
];
}
template
<
typename
T
>
constexpr
double
cast_to_real_64
(
T
i
)
const
{
if
constexpr
(
std
::
is_signed_v
<
T
>
)
assert
(
i
>=
0
);
switch
(
type
)
{
case
value_type
::
integer_8
:
return
static_cast
<
double
>
(
to_integer_8
(
i
));
case
value_type
::
integer_32
:
return
static_cast
<
double
>
(
to_integer_32
(
i
));
case
value_type
::
integer_64
:
return
static_cast
<
double
>
(
to_integer_64
(
i
));
case
value_type
::
real_32
:
return
static_cast
<
double
>
(
to_real_32
(
i
));
case
value_type
::
real_64
:
return
static_cast
<
double
>
(
to_real_64
(
i
));
}
return
0.0
;
}
};
/*****************************************************************************
...
...
@@ -3254,12 +3276,12 @@ struct counter
model_id
id
;
input_port_id
x
[
1
];
time
sigma
;
long
unsigned
number
;
i64
number
;
status
initialize
(
data_array
<
message
,
message_id
>&
/*init_messages*/
)
noexcept
{
number
=
0ul
;
number
=
{
0
}
;
sigma
=
time_domain
<
time
>::
infinity
;
return
status
::
success
;
...
...
@@ -3275,16 +3297,11 @@ struct counter
diff
+=
std
::
distance
(
std
::
begin
(
port
->
messages
),
std
::
end
(
port
->
messages
));
number
+=
static_cast
<
long
unsigned
>
(
diff
);
number
+=
static_cast
<
i64
>
(
diff
);
return
status
::
success
;
}
status
internal
(
time
/*t*/
)
noexcept
{
return
status
::
success
;
}
message
observation
(
time
/*t*/
)
const
noexcept
{
return
message
(
number
);
...
...
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