Supplies multi-protocol data stream parsing. More...
#include <protocolmanager.h>
Public Types | |
typedef container_type::const_iterator | const_iterator |
A typedef for a const iterator. More... | |
typedef std::list< value_type > | container_type |
A typedef for a container type. More... | |
typedef std::shared_ptr< IProtocolHandler > | value_type |
A typedef for a value type. More... | |
Public Member Functions | |
virtual value_type | add (IProtocolHandler *handler) |
Adds the protocol handler. More... | |
const_iterator | begin () const |
virtual void | clear () |
Clears the protocol handlers list. More... | |
XsMessage | convertToMessage (XsProtocolType &type, MessageLocation &location, const XsByteArray &raw) override |
Converts raw data using location into a XsMessage object. More... | |
const_iterator | end () const |
virtual value_type | find (XsProtocolType type) |
Searches the registered protocol handlers for a handler that matches the given protocol type and returns that handler if present. More... | |
MessageLocation | findMessage (XsProtocolType &type, const XsByteArray &raw) override |
Searches for a raw message in a raw data. More... | |
virtual bool | hasProtocol (XsProtocolType type) const |
int | likelyMinimumMessageSize () const |
ProtocolManager (Communicator const &) | |
Default constructor. More... | |
virtual bool | remove (XsProtocolType type) |
Removes a protocol handler of a specified type. More... | |
bool | validateMessage (XsMessage const &message) const override |
Check a message for a validity. More... | |
virtual | ~ProtocolManager () throw () |
![]() | |
virtual | ~IProtocolManager () |
Destructor. More... | |
Private Attributes | |
Communicator const & | m_communicator |
container_type | m_protocolHandlers |
Supplies multi-protocol data stream parsing.
This class provides functionality for dealing with multiple or changing communication protocols in a data stream. The XCommunicator class uses this class to parse a raw byte stream into XsMessage objects.
Definition at line 81 of file protocolmanager.h.
typedef container_type::const_iterator ProtocolManager::const_iterator |
A typedef for a const iterator.
Definition at line 92 of file protocolmanager.h.
typedef std::list<value_type> ProtocolManager::container_type |
A typedef for a container type.
Definition at line 89 of file protocolmanager.h.
typedef std::shared_ptr<IProtocolHandler> ProtocolManager::value_type |
A typedef for a value type.
Definition at line 86 of file protocolmanager.h.
|
explicit |
Default constructor.
Definition at line 83 of file protocolmanager.cpp.
|
virtual |
Definition at line 88 of file protocolmanager.cpp.
|
virtual |
Adds the protocol handler.
[in] | handler | The protocol handler to add |
Definition at line 228 of file protocolmanager.cpp.
ProtocolManager::const_iterator ProtocolManager::begin | ( | ) | const |
Definition at line 94 of file protocolmanager.cpp.
|
virtual |
Clears the protocol handlers list.
Definition at line 243 of file protocolmanager.cpp.
|
overridevirtual |
Converts raw data using location into a XsMessage object.
[in] | type | The protocol type to use. |
[out] | location | The location of a message to convert from raw data. |
[in] | raw | The raw byte stream. |
Implements IProtocolManager.
Definition at line 163 of file protocolmanager.cpp.
ProtocolManager::const_iterator ProtocolManager::end | ( | ) | const |
Definition at line 101 of file protocolmanager.cpp.
|
virtual |
Searches the registered protocol handlers for a handler that matches the given protocol type and returns that handler if present.
type | : The protocol type to search for |
Definition at line 202 of file protocolmanager.cpp.
|
overridevirtual |
Searches for a raw message in a raw data.
[out] | type | The protocol type that was used. |
[in] | raw | The byte array to search in. |
Implements IProtocolManager.
Definition at line 111 of file protocolmanager.cpp.
|
virtual |
[in] | type | The protocol type to check |
Definition at line 216 of file protocolmanager.cpp.
int ProtocolManager::likelyMinimumMessageSize | ( | ) | const |
Definition at line 259 of file protocolmanager.cpp.
|
virtual |
Removes a protocol handler of a specified type.
[in] | type | The type of the protocol handler to remove |
Definition at line 176 of file protocolmanager.cpp.
|
overridevirtual |
Check a message for a validity.
[in] | message | The message to check |
Implements IProtocolManager.
Definition at line 252 of file protocolmanager.cpp.
|
private |
Definition at line 116 of file protocolmanager.h.
|
private |
Definition at line 120 of file protocolmanager.h.