Kanzi 3.9.10
kanzi::MessageType< TArguments > Class Template Reference

An instance of a MessageType represents a single message type in the Kanzi message system. More...

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

Public Types

using ArgumentsType
 Alias for associated message arguments class.
 
using FunctionType
 Alias for compatible handler functions.
 

Public Member Functions

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.
 

Static Public Member Functions

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

 MessageType ()=default
 Constructor.
 

Protected Attributes

const AbstractMessageTypeDescriptorm_descriptor
 Describes the name, routing, and message arguments metaclass of the message type.
 

Friends

class AbstractMessageType
 
template<typename T >
class DynamicMessageType
 

Detailed Description

template<class TArguments>
class kanzi::MessageType< TArguments >

An instance of a MessageType represents a single message type in the Kanzi message system.

A message type exists throughout the lifetime of an application.

To work with the existing message types in the Kanzi message system, use the DynamicMessageType and AbstractMessageType classes.

Examples

To declare a new message type:

// Define an example node, which introduces a new static message type to the Kanzi message system.
class ExampleNode2D : public EmptyNode2D
{
public:
// To introduce a static message type to the Kanzi message system, use the
// MessageType declaration in your class.
// For example, declare a message type whose arguments type is the base
// class of Kanzi message arguments, MessageArguments.
static MessageType<MessageArguments> ExampleMessage;
// In the Kanzi Engine register the ExampleNode2D derived from the Node2D and the
// ExampleMessage message type.
// For more information about the metadata system in Kanzi, see the Node and Metaclass classes.
KZ_METACLASS_BEGIN(ExampleNode2D, Node2D, "MyNamespace.ExampleNode2D")
KZ_METACLASS_MESSAGE_TYPE(ExampleMessage)
// ...

To define a new message type:

// In the ExampleNode2D node type define a message type whose message arguments type is the MessageArguments
// base class, is named "ExampleMessage", and has a fully qualified name "ExampleNode2D.ExampleMessage".
//
// For example, use these MessageType constructor arguments to define a message type:
// - The first argument sets the fully qualified name. For example, set the fully qualified
// name to "ExampleNode2D.ExampleMessage".
// - The second argument sets the message routing mode. This argument defines how messages
// of this type travel in the node tree. For more information on message dispatching, see Node.
// - The third argument sets the metadata for this message type that Kanzi Studio uses. For the list of all
// available metadata attributes in Kanzi documentation see Reference > Reference for showing Kanzi Engine
// plugin custom types in Kanzi Studio.
// - displayName sets a user-friendly name that users can see in the Triggers window in Kanzi Studio.
// - tooltip sets the text shown when users hover over the name of this message type in Kanzi Studio.
// - category sets the category where users can see the message in Kanzi Studio.
// If you do not want users to access a message type in Kanzi Studio, pass an empty
// PropertyTypeEditorInfoSharedPtr shared pointer.
MessageType<MessageArguments> ExampleNode2D::ExampleMessage(
kzMakeFixedString("ExampleNode2D.ExampleMessage"),
MessageRoutingTunnelingBubbling,
metadata.displayName = "Example message";
metadata.tooltip = "Message used as an example.";
metadata.category = "Examples";));
See also
For examples that demonstrate adding and removal of message handlers, or dispatching messages, see Node.

Member Typedef Documentation

◆ ArgumentsType

template<class TArguments >
using kanzi::MessageType< TArguments >::ArgumentsType

Alias for associated message arguments class.

◆ FunctionType

template<class TArguments >
using kanzi::MessageType< TArguments >::FunctionType

Alias for compatible handler functions.

Constructor & Destructor Documentation

◆ MessageType() [1/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( FixedString name,
MessageRouting routing,
PropertyTypeEditorInfoSharedPtr editorInfo )
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a FixedString.
routingMessage routing mode for the message type.
editorInfoSets the editor information for this message type that Kanzi Studio uses.

◆ MessageType() [2/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( MetadataGeneratedName name,
MessageRouting routing,
PropertyTypeEditorInfoSharedPtr editorInfo )
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a MetadataGeneratedName.
routingMessage routing mode for the message type.
editorInfoSets the editor information for this message type that Kanzi Studio uses.

◆ MessageType() [3/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( FixedString name)
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a FixedString.

◆ MessageType() [4/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( MetadataGeneratedName name)
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a MetadataGeneratedName.

◆ MessageType() [5/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( FixedString name,
PropertyTypeEditorInfoSharedPtr editorInfo )
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a FixedString.
editorInfoSets the editor information for this message type that Kanzi Studio uses.

◆ MessageType() [6/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( MetadataGeneratedName name,
PropertyTypeEditorInfoSharedPtr editorInfo )
inlineexplicit

Constructor.

Parameters
nameFully qualified name for the message type as a MetadataGeneratedName.
editorInfoSets the editor information for this message type that Kanzi Studio uses.

◆ ~MessageType()

Destructor.

◆ MessageType() [7/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( const MessageType< TArguments > & )
delete

Deleted copy constructor.

◆ MessageType() [8/8]

template<class TArguments >
kanzi::MessageType< TArguments >::MessageType ( )
explicitprotecteddefault

Constructor.

Used by DynamicMessageType.

Member Function Documentation

◆ operator AbstractMessageType()

Conversion operator to AbstractMessageType.

Returns
The message type as an AbstractMessageType.

◆ getName()

template<class TArguments >
string kanzi::MessageType< TArguments >::getName ( ) const
inline

Gets the fully qualified name of the message type in the form "Class.MessageType".

Returns
The fully qualified name of the message type.

◆ getRouting()

template<class TArguments >
MessageRouting kanzi::MessageType< TArguments >::getRouting ( ) const
inline

Gets the message routing of the message type.

Returns
MessageRouting mode of the message type.

◆ getArgumentsMetaclass()

template<class TArguments >
static const Metaclass * kanzi::MessageType< TArguments >::getArgumentsMetaclass ( )
inlinestatic

Gets the metaclass of the message arguments associated with the message type.

Returns
The Metaclass pointer of the message arguments associated with the MessageType.

◆ get()

Gets the AbstractMessageTypeDescriptor of the message type.

Returns
The AbstractMessageTypeDescriptor pointer of the MessageType.

◆ getEditorInfo()

template<class TArguments >
PropertyTypeEditorInfoSharedPtr kanzi::MessageType< TArguments >::getEditorInfo ( ) const
inline

Gets the editor information for the message type.

Returns
The editor information for the message type.

◆ hasCustomArgumentsClass()

template<class TArguments >
static constexpr bool kanzi::MessageType< TArguments >::hasCustomArgumentsClass ( )
inlinestaticconstexpr

Returns whether the message arguments class associated with the message type is a custom message arguments class or the base MessageArguments class.

Returns
If the message arguments class is a custom class, true, otherwise false.

◆ operator=()

Deleted assignment.

Friends And Related Symbol Documentation

◆ AbstractMessageType

◆ DynamicMessageType

template<class TArguments >
template<typename T >
friend class DynamicMessageType
friend

Member Data Documentation

◆ m_descriptor

Describes the name, routing, and message arguments metaclass of the message type.


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