in src/cpp/RiderLink/Source/RD/src/rd_framework_cpp/src/main/intern/InternRoot.h [103:132]
int32_t InternRoot::intern_value(Wrapper<T> value) const
{
InternedAny any = any::make_interned_any<T>(value);
std::lock_guard<decltype(lock)> guard(lock);
auto it = inverse_map.find(any);
int32_t index = 0;
if (it == inverse_map.end())
{
get_protocol()->get_wire()->send(this->rdid, [this, &index, value, any](Buffer& buffer) {
InternedAnySerializer::write<T>(get_serialization_context(), buffer, wrapper::get<T>(value));
{
std::lock_guard<decltype(lock)> guard(lock);
index = static_cast<int32_t>(my_items_lis.size()) * 2;
my_items_lis.emplace_back(any);
}
buffer.write_integral<int32_t>(index);
});
}
else
{
index = it->second;
}
if (inverse_map.count(any) == 0)
{
inverse_map[any] = index;
}
return index;
}