Skip to content

Commit f18a1cc

Browse files
committed
refactor: Rename ReadDestValue to ReadDestUpdate
ReadDestUpdate is more consistent with ReadDestEmplace, and should be more descriptive. One is wrapping a destination that has an existing value and can be updated, the other is wrapping a destination that can only be emplaced into.
1 parent 10bb7e4 commit f18a1cc

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

include/mp/proxy-types.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ auto PassField(Priority<1>, TypeList<>, ServerContext& server_context, const Fn&
214214
}
215215

216216
// Destination parameter type that can be passed to ReadField function as an
217-
// alternative to ReadDestValue. It allows the ReadField implementation to call
217+
// alternative to ReadDestUpdate. It allows the ReadField implementation to call
218218
// the provided emplace_fn function with constructor arguments, so it only needs
219219
// to determine the arguments, and can let the emplace function decide how to
220220
// actually construct the read destination object. For example, if a std::string
@@ -274,9 +274,9 @@ auto ReadDestTemp()
274274
//! construct a new value, it just takes a reference to an existing value and
275275
//! assigns a new value to it.
276276
template <typename Value>
277-
struct ReadDestValue
277+
struct ReadDestUpdate
278278
{
279-
ReadDestValue(Value& value) : m_value(value) {}
279+
ReadDestUpdate(Value& value) : m_value(value) {}
280280

281281
//! Simple case. If ReadField works by calling update() just forward arguments to update_fn.
282282
template <typename UpdateFn>
@@ -310,7 +310,7 @@ decltype(auto) CustomReadField(TypeList<std::optional<LocalType>>,
310310
if (!input.has()) {
311311
value.reset();
312312
} else if (value) {
313-
ReadField(TypeList<LocalType>(), invoke_context, input, ReadDestValue(*value));
313+
ReadField(TypeList<LocalType>(), invoke_context, input, ReadDestUpdate(*value));
314314
} else {
315315
ReadField(TypeList<LocalType>(), invoke_context, input,
316316
ReadDestEmplace(TypeList<LocalType>(), [&](auto&&... args) -> auto& {
@@ -332,7 +332,7 @@ decltype(auto) CustomReadField(TypeList<std::shared_ptr<LocalType>>,
332332
if (!input.has()) {
333333
value.reset();
334334
} else if (value) {
335-
ReadField(TypeList<LocalType>(), invoke_context, input, ReadDestValue(*value));
335+
ReadField(TypeList<LocalType>(), invoke_context, input, ReadDestUpdate(*value));
336336
} else {
337337
ReadField(TypeList<LocalType>(), invoke_context, input,
338338
ReadDestEmplace(TypeList<LocalType>(), [&](auto&&... args) -> auto& {
@@ -352,7 +352,7 @@ decltype(auto) CustomReadField(TypeList<LocalType*>,
352352
{
353353
return read_dest.update([&](auto& value) {
354354
if (value) {
355-
ReadField(TypeList<LocalType>(), invoke_context, std::forward<Input>(input), ReadDestValue(*value));
355+
ReadField(TypeList<LocalType>(), invoke_context, std::forward<Input>(input), ReadDestUpdate(*value));
356356
}
357357
});
358358
}
@@ -492,9 +492,9 @@ decltype(auto) CustomReadField(TypeList<std::tuple<KeyLocalType, ValueLocalType>
492492
using Struct = ProxyStruct<typename Decay<decltype(pair)>::Reads>;
493493
using Accessors = typename Struct::Accessors;
494494
ReadField(TypeList<KeyLocalType>(), invoke_context, Make<StructField, std::tuple_element_t<0, Accessors>>(pair),
495-
ReadDestValue(std::get<0>(value)));
495+
ReadDestUpdate(std::get<0>(value)));
496496
ReadField(TypeList<ValueLocalType>(), invoke_context, Make<StructField, std::tuple_element_t<1, Accessors>>(pair),
497-
ReadDestValue(std::get<1>(value)));
497+
ReadDestUpdate(std::get<1>(value)));
498498
});
499499
}
500500

@@ -647,7 +647,7 @@ void ReadOne(TypeList<LocalType> param,
647647
const auto& struc = input.get();
648648
auto&& field_value = value.*ProxyType<LocalType>::get(Index());
649649
ReadField(TypeList<RemoveCvRef<decltype(field_value)>>(), invoke_context, Make<StructField, Accessor>(struc),
650-
ReadDestValue(field_value));
650+
ReadDestUpdate(field_value));
651651
ReadOne<index + 1>(param, invoke_context, input, value);
652652
}
653653

@@ -1118,7 +1118,7 @@ void PassField(Priority<1>, TypeList<LocalType*>, ServerContext& server_context,
11181118
Decay<LocalType> param;
11191119

11201120
MaybeReadField(std::integral_constant<bool, Accessor::in>(), TypeList<LocalType>(), invoke_context, input,
1121-
ReadDestValue(param));
1121+
ReadDestUpdate(param));
11221122

11231123
fn.invoke(server_context, std::forward<Args>(args)..., &param);
11241124

@@ -1355,7 +1355,7 @@ struct ClientParam
13551355
-> typename std::enable_if<I == sizeof...(Types)>::type
13561356
{
13571357
MaybeReadField(std::integral_constant<bool, Accessor::out>(), TypeList<Decay<Params>...>(), invoke_context,
1358-
Make<StructField, Accessor>(results), ReadDestValue(values)...);
1358+
Make<StructField, Accessor>(results), ReadDestUpdate(values)...);
13591359
}
13601360

13611361
ReadResults(ClientParam* client_param) : m_client_param(client_param) {}

0 commit comments

Comments
 (0)