Emit record_replay fromQVariant for plain enums; document PPM MOC exclusion

This commit is contained in:
berrux-dev committed 2026-09-25 20:29:57 +02:00
1 parent a410019553
commit 7659b167d0
3 files changed
+59 -4

No files matched your search

@@ -171,8 +171,20 @@ std::vector<T> fromJson(const QVariant &jsonData, type<std::vector<T>>)
return ret;
}
// Primary fallback for any migrated plain-`enum class` enumerators that have no
// explicit specialization below - most importantly the nested foreign
// ProjectDataManagement / Core enums a plugin reads back from the database (they are
// not in this service's idl_enums, so the per-own-enum specializations do not cover
// them). Giving the primary template a body (rather than leaving it declaration-only)
// is what lets those foreign-enum instantiations resolve, so the plugin .so links. The
// explicit specializations for primitives / own enums / structs / vectors / optionals
// all take precedence over this fallback, so it is only ever instantiated for an enum
// type, where `static_cast<T>(val.toInt())` is the correct conversion.
template<typename T>
T fromQVariant(const QVariant &val, type<T>);
T fromQVariant(const QVariant &val, type<T>)
{
return static_cast<T>(val.toInt());
}
template<>
bool fromQVariant(const QVariant &val, type<bool>)
@@ -266,6 +278,23 @@ T fromQVariant(const QVariant &val)
return fromQVariant(val, type<T>{});
}
// rtiddsgen 7.7 spells the migrated enumerators as plain `enum class` in the service
// namespace (the legacy dds::core::safe_enum<T> wrapper is gone). The record_replay
// plugin still instantiates fromQVariant<Enum>() for each enum member it reads back,
// and none of the generic overloads above are ever deduced for those types, so each of
// this service's own enumerations needs its own explicit specialization. `idl_enums`
// carries the service's own enumerations by local name and this block runs inside
// `namespace {{ namespace }}`, so the local name resolves to the fully-qualified enum
// type. (Nested foreign PDM enumerations are still not covered - same limitation as the
// documented svcBuildings exclusion.)
{% for enumeration in idl_enums %}
template<>
{{ enumeration.name }} fromQVariant(const QVariant &val, type<{{ enumeration.name }}>)
{
return static_cast<{{ enumeration.name }}>(val.toInt());
}
{% endfor %}
{% for dt in serializeTopics.member %}
//
// Begin {{ dt.typeFq }}
@@ -121,7 +121,7 @@ protected:
int64_t m_snapshot{{ dt.name }}MapTime = -1; // time for which the snapshot is valid
{% endif %} {% endfor %}
NGL::INGLLogger* m_logger;
NGL::INGLLogger& m_logger;
};
}
+28 -2
View File
@@ -100,6 +100,33 @@ docker run --rm \
# svcInfrastructureManagement QtCore to the Qt SCXML module in Qt6
# exmStateMachineTest (Qt6::StateMachine). No qt6-scxml-dev in
# the image and qstatemachine.h is absent.
# svcBuildings - its generated record_replay_plugin
# (bld_record_replay_plugin.cpp) calls
# fromQVariant() for the nested foreign
# ProjectDataManagement types
# VulnerabilityState /
# StateChangeOriginator, for which no
# specialization is generated (they are
# not Buildings' own types), leaving the
# generic fromQVariant template
# undefined -> link error.
# svcParticipantManagement - its record_replay custom header
# (RecordReplay/ppm_record_replay_plugin_custom.h)
# declares Q_INTERFACES(RecordReplay::
# RecordReplayPlugin) on a class that also
# inherits ParticipantHandling::BaseDataProvider
# (a second Q_OBJECT base the other record_replay
# custom plugins lack). Qt6's MOC reports
# "Undefined interface" for the Q_INTERFACES in
# that multi-Q_OBJECT-base context (RecordReplay::
# RecordReplayPlugin is a Q_GADGET, not a Q_OBJECT),
# so the plugin autogen step fails before link.
# (The nested-foreign-PDM fromQVariant link error
# that also applied is now resolved by the
# fromQVariant primary-template body added to
# svc_record_replay_plugin.cpp.grantlee.) The PPM
# client/common/server libs still build; only this
# exe is excluded.
make -j8 \
ddscore ddsftccore ddsQoS ddsconnector ddsfts migration_tests \
NGLLogger nglapplication nglcompression nglcoreapplication ngldb \
@@ -112,7 +139,7 @@ docker run --rm \
svcAsmClient svcAsmCommon svcAsmServer svcAssetManagement \
svcAudioVideoManagement \
svcAvmClient svcAvmCommon svcAvmServer \
svcBldClient svcBldCommon svcBldServer svcBuildings \
svcBldClient svcBldCommon svcBldServer \
svcCentralEffectSimulation \
svcCesClient svcCesCommon svcCesDDSCommon svcCesGeoPairingImpl svcCesServer \
svcCmoClient svcCmoCommon svcCmoServer \
@@ -146,7 +173,6 @@ docker run --rm \
svcOreDummy \
svcOscClient svcOscCommon svcOscServer \
svcOssClient svcOssCommon svcOssServer \
svcParticipantManagement \
svcPdmClient svcPdmCommon svcPdmServer svcPedDummy \
svcPpmClient svcPpmCommon svcPpmServer \
svcPreClient svcPreCommon svcPreServer svcProjectDataManagement svcPwsCommon \