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

Method FlushOutputBuffer

src/SerialStream.cpp:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159 }
160
161 void
162 SerialStream::FlushOutputBuffer()
163 try
164 {
165 auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ;
166
167 // Make sure that we are dealing with a SerialStreamBuf before
168 // proceeding. This check also makes sure that we have a non-NULL
169 // buffer associated with this stream.
170 if (my_buffer != nullptr)
171 {
172 // Try to flush the output buffers the serial port with the correspoding
173 // function of the SerialStreamBuf class.
174 my_buffer->FlushOutputBuffer() ;
175 }
176 else
177 {
178 // If the dynamic_cast above failed then we either have a NULL
179 // streambuf associated with this stream or we have a buffer
180 // of class other than SerialStreamBuf. In either case, we
181 // have a problem and we should stop all I/O using this stream.
182 setstate(badbit) ;
183 }
184 }
185 catch (const std::exception&)
186 {
187 setstate(std::ios_base::failbit) ;
188 throw ;
189 }
190
191 void
192 SerialStream::FlushIOBuffers()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected