| 896 | } |
| 897 | |
| 898 | std::vector<std::string> |
| 899 | SerialStream::GetAvailableSerialPorts() |
| 900 | try |
| 901 | { |
| 902 | auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ; |
| 903 | |
| 904 | // Make sure that we are dealing with a SerialStreamBuf before |
| 905 | // proceeding. This check also makes sure that we have a non-NULL |
| 906 | // buffer associated with this stream. |
| 907 | if (my_buffer != nullptr) |
| 908 | { |
| 909 | // Try to get the file descriptor. |
| 910 | return my_buffer->GetAvailableSerialPorts() ; |
| 911 | } |
| 912 | // If the dynamic_cast above failed then we either have a NULL |
| 913 | // streambuf associated with this stream or we have a buffer of |
| 914 | // class other than SerialStreamBuf. In either case, we have a |
| 915 | // problem and we should stop all I/O using this stream. |
| 916 | setstate(badbit) ; |
| 917 | return {} ; |
| 918 | } |
| 919 | catch (const std::exception&) |
| 920 | { |
| 921 | setstate(std::ios_base::failbit) ; |
| 922 | throw ; |
| 923 | } |
| 924 | } // namespace LibSerial |
nothing calls this directly
no outgoing calls
no test coverage detected