Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::DynamicMessageType< TArgumentsClass > Class Template Reference

DynamicMessageType is a handle to an existing message type. More...

#include <kanzi/core/message/message_type.hpp>

Inheritance diagram for kanzi::DynamicMessageType< TArgumentsClass >:
[legend]

Public Member Functions

 DynamicMessageType (string_view name)
 Constructor. More...
 
 DynamicMessageType (AbstractMessageType abstractMessageType)
 Constructor. More...
 
 ~DynamicMessageType ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::MessageType< TArgumentsClass >
const AbstractMessageTypeDescriptorget () const
 Gets the AbstractMessageTypeDescriptor of the message type. More...
 
PropertyTypeEditorInfoSharedPtr getEditorInfo () const
 Gets the editor information for the message type. More...
 
string getName () const
 Gets the fully qualified name of the message type in the form "Class.MessageType". More...
 
MessageRouting getRouting () const
 Gets the message routing of the message type. More...
 
 MessageType (FixedString name, MessageRouting routing, PropertyTypeEditorInfoSharedPtr editorInfo)
 Constructor. More...
 
 MessageType (MetadataGeneratedName name, MessageRouting routing, PropertyTypeEditorInfoSharedPtr editorInfo)
 Constructor. More...
 
 MessageType (FixedString name)
 Constructor. More...
 
 MessageType (MetadataGeneratedName name)
 Constructor. More...
 
 MessageType (FixedString name, PropertyTypeEditorInfoSharedPtr editorInfo)
 Constructor. More...
 
 MessageType (MetadataGeneratedName name, PropertyTypeEditorInfoSharedPtr editorInfo)
 Constructor. More...
 
 MessageType (const MessageType &)=delete
 Deleted copy constructor. More...
 
 operator AbstractMessageType () const
 Conversion operator to AbstractMessageType. More...
 
MessageTypeoperator= (const MessageType &)=delete
 Deleted assignment. More...
 
 ~MessageType ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::MessageType< TArgumentsClass >
using ArgumentsType = TArgumentsClass
 Alias for associated message arguments class. More...
 
using FunctionType = function< void(ArgumentsType &)>
 Alias for compatible handler functions. More...
 
- Static Public Member Functions inherited from kanzi::MessageType< TArgumentsClass >
static const MetaclassgetArgumentsMetaclass ()
 Gets the metaclass of the message arguments associated with the message type. More...
 
static constexpr bool hasCustomArgumentsClass ()
 Returns whether the message arguments class associated with the message type is a custom message arguments class or the base MessageArguments class. More...
 
- Protected Member Functions inherited from kanzi::MessageType< TArgumentsClass >
 MessageType ()=default
 Constructor. More...
 
- Protected Attributes inherited from kanzi::MessageType< TArgumentsClass >
const AbstractMessageTypeDescriptorm_descriptor
 Describes the name, routing, and message arguments metaclass of the message type. More...
 

Detailed Description

template<typename TArgumentsClass>
class kanzi::DynamicMessageType< TArgumentsClass >

DynamicMessageType is a handle to an existing message type.

You can use it to add and remove a message handler or to dispatch a message of that type on a node.

You can use a DynamicMessageType to access message types when you have their message arguments and fully qualified name. When you do not have a fully qualified name or message arguments of a message type, or they are irrelevant, to access message types, use the AbstractMessageType type.

See also
To learn how to create a Kanzi message type, see MessageType.

Examples

To create for an existing message type a DynamicMessageType with a fully qualified name:

// You can create a dynamic message type handle to an existing message type by using the fully qualified name.
DynamicMessageType<ButtonConcept::ClickedMessageArguments> clickedMessage("Message.Button.Click");

To add a message handler with DynamicMessageType:

// To add and remove message handlers, you need either:
// - DynamicMessageType object that refers to an existing message type.
// - MessageType object. For example, ButtonConcept::ClickedMessage.
Node::MessageSubscriptionToken token = node->addMessageHandler(clickedMessage, node.get(), &ExampleNode2D::exampleCallback);

Constructor & Destructor Documentation

template<typename TArgumentsClass >
kanzi::DynamicMessageType< TArgumentsClass >::DynamicMessageType ( string_view  name)
inlineexplicit

Constructor.

Creates a DynamicMessageType instance that refers to the same existing message type as the given name.

Parameters
nameFully qualified name of an existing message type in the Kanzi message system.
Exceptions
logic_errorif there is no message type with the given name in the Kanzi message system or the message arguments do not match the existing message type with the given name.
template<typename TArgumentsClass >
kanzi::DynamicMessageType< TArgumentsClass >::DynamicMessageType ( AbstractMessageType  abstractMessageType)
inlineexplicit

Constructor.

Creates a DynamicMessageType instance that refers to the same existing message type as the given AbstractMessageType instance does.

Parameters
abstractMessageTypeAbstractMessageType instance that refers to the existing message type in the Kanzi message system.
Exceptions
logic_errorif the message arguments do not match the existing message type to which the given AbstractMessageType refers or if the given AbstractMessageType is null.
template<typename TArgumentsClass >
kanzi::DynamicMessageType< TArgumentsClass >::~DynamicMessageType ( )
inline

Destructor.


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