Commit 8df4a270 authored by Tomas Härdin's avatar Tomas Härdin

Started pondering how to struct-ify fmitcp_proto::fmi2_kinematic_req

parent be3a9b47
Pipeline #1094 passed with stages
in 50 minutes and 55 seconds
......@@ -77,6 +77,9 @@ namespace fmitcp {
#define DONT_FILTER_OUTGOING_VRS 1
#endif
//whether to structify fmi2_kinematic_req/res
#define USE_KINEMATIC_STRUCT 0
typedef std::unordered_set<int> int_set;
struct do_step_s {
......
......@@ -1433,9 +1433,18 @@ string Server::clientDataInner(const char *data, size_t size) {
break; } case fmitcp_proto::type_fmi2_kinematic_req: {
fmitcp_proto::fmi2_kinematic_req r; r.ParseFromArray(data, size);
fmi2_status_t status = fmi2_status_ok;
fmitcp_proto::fmi2_kinematic_res response;
#if USE_KINEMATIC_STRUCT == 1
if (sizeof(size_t) <= sizeof(int32_t)) {
fatal("sizeof(size_t) <= sizeof(int32_t)\n");
}
size_t n = size / (sizeof(fmi2_value_reference_t) + sizeof(fmi2_real_t));
fmi2_value_reference_t *vr = (fmi2_value_reference_t*)data;
fmi2_real_t *value = (fmi2_real_t*)&vr[n];
#else
fmitcp_proto::fmi2_kinematic_req r; r.ParseFromArray(data, size);
debug("fmi2_kinematic_req: %i %i %i %i %i %i\n",
r.has_reals() ? r.reals().values_size() : 0,
......@@ -1518,6 +1527,7 @@ bork:
response.set_status(fmi2StatusToProtofmi2Status(status));
ret.first = fmitcp_proto::type_fmi2_kinematic_res;
ret.second = response.SerializeAsString();
#endif
break; } case fmitcp_proto::type_get_xml_req: {
......
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