S
Scott Fraysia
The product I am working on will employ a messaging scheme to
communicate between components. This therefore requires that a message
'mapping' mechanism be implemented to identify and decode messages and
delegate the processing of each message to the appropriate handler.
I have seen how, for instance, MFC uses a set of macros to construct a
'message map', but I would prefer that macros were not used. On first
glance I was thinking along the lines of a member-function
template/functor.
In effect, I'm looking for an extensible OO/Pattern based way of
constructing a mapping of various message 'triggers' to handlers, such
as:
if (message is of type 'a')
call handler for messages of type 'a'
else if (message is from component 'b')
call handler for messages from component 'b'
else if (message contains data of type 'c'
call handler for messages containing data of type 'c'
etc
I was hoping not to have to call each and every handler, as there is
likely to be 100s of components, so calling all handlers for all
components when a message is 'broadcast' would likely become rather
inefficient.
Any ideas on books/pattern references ?
I havent seen any of the GOF patterns matching this really, but then,
I could be mistaken.
Scott.
communicate between components. This therefore requires that a message
'mapping' mechanism be implemented to identify and decode messages and
delegate the processing of each message to the appropriate handler.
I have seen how, for instance, MFC uses a set of macros to construct a
'message map', but I would prefer that macros were not used. On first
glance I was thinking along the lines of a member-function
template/functor.
In effect, I'm looking for an extensible OO/Pattern based way of
constructing a mapping of various message 'triggers' to handlers, such
as:
if (message is of type 'a')
call handler for messages of type 'a'
else if (message is from component 'b')
call handler for messages from component 'b'
else if (message contains data of type 'c'
call handler for messages containing data of type 'c'
etc
I was hoping not to have to call each and every handler, as there is
likely to be 100s of components, so calling all handlers for all
components when a message is 'broadcast' would likely become rather
inefficient.
Any ideas on books/pattern references ?
I havent seen any of the GOF patterns matching this really, but then,
I could be mistaken.
Scott.