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

Method HandleGetConnections

Core/KernelSML/src/sml_KernelSMLHandlers.cpp:371–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

369}
370
371bool KernelSML::HandleGetConnections(AgentSML* /*pAgentSML*/, char const* /*pCommandName*/, Connection* /*pCallingConnection*/, AnalyzeXML* /*pIncoming*/, soarxml::ElementXML* pResponse)
372{
373 // Create the result tag
374 TagResult* pTagResult = new TagResult() ;
375 pTagResult->AddAttribute(sml_Names::kCommandOutput, sml_Names::kStructuredOutput) ;
376
377 // Walk the list of connections and return their info
378 int index = 0 ;
379 Connection* pConnection = m_pConnectionManager->GetConnectionByIndex(index) ;
380
381 while (pConnection)
382 {
383 // Create the connection tag
384 soarxml::ElementXML* pTagConnection = new soarxml::ElementXML() ;
385 pTagConnection->SetTagName(sml_Names::kTagConnection) ;
386
387 // Fill in the info
388 pTagConnection->AddAttribute(sml_Names::kConnectionId, pConnection->GetID()) ;
389 pTagConnection->AddAttribute(sml_Names::kConnectionName, pConnection->GetName()) ;
390 pTagConnection->AddAttribute(sml_Names::kConnectionStatus, pConnection->GetStatus()) ;
391 pTagConnection->AddAttribute(sml_Names::kAgentStatus, pConnection->GetAgentStatus()) ;
392
393 // Add the connection into the result
394 pTagResult->AddChild(pTagConnection) ;
395
396 // Get the next connection. Returns null when go beyond limit.
397 // (This provides thread safe access to the list, in case it changes during this enumeration)
398 index++ ;
399 pConnection = m_pConnectionManager->GetConnectionByIndex(index) ;
400 }
401
402 // Add the result tag to the response
403 pResponse->AddChild(pTagResult) ;
404
405 // Return true to indicate we've filled in all of the result tag we need
406 return true ;
407
408}
409
410bool KernelSML::HandleDestroyAgent(AgentSML* pAgentSML, char const* /*pCommandName*/, Connection* /*pConnection*/, AnalyzeXML* /*pIncoming*/, soarxml::ElementXML* /*pResponse*/)
411{

Callers

nothing calls this directly

Calls 8

GetConnectionByIndexMethod · 0.80
SetTagNameMethod · 0.80
GetStatusMethod · 0.80
AddAttributeMethod · 0.45
GetIDMethod · 0.45
GetNameMethod · 0.45
GetAgentStatusMethod · 0.45
AddChildMethod · 0.45

Tested by

no test coverage detected