* @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". **********************************************
| 836 | * client calls "Commit". |
| 837 | *************************************************************/ |
| 838 | StringElement* 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 |
nothing calls this directly
no test coverage detected