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

Method CreateStringWME

Core/ClientSML/src/sml_ClientWorkingMemory.cpp:838–868  ·  view source on GitHub ↗

* @brief Builds a new WME that has a string value and schedules * it for addition to Soar's input link. * * The agent retains ownership of this object. * The returned object is valid until the caller * deletes the parent identifier. * The WME is not added to Soar's input link until the * client calls "Commit". **********************************************

Source from the content-addressed store, hash-verified

836* client calls "Commit".
837*************************************************************/
838StringElement* WorkingMemory::CreateStringWME(Identifier* parent, char const* pAttribute, char const* pValue)
839{
840 assert(m_Agent == parent->GetAgent()) ;
841
842 StringElement* pWME = new StringElement(GetAgent(), parent, parent->GetValueAsString(), pAttribute, pValue, GenerateTimeTag()) ;
843
844 // Record that the identifer owns this new WME
845 parent->AddChild(pWME) ;
846
847#ifdef SML_DIRECT
848 if (GetConnection()->IsDirectConnection())
849 {
850 EmbeddedConnection* pConnection = static_cast<EmbeddedConnection*>(GetConnection());
851 pConnection->DirectAddWME_String(m_AgentSMLHandle, parent->GetValueAsString(), pAttribute, pValue, pWME->GetTimeTag());
852
853 // Return immediately, without adding it to the commit list.
854 return pWME ;
855 }
856#endif
857
858 // Add it to our list of changes that need to be sent to Soar.
859 m_DeltaList.AddWME(pWME) ;
860
861 // Commit immediately if we're configured that way (makes life simpler for the client)
862 if (IsAutoCommitEnabled())
863 {
864 Commit() ;
865 }
866
867 return pWME ;
868}
869
870/*************************************************************
871* @brief Same as CreateStringWME but for a new WME that has

Callers

nothing calls this directly

Calls 9

DirectAddWME_StringMethod · 0.80
AddWMEMethod · 0.80
GetAgentFunction · 0.70
GetConnectionFunction · 0.70
IsAutoCommitEnabledFunction · 0.70
GetAgentMethod · 0.45
GetValueAsStringMethod · 0.45
AddChildMethod · 0.45
IsDirectConnectionMethod · 0.45

Tested by

no test coverage detected