| 295 | } |
| 296 | |
| 297 | BaudRate |
| 298 | SerialStream::GetBaudRate() |
| 299 | try |
| 300 | { |
| 301 | auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ; |
| 302 | |
| 303 | // Make sure that we are dealing with a SerialStreamBuf before |
| 304 | // proceeding. This check also makes sure that we have a non-NULL |
| 305 | // buffer associated with this stream. |
| 306 | if (my_buffer != nullptr) |
| 307 | { |
| 308 | // Try to get the baud rate. If the corresponding function of the |
| 309 | // SerialStreamBuf class returns BAUD_INVALID, then we have a |
| 310 | // problem and the stream is no longer valid for I/O. |
| 311 | return my_buffer->GetBaudRate() ; |
| 312 | } |
| 313 | // If the dynamic_cast above failed then we either have a NULL |
| 314 | // streambuf associated with this stream or we have a buffer of |
| 315 | // class other than SerialStreamBuf. In either case, we have a |
| 316 | // problem and we should stop all I/O using this stream. |
| 317 | setstate(badbit) ; |
| 318 | return BaudRate::BAUD_INVALID; |
| 319 | } |
| 320 | catch (const std::exception&) |
| 321 | { |
| 322 | setstate(std::ios_base::failbit) ; |
| 323 | throw ; |
| 324 | } |
| 325 | |
| 326 | void |
| 327 | SerialStream::SetCharacterSize(const CharacterSize& characterSize) |
nothing calls this directly
no outgoing calls
no test coverage detected