MCPcopy Create free account
hub / github.com/crayzeewulf/libserial / FlushIOBuffers

Method FlushIOBuffers

src/SerialStream.cpp:191–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 }
190
191 void
192 SerialStream::FlushIOBuffers()
193 try
194 {
195 auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ;
196
197 // Make sure that we are dealing with a SerialStreamBuf before
198 // proceeding. This check also makes sure that we have a non-NULL
199 // buffer associated with this stream.
200 if (my_buffer != nullptr)
201 {
202 // Try to flush the I/O buffers the serial port with the correspoding
203 // function of the SerialStreamBuf class.
204 my_buffer->FlushIOBuffers() ;
205 }
206 else
207 {
208 // If the dynamic_cast above failed then we either have a NULL
209 // streambuf associated with this stream or we have a buffer
210 // of class other than SerialStreamBuf. In either case, we
211 // have a problem and we should stop all I/O using this stream.
212 setstate(badbit) ;
213 }
214 }
215 catch (const std::exception&)
216 {
217 setstate(std::ios_base::failbit) ;
218 throw ;
219 }
220
221 bool
222 SerialStream::IsDataAvailable()

Callers 2

SerialStreamMethod · 0.95
~SerialStreamMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected