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

Method ExecuteCommandLine

Core/KernelSML/src/sml_AgentSML.cpp:868–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

866}
867
868std::string AgentSML::ExecuteCommandLine(std::string const& commandLine)
869{
870 KernelSML* pKernel = m_pKernelSML ;
871
872 // We'll pretend this came from the local (embedded) connection.
873 Connection* pConnection = pKernel->GetEmbeddedConnection() ;
874
875 // Build up a message to execute the command line
876 bool rawOutput = true ;
877 soarxml::ElementXML* pMsg = pConnection->CreateSMLCommand(sml_Names::kCommand_CommandLine, rawOutput) ;
878 pConnection->AddParameterToSMLCommand(pMsg, sml_Names::kParamAgent, this->GetName());
879 pConnection->AddParameterToSMLCommand(pMsg, sml_Names::kParamLine, commandLine.c_str()) ;
880
881 AnalyzeXML incoming ;
882 incoming.Analyze(pMsg) ;
883
884 // Create a response object which the command line can fill in
885 soarxml::ElementXML* pResponse = pConnection->CreateSMLResponse(pMsg) ;
886
887 // Execute the command line
888 bool ok = pKernel->ProcessCommand(sml_Names::kCommand_CommandLine, pConnection, &incoming, pResponse) ;
889
890 std::string result ;
891
892 if (ok)
893 {
894 // Take the result from executing the command line and fill it in to our "pReturnValue" array.
895 AnalyzeXML response ;
896 response.Analyze(pResponse) ;
897
898 char const* pRes = response.GetResultString() ;
899
900 if (pRes)
901 {
902 result = pRes ;
903 }
904 }
905 else
906 {
907 result = std::string("Error executing command ") + commandLine ;
908 }
909
910 // Clean up
911 delete pMsg ;
912 delete pResponse ;
913
914 return result ;
915}
916
917bool AgentSML::AddInputWME(char const* pID, char const* pAttribute, Symbol* pValueSymbol, int64_t clientTimeTag)
918{

Callers 15

Test1Function · 0.45
mainFunction · 0.45
TestAgentMethod · 0.45
RunTest1Function · 0.45
RunTest2Function · 0.45
RunTest3Function · 0.45
RunTest4Function · 0.45
printDebugInformationFunction · 0.45
testReadCSoarDBMethod · 0.45
testMultiAgentMethod · 0.45

Calls 8

GetNameMethod · 0.95
GetEmbeddedConnectionMethod · 0.80
CreateSMLCommandMethod · 0.80
AnalyzeMethod · 0.80
CreateSMLResponseMethod · 0.80
ProcessCommandMethod · 0.80
GetResultStringMethod · 0.45

Tested by 15

Test1Function · 0.36
mainFunction · 0.36
TestAgentMethod · 0.36
RunTest1Function · 0.36
RunTest2Function · 0.36
RunTest3Function · 0.36
RunTest4Function · 0.36
printDebugInformationFunction · 0.36
testReadCSoarDBMethod · 0.36
testMultiAgentMethod · 0.36