| 99 | } |
| 100 | |
| 101 | void |
| 102 | SerialStream::DrainWriteBuffer() |
| 103 | try |
| 104 | { |
| 105 | auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ; |
| 106 | |
| 107 | // Make sure that we are dealing with a SerialStreamBuf before |
| 108 | // proceeding. This check also makes sure that we have a non-NULL |
| 109 | // buffer associated with this stream. |
| 110 | if (my_buffer != nullptr) |
| 111 | { |
| 112 | // Try to flush the input buffers the serial port with the correspoding |
| 113 | // function of the SerialStreamBuf class. |
| 114 | my_buffer->DrainWriteBuffer() ; |
| 115 | } |
| 116 | else |
| 117 | { |
| 118 | // If the dynamic_cast above failed then we either have a NULL |
| 119 | // streambuf associated with this stream or we have a buffer |
| 120 | // of class other than SerialStreamBuf. In either case, we |
| 121 | // have a problem and we should stop all I/O using this stream. |
| 122 | setstate(badbit) ; |
| 123 | } |
| 124 | } |
| 125 | catch (const std::exception&) |
| 126 | { |
| 127 | setstate(std::ios_base::failbit) ; |
| 128 | throw ; |
| 129 | } |
| 130 | |
| 131 | void |
| 132 | SerialStream::FlushInputBuffer() |
nothing calls this directly
no outgoing calls
no test coverage detected