Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::common::InputStreamProcessor< Type, ProcessorType > Class Template Reference

Converts one stream data type into another. More...

#include <inputStream.h>

Inheritance diagram for MaxOS::common::InputStreamProcessor< Type, ProcessorType >:
MaxOS::common::InputStreamEventHandler< Type > MaxOS::common::GenericInputStream< ProcessorType > MaxOS::common::GenericOutputStream< string > MaxOS::common::OutputStream MaxOS::Logger MaxOS::drivers::SerialConsole MaxOS::drivers::console::ConsoleStream

Public Member Functions

 InputStreamProcessor ()
 Creates a new InputStreamProcessor.
 
 InputStreamProcessor (InputStreamEventHandler< ProcessorType > *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.
 
- Public Member Functions inherited from MaxOS::common::InputStreamEventHandler< Type >
 InputStreamEventHandler ()
 _______________________________________________TEMPLATES_________________________________________________________________///
 
 ~InputStreamEventHandler ()
 Destroys the InputStreamProcessor and disconnects it from all streams.
 
virtual void on_stream_read (Type)
 Called when data is read from a stream (overridden by subclasses)
 
- Public Member Functions inherited from MaxOS::common::GenericInputStream< ProcessorType >
 GenericInputStream ()
 Creates a new GenericInputStream.
 
 GenericInputStream (InputStreamEventHandler< ProcessorType > *)
 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< ProcessorType > *)
 Adds a inputStreamEventHandler to the list of internetProtocolHandlers.
 
void disconnect_input_stream_event_handler (InputStreamEventHandler< ProcessorType > *)
 Removes a handler from the list of handlers.
 

Additional Inherited Members

- 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< ProcessorType >
common::Vector< InputStreamEventHandler< ProcessorType > * > m_input_stream_event_handlers
 List of streams being observed by this handler.
 

Detailed Description

template<class Type, class ProcessorType>
class MaxOS::common::InputStreamProcessor< Type, ProcessorType >

Converts one stream data type into another.

Template Parameters
Type
ProcessorType

Definition at line 49 of file inputStream.h.

Constructor & Destructor Documentation

◆ InputStreamProcessor() [1/2]

Creates a new InputStreamProcessor.

Template Parameters
TypeThe type of data the stream is handling
ProcessorTypeThe type of data to convert the data into via the processor

Definition at line 197 of file inputStream.h.

198 : InputStreamEventHandler<Type>(),
199 GenericInputStream<ProcessorType>() {
200
201 }

◆ InputStreamProcessor() [2/2]

template<class Type , class ProcessorType >
MaxOS::common::InputStreamProcessor< Type, ProcessorType >::InputStreamProcessor ( InputStreamEventHandler< ProcessorType > *  generic_stream_event_handler)
explicit

Creates a new InputStreamProcessor.

Template Parameters
TypeThe type of data the stream is handling
ProcessorTypeThe type of data to convert the data into via the processor
Parameters
generic_stream_event_handlerThe event handler to handle the data

Definition at line 210 of file inputStream.h.

211 : InputStreamEventHandler<Type>(),
212 GenericInputStream<ProcessorType>(generic_stream_event_handler) {
213
214 }

◆ ~InputStreamProcessor()

Destroys the InputStreamProcessor.

Template Parameters
TypeThe type of data the stream is handling
ProcessorTypeThe type of data to convert the data into via the processor

Member Function Documentation

◆ on_end_of_stream()

template<class Type , class ProcessorType >
void MaxOS::common::InputStreamProcessor< Type, ProcessorType >::on_end_of_stream ( GenericInputStream< Type > *  stream)
overridevirtual

Called when a stream has finished. Passes the event on to the handlers and then removes the stream from the array of streams.

Template Parameters
TypeThe type of data the stream is handling
ProcessorTypeThe type of data to convert the data into via the processor
Parameters
streamThe stream that has finished

Reimplemented from MaxOS::common::InputStreamEventHandler< Type >.

Definition at line 231 of file inputStream.h.

231 {
232
233 // Pass the end of stream event on to the handlers
234 for(auto& event_handler : this->m_input_stream_event_handlers)
235 event_handler->on_end_of_stream(this);
236
237 // Remove the stream
239
240 }
common::Vector< InputStreamEventHandler< ProcessorType > * > m_input_stream_event_handlers
List of streams being observed by this handler.
virtual void on_end_of_stream(GenericInputStream< Type > *)
Called when a stream has finished. Removes the stream from the array of streams.
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 fr...

References MaxOS::common::InputStreamEventHandler< Type >::on_end_of_stream().

Referenced by MaxOS::common::InputStreamBuffer< Type >::on_end_of_stream(), and MaxOS::common::GenericOutputStream< Type >::on_end_of_stream().


The documentation for this class was generated from the following file: