| 12 | using namespace sml; |
| 13 | |
| 14 | bool 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 |
no test coverage detected