Kanzi 3.9.10
kanzi::DynamicMessageType< TArgumentsClass > Class Template Reference

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

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

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

Public Member Functions

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

Additional Inherited Members

- Public Types inherited from kanzi::MessageType< TArgumentsClass >
using ArgumentsType
 Alias for associated message arguments class.
 
using FunctionType
 Alias for compatible handler functions.
 
- Static Public Member Functions inherited from kanzi::MessageType< TArgumentsClass >
static const MetaclassgetArgumentsMetaclass ()
 Gets the metaclass of the message arguments associated with the message type.
 
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.
 
- Protected Member Functions inherited from kanzi::MessageType< TArgumentsClass >
 MessageType ()=default
 Constructor.
 
- Protected Attributes inherited from kanzi::MessageType< TArgumentsClass >
const AbstractMessageTypeDescriptorm_descriptor
 Describes the name, routing, and message arguments metaclass of the message type.
 

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

◆ DynamicMessageType() [1/2]

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.

◆ DynamicMessageType() [2/2]

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.

◆ ~DynamicMessageType()


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