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

Method FlushInputBuffer

src/SerialStream.cpp:131–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129 }
130
131 void
132 SerialStream::FlushInputBuffer()
133 try
134 {
135 auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ;
136
137 // Make sure that we are dealing with a SerialStreamBuf before
138 // proceeding. This check also makes sure that we have a non-NULL
139 // buffer associated with this stream.
140 if (my_buffer != nullptr)
141 {
142 // Try to flush the input buffers the serial port with the correspoding
143 // function of the SerialStreamBuf class.
144 my_buffer->FlushInputBuffer() ;
145 }
146 else
147 {
148 // If the dynamic_cast above failed then we either have a NULL
149 // streambuf associated with this stream or we have a buffer
150 // of class other than SerialStreamBuf. In either case, we
151 // have a problem and we should stop all I/O using this stream.
152 setstate(badbit) ;
153 }
154 }
155 catch (const std::exception&)
156 {
157 setstate(std::ios_base::failbit) ;
158 throw ;
159 }
160
161 void
162 SerialStream::FlushOutputBuffer()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected