![]() |
Max OS 0.3
|
Buffers data from a stream and fires an event when a certain element is read. More...
#include <inputStream.h>
Public Member Functions | |
| InputStreamBuffer (Type event_fire_element, Type termination_element) | |
| Creates a new InputStreamBuffer. | |
| ~InputStreamBuffer () | |
| Destroys the InputStreamBuffer. | |
| void | on_stream_read (Type) override |
| Called when data is read from a stream. Adds the data to the buffer and checks if the event should be fired. | |
| void | on_end_of_stream (GenericInputStream< Type > *) override |
| Called when a stream has finished. Flushes the buffer if there is any data in it. | |
| void | flush () |
| Flushes the buffer by adding the termination element and firing an on read event (NOTE: The buffer is not cleared after this just overwritten) | |
Protected Attributes | |
| Type | m_buffer [10240] |
| The buffer to store data in. | |
| int | m_offset { 0 } |
| The current position in the buffer. | |
| Type | m_event_fire_element |
| The element that will cause the buffer to flush and fire an event. | |
| Type | m_termination_element |
| The element that will cause the buffer to flush and end the stream. | |
Protected Attributes inherited from MaxOS::common::InputStreamEventHandler< Type > | |
| common::Vector< GenericInputStream< Type > * > | m_generic_input_streams |
| List of streams being observed by this handler. | |
Protected Attributes inherited from MaxOS::common::GenericInputStream< Type > | |
| common::Vector< InputStreamEventHandler< Type > * > | m_input_stream_event_handlers |
| List of streams being observed by this handler. | |
Additional Inherited Members | |
Protected Member Functions inherited from MaxOS::common::InputStreamProcessor< Type, Type * > | |
| InputStreamProcessor () | |
| Creates a new InputStreamProcessor. | |
| InputStreamProcessor (InputStreamEventHandler< Type * > *generic_stream_event_handler) | |
| Creates a new InputStreamProcessor. | |
| ~InputStreamProcessor () | |
| Destroys the InputStreamProcessor. | |
| void | on_end_of_stream (GenericInputStream< Type > *stream) override |
| Called when a stream has finished. Passes the event on to the handlers and then removes the stream from the array of streams. | |
Protected Member Functions inherited from MaxOS::common::InputStreamEventHandler< Type > | |
| InputStreamEventHandler () | |
| _______________________________________________TEMPLATES_________________________________________________________________/// | |
| ~InputStreamEventHandler () | |
| Destroys the InputStreamProcessor and disconnects it from all streams. | |
Protected Member Functions inherited from MaxOS::common::GenericInputStream< Type > | |
| GenericInputStream () | |
| Creates a new GenericInputStream. | |
| GenericInputStream (InputStreamEventHandler< Type > *) | |
| Creates a new GenericInputStream and connects it to the handler. | |
| ~GenericInputStream () | |
| Destroys the GenericInputStream and disconnects all handlers. | |
| void | connect_input_stream_event_handler (InputStreamEventHandler< Type > *) |
| Adds a inputStreamEventHandler to the list of internetProtocolHandlers. | |
| void | disconnect_input_stream_event_handler (InputStreamEventHandler< Type > *) |
| Removes a handler from the list of handlers. | |
Buffers data from a stream and fires an event when a certain element is read.
| Type | The type of data the stream is handling |
Definition at line 80 of file inputStream.h.
| MaxOS::common::InputStreamBuffer< Type >::InputStreamBuffer | ( | Type | event_fire_element, |
| Type | termination_element | ||
| ) |
Creates a new InputStreamBuffer.
| Type | The type of data the stream is handling |
| event_fire_element | The element to fire the event on |
| termination_element | The element that signifies the end of the part of the stream to be buffered (e.g a newline) |
Definition at line 288 of file inputStream.h.
|
default |
Destroys the InputStreamBuffer.
| Type | The type of data the stream is handling |
| void MaxOS::common::InputStreamBuffer< Type >::flush | ( | ) |
Flushes the buffer by adding the termination element and firing an on read event (NOTE: The buffer is not cleared after this just overwritten)
| Type | The type of data the stream is handling |
Definition at line 346 of file inputStream.h.
References MaxOS::common::InputStreamEventHandler< Type >::on_stream_read().
|
overridevirtual |
Called when a stream has finished. Flushes the buffer if there is any data in it.
| Type | The type of data the stream is handling |
| stream | The stream that has finished |
Reimplemented from MaxOS::common::InputStreamEventHandler< Type >.
Definition at line 331 of file inputStream.h.
References MaxOS::common::InputStreamProcessor< Type, ProcessorType >::on_end_of_stream().
|
overridevirtual |
Called when data is read from a stream. Adds the data to the buffer and checks if the event should be fired.
| Type |
| read_element |
Reimplemented from MaxOS::common::InputStreamEventHandler< Type >.
Definition at line 307 of file inputStream.h.
|
protected |
The buffer to store data in.
Definition at line 82 of file inputStream.h.
|
protected |
The element that will cause the buffer to flush and fire an event.
Definition at line 84 of file inputStream.h.
|
protected |
|
protected |
The element that will cause the buffer to flush and end the stream.
Definition at line 85 of file inputStream.h.