Commit bd8f50f0 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

core: fix warnings

parent ae297e6f
...@@ -709,6 +709,8 @@ struct message ...@@ -709,6 +709,8 @@ struct message
return static_cast<double>(to_real_32(i)); return static_cast<double>(to_real_32(i));
case value_type::real_64: case value_type::real_64:
return static_cast<double>(to_real_64(i)); return static_cast<double>(to_real_64(i));
default:
return 0.0;
} }
return 0.0; return 0.0;
...@@ -4390,8 +4392,9 @@ struct simulation ...@@ -4390,8 +4392,9 @@ struct simulation
{ {
return dispatch( return dispatch(
mdl.type, mdl.type,
[dyn_id = mdl.id, port, index]<typename DynamicsM>( [ dyn_id = mdl.id, port,
DynamicsM& dyn_models) -> status { index ]<typename DynamicsM>(DynamicsM & dyn_models)
->status {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_output_port_t, Dynamics>) { if constexpr (is_detected_v<has_output_port_t, Dynamics>) {
...@@ -4415,8 +4418,8 @@ struct simulation ...@@ -4415,8 +4418,8 @@ struct simulation
{ {
dispatch( dispatch(
mdl.type, mdl.type,
[this, &f, dyn_id = mdl.id]<typename DynamicsM>( [ this, &f, dyn_id = mdl.id ]<typename DynamicsM>(DynamicsM &
DynamicsM& dyn_models) { dyn_models) {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_input_port_t, Dynamics>) { if constexpr (is_detected_v<has_input_port_t, Dynamics>) {
...@@ -4435,8 +4438,8 @@ struct simulation ...@@ -4435,8 +4438,8 @@ struct simulation
{ {
dispatch( dispatch(
mdl.type, mdl.type,
[this, &f, dyn_id = mdl.id]<typename DynamicsM>( [ this, &f, dyn_id = mdl.id ]<typename DynamicsM>(DynamicsM &
DynamicsM& dyn_models) { dyn_models) {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_output_port_t, Dynamics>) { if constexpr (is_detected_v<has_output_port_t, Dynamics>) {
...@@ -4457,8 +4460,9 @@ struct simulation ...@@ -4457,8 +4460,9 @@ struct simulation
{ {
return dispatch( return dispatch(
mdl.type, mdl.type,
[dyn_id = mdl.id, port, index]<typename DynamicsM>( [ dyn_id = mdl.id, port,
DynamicsM& dyn_models) -> status { index ]<typename DynamicsM>(DynamicsM & dyn_models)
->status {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_input_port_t, Dynamics>) { if constexpr (is_detected_v<has_input_port_t, Dynamics>) {
...@@ -4483,15 +4487,17 @@ struct simulation ...@@ -4483,15 +4487,17 @@ struct simulation
{ {
return dispatch( return dispatch(
mdl.type, mdl.type,
[dyn_id = mdl.id, index, port]<typename DynamicsM>( [ dyn_id = mdl.id, index,
DynamicsM& dyn_models) -> status { port ]<typename DynamicsM>(DynamicsM & dyn_models)
->status {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_output_port_t, Dynamics>) { if constexpr (is_detected_v<has_output_port_t, Dynamics>) {
auto* dyn = dyn_models.try_to_get(dyn_id); auto* dyn = dyn_models.try_to_get(dyn_id);
irt_return_if_fail(dyn, status::dynamics_unknown_id); irt_return_if_fail(dyn, status::dynamics_unknown_id);
irt_return_if_fail(0 <= index && static_cast<size_t>(index) < irt_return_if_fail(0 <= index &&
static_cast<size_t>(index) <
std::size(dyn->y), std::size(dyn->y),
status::dynamics_unknown_port_id); status::dynamics_unknown_port_id);
...@@ -4509,15 +4515,17 @@ struct simulation ...@@ -4509,15 +4515,17 @@ struct simulation
{ {
return dispatch( return dispatch(
mdl.type, mdl.type,
[dyn_id = mdl.id, index, port]<typename DynamicsM>( [ dyn_id = mdl.id, index,
DynamicsM& dyn_models) -> status { port ]<typename DynamicsM>(DynamicsM & dyn_models)
->status {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
if constexpr (is_detected_v<has_input_port_t, Dynamics>) { if constexpr (is_detected_v<has_input_port_t, Dynamics>) {
auto* dyn = dyn_models.try_to_get(dyn_id); auto* dyn = dyn_models.try_to_get(dyn_id);
irt_return_if_fail(dyn, status::dynamics_unknown_id); irt_return_if_fail(dyn, status::dynamics_unknown_id);
irt_return_if_fail(0 <= index && static_cast<size_t>(index) < irt_return_if_fail(0 <= index &&
static_cast<size_t>(index) <
std::size(dyn->x), std::size(dyn->x),
status::dynamics_unknown_port_id); status::dynamics_unknown_port_id);
...@@ -4621,8 +4629,9 @@ public: ...@@ -4621,8 +4629,9 @@ public:
auto ret = dispatch( auto ret = dispatch(
mdl->type, mdl->type,
[this, &mdl, copy]<typename DynamicsM>( [ this, &mdl,
DynamicsM& dynamics_models) -> status { copy ]<typename DynamicsM>(DynamicsM & dynamics_models)
->status {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
irt_return_if_fail(dynamics_models.can_alloc(1), irt_return_if_fail(dynamics_models.can_alloc(1),
...@@ -4662,8 +4671,8 @@ public: ...@@ -4662,8 +4671,8 @@ public:
auto ret = dispatch( auto ret = dispatch(
mdl->type, mdl->type,
[this, model_it, first, last, out]<typename DynamicsM>( [ this, model_it, first, last,
DynamicsM& dynamics_models) { out ]<typename DynamicsM>(DynamicsM & dynamics_models) {
using Dynamics = typename DynamicsM::value_type; using Dynamics = typename DynamicsM::value_type;
auto* mdl_src = this->models.try_to_get(*(first + model_it)); auto* mdl_src = this->models.try_to_get(*(first + model_it));
...@@ -5154,7 +5163,8 @@ public: ...@@ -5154,7 +5163,8 @@ public:
{ {
return dispatch( return dispatch(
mdl.type, mdl.type,
[this, &mdl, t]<typename DynamicsModels>(DynamicsModels& dyn_models) { [ this, &mdl,
t ]<typename DynamicsModels>(DynamicsModels & dyn_models) {
return this->make_initialize(mdl, dyn_models.get(mdl.id), t); return this->make_initialize(mdl, dyn_models.get(mdl.id), t);
}); });
} }
...@@ -5220,11 +5230,11 @@ public: ...@@ -5220,11 +5230,11 @@ public:
time t, time t,
flat_list<output_port_id>& o) noexcept flat_list<output_port_id>& o) noexcept
{ {
return dispatch(mdl.type, return dispatch(
[this, &mdl, t, &o]<typename DynamicsModels>( mdl.type,
DynamicsModels& dyn_models) { [ this, &mdl, t, &
return this->make_transition( o ]<typename DynamicsModels>(DynamicsModels & dyn_models) {
mdl, dyn_models.get(mdl.id), t, o); return this->make_transition(mdl, dyn_models.get(mdl.id), t, o);
}); });
} }
}; };
......
Markdown is supported
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