Copy the entire file state from the other GCode buffer to ourselves. Called to copy the state of the File stream to File2.
| 379 | |
| 380 | // Copy the entire file state from the other GCode buffer to ourselves. Called to copy the state of the File stream to File2. |
| 381 | void GCodeBuffer::ForkFrom(const GCodeBuffer& other) noexcept |
| 382 | { |
| 383 | GCodeMachineState *ms = other.machineState->ForkChain(); |
| 384 | std::swap(ms, machineState); |
| 385 | |
| 386 | // We should have a single old MachineState object, but to avoid memory leaks allow for the possibility of having a chain |
| 387 | while (ms != nullptr) |
| 388 | { |
| 389 | GCodeMachineState *const msToDelete = ms; |
| 390 | ms = ms->GetPrevious(); |
| 391 | delete msToDelete; |
| 392 | } |
| 393 | |
| 394 | printFilePositionAtMacroStart = other.printFilePositionAtMacroStart; |
| 395 | GetVariables().AssignFrom(other.GetVariables()); |
| 396 | |
| 397 | # if HAS_SBC_INTERFACE |
| 398 | if (!isBinaryBuffer && !reprap.UsingSbcInterface()) |
| 399 | # endif |
| 400 | { |
| 401 | machineState->fileState.Seek(other.GetJobFilePosition()); |
| 402 | GetFileInput()->Reset(machineState->fileState); |
| 403 | stringParser.StartNewFile(); |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | // Determine whether this input channel is at a strictly later point than the other one |
| 408 | bool GCodeBuffer::IsLaterThan(const GCodeBuffer& other) const noexcept |
no test coverage detected