} else {
code = ReplaceAll(CB_UNIT_IMPL_DESERIALIZER_BASE)
.Change("<TYPE>", ConvertTypeToString(type))
- .Change("<PARCEL_TYPE>", GetParcelType(type));
+ .Change("<PARCEL_TYPE>", GetParcelType(type))
+ .Change("<SET_INIT_VALUE>", GetSettingInitValue(type));
}
return RemoveLine(code);
for (auto& elm : st.GetElements()) {
code += ReplaceAll(CB_UNIT_MAP_BASE_READ)
.Change("<TYPE>", ConvertTypeToString(elm->GetType()))
- .Change("<NAME>", elm->GetID());
+ .Change("<NAME>", elm->GetID())
+ .Change("<SET_INIT_VALUE>", GetSettingInitValue(elm->GetType()));
}
return code;
/**
* <NAME> The name of the element of the value.
+ * <SET_INIT_VALUE> The setting initialization value.
*/
constexpr const char CB_UNIT_MAP_BASE_READ[] =
R"__cpp_cb(
-<TYPE> tmp_<NAME>;
+<TYPE> tmp_<NAME><SET_INIT_VALUE>;
unit_map.Read("<NAME>", tmp_<NAME>);
value.Set<NAME>(tmp_<NAME>);
)__cpp_cb";
/**
* <TYPE> The type of the parameter.
* <PARCEL_TYPE> The type of the parcel type of the parameter.
+ * <SET_INIT_VALUE> The setting initialization value.
*/
constexpr const char CB_UNIT_IMPL_DESERIALIZER_BASE[] =
R"__cpp_cb(
-<TYPE> tmp_value;
+<TYPE> tmp_value<SET_INIT_VALUE>;
rpc_port_parcel_read_<PARCEL_TYPE>(GetParcel(), &tmp_value);
value = tmp_value;
)__cpp_cb";
*/
constexpr const char CB_UNIT_IMPL_DESERIALIZER_ENUM[] =
R"__cpp_cb(
-int tmp_value;
+int tmp_value = -1;
rpc_port_parcel_read_int32(GetParcel(), &tmp_value);
value = static_cast<<TYPE>>(tmp_value);
)__cpp_cb";