
- Forum
- Testing
- Software Patterns
- Message dispatch problem
Message dispatch problem
This is a discussion on Message dispatch problem within the Software Patterns forums, part of the Testing category; Hello, I need some advice about the following C++ situation: there are two classes, A and B. A knows nothing ...
-
09-06-2005, 08:11 PM #1Karel Miklav Guest
Message dispatch problem
Hello, I need some advice about the following C++ situation: there
are two classes, A and B. A knows nothing about B, but it passes
messages to B, which they both understand. How should I implement
dispatch of these messages in class B? Here are some common but
not good enough solutions:
1. put type enum in messages and implement message as a union
a-la xlib events, dispatch in a loop on type enum
2. make messages polymorphic classes and dispatch on RTTI in a
loop
3. make massages polymorphic classes with common dispatch interface
The third solution looks kind-a nice, but it exposes details of
class B to class A. Is there some well known solution for this
problem?
--
Regards,
Karel Miklav
-
09-07-2005, 02:23 AM #2Nick Malik [Microsoft] Guest
Re: Message dispatch problem
http://sern.ucalgary.ca/courses/SENG...serverLib.html
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Karel Miklav" <karel@lovetemple.adbloccker.net> wrote in message
news:dfl7mn01gbv@enews1.newsguy.com...
> Hello, I need some advice about the following C++ situation: there
> are two classes, A and B. A knows nothing about B, but it passes
> messages to B, which they both understand. How should I implement
> dispatch of these messages in class B? Here are some common but
> not good enough solutions:
>
> 1. put type enum in messages and implement message as a union
> a-la xlib events, dispatch in a loop on type enum
> 2. make messages polymorphic classes and dispatch on RTTI in a
> loop
> 3. make massages polymorphic classes with common dispatch interface
>
> The third solution looks kind-a nice, but it exposes details of
> class B to class A. Is there some well known solution for this
> problem?
>
> --
>
> Regards,
> Karel Miklav
-
09-08-2005, 01:00 AM #3Karel Miklav Guest
Re: Message dispatch problem
Nick Malik [Microsoft] wrote:
> http://sern.ucalgary.ca/courses/SENG...serverLib.html
Hm, it looks more like command pattern to me. But even then I cannot
completely solve the problem of dispatch - I'd like it to be a matter of
virtual function call or two... Thanks nick for pointing me in the righ
direction, I need some more time now.
--
Regards,
Karel Miklav
-
Sponsored Ads

Reply With Quote





