cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
cc_tools_qt::MessageBase< TMessageBase, TOptions > Class Template Referenceabstract

#include "cc_tools_qt/MessageBase.h"

Detailed Description

template<template< typename... > class TMessageBase, typename... TOptions>
class cc_tools_qt::MessageBase< TMessageBase, TOptions >

Helper class used to define protocol message interface class in CommsChampion Tools plugin environment.

Extends comms::Message as well as provided interface class, while passing required options to the latter.

Template Parameters
TMessageBaseName of the interface class defined for custom protocol. Expected to inherit (or typedef) from comms::Message and have the following definition:
template <typename... TOptions>
class MyInterfaceClass : public comms::Message<...> {...};
TOptionsAny extra options to be passed the the interface class
Inheritance diagram for cc_tools_qt::MessageBase< TMessageBase, TOptions >:
cc_tools_qt::Message

Public Types

using DataSeq = std::vector< std::uint8_t >
 Type for sequence of raw bytes.
 
using Handler = typename CommsBase::Handler
 Handler class.
 
enum class  Type { Invalid , Received , Sent , NumOfValues }
 Type of the message. More...
 

Public Member Functions

 MessageBase ()=default
 Default constructor.
 
 MessageBase (const MessageBase &)=default
 Copy Constructor.
 
 MessageBase (MessageBase &&)=default
 Move Constructor.
 
 ~MessageBase () noexcept=default
 Destructor.
 
bool assign (const Message &other)
 Assign contents of other message to this ones.
 
bool decodeData (const DataSeq &data)
 Decode (or deserialise) message contents.
 
void dispatch (MessageHandler &handler)
 Dispatch message to message handler used by CommsChampion Tools
 
DataSeq encodeData () const
 Encode (or serialise) message contents.
 
const QVariantList & extraTransportFieldsProperties () const
 Get properties describing message extra transport fields.
 
const QVariantList & fieldsProperties () const
 Get properties describing message fields.
 
QString idAsString () const
 Get string representation of message ID.
 
bool isValid () const
 Check the message contents are valid.
 
const char * name () const
 Get message name.
 
MessageBaseoperator= (const MessageBase &other)
 Copy assignment operator.
 
MessageBaseoperator= (MessageBase &&other)
 Move assignment operator.
 
bool refreshMsg ()
 Refresh message contents.
 
void reset ()
 Reset message contents to default constructed values.
 

Protected Member Functions

virtual bool assignImpl (const Message &other)=0
 Polymophic assignment functionality.
 
virtual bool decodeDataImpl (const DataSeq &data) override
 Overriding polymorphic deserialisation functionaly.
 
virtual void dispatchImpl (MessageHandler &handler)=0
 Polymorphic dispatch functionality.
 
virtual DataSeq encodeDataImpl () const override
 Overriding polymorphic serialisation functionaly.
 
virtual const QVariantList & extraTransportFieldsPropertiesImpl () const
 Polymorphic extra transport fields properties retrieval function.
 
virtual const QVariantList & fieldsPropertiesImpl () const
 Polymorphic fields properties retrieval function.
 
virtual QString idAsStringImpl () const override
 Overriding polymorphic retrieval of the id string.
 
virtual bool isValidImpl () const override
 Overriding polymorphic validity check.
 
virtual const char * nameImpl () const =0
 Polymorphic name retrieval functionality.
 
virtual bool refreshMsgImpl () override
 Overriding polymorphic refresh functionality.
 
virtual void resetImpl ()=0
 Polymorphic reset functionality.
 

Member Typedef Documentation

◆ Handler

template<template< typename... > class TMessageBase, typename... TOptions>
using cc_tools_qt::MessageBase< TMessageBase, TOptions >::Handler = typename CommsBase::Handler

Handler class.

See also
MessageHandler

Member Enumeration Documentation

◆ Type

enum class cc_tools_qt::Message::Type
stronginherited

Type of the message.

Enumerator
Invalid 

Invalid type.

Received 

Message has been received.

Sent 

Message has been sent.

NumOfValues 

Number of available values.

Member Function Documentation

◆ assign()

bool cc_tools_qt::Message::assign ( const Message other)
inherited

Assign contents of other message to this ones.

Returns
true in case the messages are of the same type and the assignement is successful, false othewise. Invokes assignImpl().

◆ assignImpl()

virtual bool cc_tools_qt::Message::assignImpl ( const Message other)
protectedpure virtualinherited

Polymophic assignment functionality.

Invoked by assign().

◆ decodeData()

bool cc_tools_qt::Message::decodeData ( const DataSeq data)
inherited

Decode (or deserialise) message contents.

Invokes decodeDataImpl().

◆ decodeDataImpl()

template<template< typename... > class TMessageBase, typename... TOptions>
virtual bool cc_tools_qt::MessageBase< TMessageBase, TOptions >::decodeDataImpl ( const DataSeq data)
overrideprotectedvirtual

Overriding polymorphic deserialisation functionaly.

Invokes read() inherited from provided interface class.

Implements cc_tools_qt::Message.

◆ dispatch()

void cc_tools_qt::Message::dispatch ( MessageHandler handler)
inherited

Dispatch message to message handler used by CommsChampion Tools

Invokes dispatchImpl()

◆ dispatchImpl()

virtual void cc_tools_qt::Message::dispatchImpl ( MessageHandler handler)
protectedpure virtualinherited

Polymorphic dispatch functionality.

Invoked by dispatch().

◆ encodeData()

DataSeq cc_tools_qt::Message::encodeData ( ) const
inherited

Encode (or serialise) message contents.

Invokes encodeDataImpl().

◆ encodeDataImpl()

template<template< typename... > class TMessageBase, typename... TOptions>
virtual DataSeq cc_tools_qt::MessageBase< TMessageBase, TOptions >::encodeDataImpl ( ) const
overrideprotectedvirtual

Overriding polymorphic serialisation functionaly.

Invokes write() inherited from provided interface class.

Implements cc_tools_qt::Message.

◆ extraTransportFieldsProperties()

const QVariantList & cc_tools_qt::Message::extraTransportFieldsProperties ( ) const
inherited

Get properties describing message extra transport fields.

Invokes extraTransportFieldsPropertiesImpl()

◆ extraTransportFieldsPropertiesImpl()

virtual const QVariantList & cc_tools_qt::Message::extraTransportFieldsPropertiesImpl ( ) const
protectedvirtualinherited

Polymorphic extra transport fields properties retrieval function.

Default implementation returns empty list, should be overriden by the derived classes if message contains at least one extra transport field. Invoked by extraTransportFieldsProperties().

◆ fieldsProperties()

const QVariantList & cc_tools_qt::Message::fieldsProperties ( ) const
inherited

Get properties describing message fields.

Invokes fieldsPropertiesImpl()

◆ fieldsPropertiesImpl()

virtual const QVariantList & cc_tools_qt::Message::fieldsPropertiesImpl ( ) const
protectedvirtualinherited

Polymorphic fields properties retrieval function.

Default implementation returns empty list, should be overriden by the derived classes if message contains at least one field. Invoked by fieldsProperties().

◆ idAsString()

QString cc_tools_qt::Message::idAsString ( ) const
inherited

Get string representation of message ID.

Invokes idAsStringImpl().

◆ idAsStringImpl()

template<template< typename... > class TMessageBase, typename... TOptions>
virtual QString cc_tools_qt::MessageBase< TMessageBase, TOptions >::idAsStringImpl ( ) const
overrideprotectedvirtual

Overriding polymorphic retrieval of the id string.

Invokes getId inherited from the provided interface class and converts it to string.

Implements cc_tools_qt::Message.

◆ isValid()

bool cc_tools_qt::Message::isValid ( ) const
inherited

Check the message contents are valid.

Invokes isValidImpl().

◆ isValidImpl()

template<template< typename... > class TMessageBase, typename... TOptions>
virtual bool cc_tools_qt::MessageBase< TMessageBase, TOptions >::isValidImpl ( ) const
overrideprotectedvirtual

Overriding polymorphic validity check.

Invokes valid() inherited from provided interface class.

Implements cc_tools_qt::Message.

◆ name()

const char * cc_tools_qt::Message::name ( ) const
inherited

Get message name.

Invokes virtual nameImpl().

◆ nameImpl()

virtual const char * cc_tools_qt::Message::nameImpl ( ) const
protectedpure virtualinherited

Polymorphic name retrieval functionality.

Invoked by name().

◆ refreshMsg()

bool cc_tools_qt::Message::refreshMsg ( )
inherited

Refresh message contents.

Needs to be invoked by the CommsChampion Tools when some field get modified. Invokes refreshMsgImpl().

Returns
true, if message contentes where refreshed (other fields changed).

◆ refreshMsgImpl()

template<template< typename... > class TMessageBase, typename... TOptions>
virtual bool cc_tools_qt::MessageBase< TMessageBase, TOptions >::refreshMsgImpl ( )
overrideprotectedvirtual

Overriding polymorphic refresh functionality.

Invokes refresh() inherited from the provided interface class

Implements cc_tools_qt::Message.

◆ resetImpl()

virtual void cc_tools_qt::Message::resetImpl ( )
protectedpure virtualinherited

Polymorphic reset functionality.

Invoked by reset().


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