MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / DelayContainerToPB

Method DelayContainerToPB

src/plugin/kernel/src/AFCKernelModule.cpp:1075–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1073}
1074
1075bool AFCKernelModule::DelayContainerToPB(std::shared_ptr<AFIEntity> pEntity, const AFDelaySyncContainer& container,
1076 const uint32_t index, AFMsg::pb_delay_entity& data)
1077{
1078 AFMsg::delay_container pb_delay_container;
1079 AFMsg::pb_container pb_conatiner;
1080 for (auto& iter : container.index_list_)
1081 {
1082 auto entity_index = iter;
1083 auto pContaier = pEntity->FindContainer(index);
1084 if (pContaier == nullptr)
1085 {
1086 continue;
1087 }
1088
1089 auto pContainerEntity = pContaier->Find(entity_index);
1090 if (pContainerEntity == nullptr)
1091 {
1092 pb_delay_container.mutable_entity_list()->insert({entity_index, NULL_GUID});
1093 }
1094 else if (pEntity->IsSent())
1095 {
1096 pb_delay_container.mutable_entity_list()->insert({entity_index, pContainerEntity->GetID()});
1097 }
1098 else
1099 {
1100 AFMsg::pb_entity pb_container_entity;
1101 if (!EntityToPBData(pContainerEntity, &pb_container_entity))
1102 {
1103 continue;
1104 }
1105
1106 pb_conatiner.mutable_datas_value()->insert({entity_index, pb_container_entity});
1107 }
1108 }
1109
1110 if (pb_conatiner.datas_value_size() > 0)
1111 {
1112 data.mutable_data()->mutable_datas_container()->insert({index, pb_conatiner});
1113 }
1114 data.mutable_container_entity()->insert({index, pb_delay_container});
1115
1116 AFMsg::delay_container pb_destroy_entity;
1117 for (auto& iter : container.destroy_list_)
1118 {
1119 auto entity_index = iter;
1120 pb_destroy_entity.mutable_entity_list()->insert({entity_index, NULL_GUID});
1121 }
1122
1123 data.mutable_destroy_entity()->insert({index, pb_destroy_entity});
1124
1125 return true;
1126}
1127
1128bool AFCKernelModule::TryAddContainerPBEntity(std::shared_ptr<AFIContainer> pContainer, const AFGUID& self,
1129 AFMsg::pb_entity_data& pb_entity_data, AFGUID& parent_id, AFMsg::pb_entity_data* pb_container_entity)

Callers

nothing calls this directly

Calls 4

IsSentMethod · 0.80
FindContainerMethod · 0.45
FindMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected