in src/cpp/RiderLink/Source/RD/src/rd_framework_cpp/src/main/impl/RdList.h [76:120]
void init(Lifetime lifetime) const override
{
RdBindableBase::init(lifetime);
local_change([this, lifetime] {
advise(lifetime, [this, lifetime](typename IViewableList<T>::Event e) {
if (!is_local_change)
return;
if (!optimize_nested)
{
T const* new_value = e.get_new_value();
if (new_value)
{
const IProtocol* iProtocol = get_protocol();
const Identities* identity = iProtocol->get_identity();
identifyPolymorphic(*new_value, *identity, identity->next(rdid));
}
}
get_wire()->send(rdid, [this, e](Buffer& buffer) {
Op op = static_cast<Op>(e.v.index());
buffer.write_integral<int64_t>(static_cast<int64_t>(op) | (next_version++ << versionedFlagShift));
buffer.write_integral<int32_t>(static_cast<const int32_t>(e.get_index()));
T const* new_value = e.get_new_value();
if (new_value)
{
S::write(this->get_serialization_context(), buffer, *new_value);
}
spdlog::get("logSend")->trace(logmsg(op, next_version - 1, e.get_index(), new_value));
});
});
});
get_wire()->advise(lifetime, this);
if (!optimize_nested)
{
this->view(lifetime, [this](Lifetime lf, size_t index, T const& value) {
bindPolymorphic(value, lf, this, "[" + std::to_string(index) + "]");
});
}
}