Public Types | Public Member Functions | Private Attributes | List of all members
ProtocolManager Class Reference

Supplies multi-protocol data stream parsing. More...

#include <protocolmanager.h>

Inheritance diagram for ProtocolManager:
Inheritance graph
[legend]

Public Types

typedef container_type::const_iterator const_iterator
 A typedef for a const iterator. More...
 
typedef std::list< value_typecontainer_type
 A typedef for a container type. More...
 
typedef std::shared_ptr< IProtocolHandlervalue_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 ()
 
- Public Member Functions inherited from IProtocolManager
virtual ~IProtocolManager ()
 Destructor. More...
 

Private Attributes

Communicator const & m_communicator
 
container_type m_protocolHandlers
 

Detailed Description

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.

Member Typedef Documentation

◆ const_iterator

typedef container_type::const_iterator ProtocolManager::const_iterator

A typedef for a const iterator.

Definition at line 92 of file protocolmanager.h.

◆ container_type

A typedef for a container type.

Definition at line 89 of file protocolmanager.h.

◆ value_type

A typedef for a value type.

Definition at line 86 of file protocolmanager.h.

Constructor & Destructor Documentation

◆ ProtocolManager()

ProtocolManager::ProtocolManager ( Communicator const &  communicator)
explicit

Default constructor.

Definition at line 83 of file protocolmanager.cpp.

◆ ~ProtocolManager()

ProtocolManager::~ProtocolManager ( )
throw (
)
virtual

Definition at line 88 of file protocolmanager.cpp.

Member Function Documentation

◆ add()

ProtocolManager::value_type ProtocolManager::add ( IProtocolHandler handler)
virtual

Adds the protocol handler.

Parameters
[in]handlerThe protocol handler to add
Returns
The value type

Definition at line 228 of file protocolmanager.cpp.

◆ begin()

ProtocolManager::const_iterator ProtocolManager::begin ( ) const
Returns
A const interator of the protocol handlers list beginning

Definition at line 94 of file protocolmanager.cpp.

◆ clear()

void ProtocolManager::clear ( )
virtual

Clears the protocol handlers list.

Definition at line 243 of file protocolmanager.cpp.

◆ convertToMessage()

XsMessage ProtocolManager::convertToMessage ( XsProtocolType type,
MessageLocation location,
const XsByteArray raw 
)
overridevirtual

Converts raw data using location into a XsMessage object.

Parameters
[in]typeThe protocol type to use.
[out]locationThe location of a message to convert from raw data.
[in]rawThe raw byte stream.
Returns
A XsMessage object that was converted from raw byte stream.

Implements IProtocolManager.

Definition at line 163 of file protocolmanager.cpp.

◆ end()

ProtocolManager::const_iterator ProtocolManager::end ( ) const
Returns
A const interator of the protocol handlers list end

Definition at line 101 of file protocolmanager.cpp.

◆ find()

ProtocolManager::value_type ProtocolManager::find ( XsProtocolType  type)
virtual

Searches the registered protocol handlers for a handler that matches the given protocol type and returns that handler if present.

Parameters
type: The protocol type to search for
Returns
: (shared) pointer to the matching handler, an invalid shared pointer if there is no matching protocol

Definition at line 202 of file protocolmanager.cpp.

◆ findMessage()

MessageLocation ProtocolManager::findMessage ( XsProtocolType type,
const XsByteArray raw 
)
overridevirtual

Searches for a raw message in a raw data.

Parameters
[out]typeThe protocol type that was used.
[in]rawThe byte array to search in.
Returns
The found message location

Implements IProtocolManager.

Definition at line 111 of file protocolmanager.cpp.

◆ hasProtocol()

bool ProtocolManager::hasProtocol ( XsProtocolType  type) const
virtual
Returns
true when a protocol with type type has been added
Parameters
[in]typeThe protocol type to check

Definition at line 216 of file protocolmanager.cpp.

◆ likelyMinimumMessageSize()

int ProtocolManager::likelyMinimumMessageSize ( ) const
Returns
the minimum message size of the last successful protocol handler

Definition at line 259 of file protocolmanager.cpp.

◆ remove()

bool ProtocolManager::remove ( XsProtocolType  type)
virtual

Removes a protocol handler of a specified type.

Parameters
[in]typeThe type of the protocol handler to remove
Returns
True if successful

Definition at line 176 of file protocolmanager.cpp.

◆ validateMessage()

bool ProtocolManager::validateMessage ( XsMessage const &  message) const
overridevirtual

Check a message for a validity.

Parameters
[in]messageThe message to check
Returns
True if valid

Implements IProtocolManager.

Definition at line 252 of file protocolmanager.cpp.

Member Data Documentation

◆ m_communicator

Communicator const& ProtocolManager::m_communicator
private

Definition at line 116 of file protocolmanager.h.

◆ m_protocolHandlers

container_type ProtocolManager::m_protocolHandlers
private

Definition at line 120 of file protocolmanager.h.


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


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22