MCPcopy Create free account
hub / github.com/devosoft/avida / Inst_RetrieveMessage

Method Inst_RetrieveMessage

avida-core/source/cpu/cHardwareCPU.cc:8286–8300  ·  view source on GitHub ↗

! This method /attempts/ to retrieve a message -- It may not be possible, as in the case of an empty receive buffer. If a message is available, ?BX? is set to the message's label, and ~?BX? is set to its data. */

Source from the content-addressed store, hash-verified

8284 to its data.
8285 */
8286bool cHardwareCPU::Inst_RetrieveMessage(cAvidaContext&)
8287{
8288 std::pair<bool, cOrgMessage> retrieved = m_organism->RetrieveMessage();
8289 if (!retrieved.first) {
8290 return false;
8291 }
8292
8293 const int label_reg = FindModifiedRegister(REG_BX);
8294 const int data_reg = FindNextRegister(label_reg);
8295
8296 GetRegister(label_reg) = retrieved.second.GetLabel();
8297 GetRegister(data_reg) = retrieved.second.GetData();
8298 if(m_world->GetConfig().NET_LOG_RETMESSAGES.Get()) m_world->GetStats().LogRetMessage(retrieved.second);
8299 return true;
8300}
8301
8302bool cHardwareCPU::Inst_Alarm_MSG_multihop(cAvidaContext& ctx)
8303{

Callers

nothing calls this directly

Calls 7

RetrieveMessageMethod · 0.80
GetLabelMethod · 0.80
GetConfigMethod · 0.80
LogRetMessageMethod · 0.80
GetDataMethod · 0.45
GetMethod · 0.45
GetStatsMethod · 0.45

Tested by

no test coverage detected