MCPcopy Create free account
hub / github.com/SoarGroup/Soar / UpdateInt

Method UpdateInt

Core/ClientSML/src/sml_ClientWorkingMemory.cpp:999–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

997}
998
999void WorkingMemory::UpdateInt(IntElement* pWME, long long value)
1000{
1001 if (!pWME)
1002 {
1003 return ;
1004 }
1005
1006 assert(m_Agent == pWME->GetAgent()) ;
1007
1008 // If the value hasn't changed and we're set to not blink the wme (remove/add it again)
1009 // then there's no work to do.
1010 if (!m_Agent->IsBlinkIfNoChange())
1011 {
1012 if (pWME->GetValue() == value)
1013 {
1014 return ;
1015 }
1016 }
1017
1018 // Changing the value logically is a remove and then an add
1019
1020 // Get the tag of the value to remove
1021 long long removeTimeTag = pWME->GetTimeTag() ;
1022
1023 // Change the value and the time tag (this is equivalent to us deleting the old object
1024 // and then creating a new one).
1025 pWME->SetValue(value) ;
1026 pWME->GenerateNewTimeTag() ;
1027
1028#ifdef SML_DIRECT
1029 if (GetConnection()->IsDirectConnection())
1030 {
1031 EmbeddedConnection* pConnection = static_cast<EmbeddedConnection*>(GetConnection());
1032 pConnection->DirectRemoveWME(m_AgentSMLHandle, removeTimeTag);
1033
1034 pConnection->DirectAddWME_Int(m_AgentSMLHandle, pWME->GetIdentifierName(), pWME->GetAttribute(), value, pWME->GetTimeTag());
1035
1036 // Return immediately, without adding it to the commit list.
1037 return ;
1038 }
1039#endif
1040
1041 // Add it to the list of changes that need to be sent to Soar.
1042 m_DeltaList.UpdateWME(removeTimeTag, pWME) ;
1043
1044 // Commit immediately if we're configured that way (makes life simpler for the client)
1045 if (IsAutoCommitEnabled())
1046 {
1047 Commit() ;
1048 }
1049}
1050
1051void WorkingMemory::UpdateFloat(FloatElement* pWME, double value)
1052{

Callers 2

UpdateMethod · 0.80
UpdateMethod · 0.80

Calls 9

GenerateNewTimeTagMethod · 0.80
DirectRemoveWMEMethod · 0.80
DirectAddWME_IntMethod · 0.80
GetConnectionFunction · 0.70
IsAutoCommitEnabledFunction · 0.70
GetAgentMethod · 0.45
SetValueMethod · 0.45
IsDirectConnectionMethod · 0.45
GetAttributeMethod · 0.45

Tested by

no test coverage detected