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

Method DoCaptureInput

Core/CLI/src/cli_captureinput.cpp:14–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace sml;
13
14bool CommandLineInterface::DoCaptureInput(eCaptureInputMode mode, bool autoflush, std::string* pathname)
15{
16 switch (mode)
17 {
18 case CAPTURE_INPUT_CLOSE:
19 if (!m_pAgentSML->CaptureQuery())
20 {
21 return SetError("File is not open.");
22 }
23 if (!m_pAgentSML->StopCaptureInput())
24 {
25 return SetError("Error closing file.");
26 }
27 break;
28
29 case CAPTURE_INPUT_OPEN:
30 {
31 if (m_pAgentSML->CaptureQuery())
32 {
33 return SetError("File is already open.");
34 }
35 if (!pathname || !pathname->size())
36 {
37 return SetError("File name required.");
38 }
39
40 uint32_t seed = SoarRandInt();
41
42 if (!m_pAgentSML->StartCaptureInput(*pathname, autoflush, seed))
43 {
44 return SetError("Error opening file.");
45 }
46
47 m_Result << "Capturing input with random seed: " << seed;
48 }
49 break;
50
51 case CAPTURE_INPUT_QUERY:
52 m_Result << (m_pAgentSML->CaptureQuery() ? "open" : "closed");
53 break;
54 }
55
56 return true;
57}
58

Callers 1

ParseMethod · 0.45

Calls 5

SetErrorFunction · 0.85
SoarRandIntFunction · 0.85
StopCaptureInputMethod · 0.80
StartCaptureInputMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected