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

Passes read events on to the handlers. More...

#include <inputStream.h>

Inheritance diagram for MaxOS::common::InputStreamSocket< Type >:
MaxOS::common::InputStreamProcessor< Type, Type > MaxOS::common::InputStreamEventHandler< Type > MaxOS::common::GenericInputStream< Type >

Public Member Functions

 InputStreamSocket ()
 Creates a new InputStreamSocket.
 
 InputStreamSocket (InputStreamEventHandler< Type > *)
 Creates a new InputStreamSocket and connects it to the handler.
 
 ~InputStreamSocket ()
 Destroys the InputStreamSocket.
 
void on_stream_read (Type) override
 Called when data is read from a stream. Passes the event on to the internetProtocolHandlers.
 
- Public 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.
 
- Public Member Functions inherited from MaxOS::common::InputStreamEventHandler< Type >
 InputStreamEventHandler ()
 _______________________________________________TEMPLATES_________________________________________________________________///
 
 ~InputStreamEventHandler ()
 Destroys the InputStreamProcessor and disconnects it from all streams.
 
- Public 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.
 

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

Detailed Description

template<class Type>
class MaxOS::common::InputStreamSocket< Type >

Passes read events on to the handlers.

Template Parameters
TypeThe type of data the stream is handling

Definition at line 65 of file inputStream.h.

Constructor & Destructor Documentation

◆ InputStreamSocket() [1/2]

template<class Type >
MaxOS::common::InputStreamSocket< Type >::InputStreamSocket ( )
default

Creates a new InputStreamSocket.

Template Parameters
TypeThe type of data the stream is handling

◆ InputStreamSocket() [2/2]

template<class Type >
MaxOS::common::InputStreamSocket< Type >::InputStreamSocket ( InputStreamEventHandler< Type > *  processor_handler)
explicit

Creates a new InputStreamSocket and connects it to the handler.

Template Parameters
TypeThe type of data the stream is handling (and the sockets processor type)
Parameters
processor_handlerThe handler to pass to InputStreamProcessor

Definition at line 255 of file inputStream.h.

256 : InputStreamProcessor<Type, Type>(processor_handler) {
257
258 }

◆ ~InputStreamSocket()

Destroys the InputStreamSocket.

Template Parameters
TypeThe type of data the stream is handling

Member Function Documentation

◆ on_stream_read()

template<class Type >
void MaxOS::common::InputStreamSocket< Type >::on_stream_read ( Type  read_element)
overridevirtual

Called when data is read from a stream. Passes the event on to the internetProtocolHandlers.

Template Parameters
TypeThe type of data the stream is handling
Parameters
read_elementThe element that was read from the stream

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

Definition at line 273 of file inputStream.h.

273 {
274
275 // Pass the read event on to the handlers
276 for(auto& event_handler : this->m_input_stream_event_handlers)
277 event_handler->on_stream_read(read_element);
278
279 }
common::Vector< InputStreamEventHandler< Type > * > m_input_stream_event_handlers
List of streams being observed by this handler.
void on_stream_read(Type) override
Called when data is read from a stream. Passes the event on to the internetProtocolHandlers.

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


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