Skip to content
Hosein Ghahremanzadeh edited this page Sep 8, 2018 · 14 revisions

This is an implementation of messaging design pattern that allows zero-overhead message passing between modules. Each messaging system is made up of an instance of messenger, a set of module instances, and a set of messages.

Usage

Messenger

The messenger handles the message passing to and between modules. Each messaging system should have exactly one messenger. Messenger types is a generic type that should be specialized using the types of modules. The messenger handles the instantiation of each module and calls the default constructor for each module. Messenger is defined in messenger.inl file. The following example demonstrates an example of messenger type specialization.

#pragma once

#include "messenger.inl" //The definition of Messenger::Messenger
#include "test-module-a.inl" //The definition of Test::ModuleA
#include "test-module-b.inl" //The definition of Test::ModuleB

namespace Test
{
	typedef Messenger::Messenger<Test::ModuleA, Test::ModuleB> TestMessenger; //The specialization of Messenger for our use with proper modules.
}```
Clone this wiki locally