|
Boost Users : |
From: Asif Lodhi (asif.lodhi_at_[hidden])
Date: 2008-03-28 17:10:14
Hi Robert,
On 3/28/08, Robert Dailey <rcdailey_at_[hidden]> wrote:
> On Thu, Mar 27, 2008 at 11:30 AM, Steven Watanabe <watanabesj_at_[hidden]>
> wrote:
>X .............................................................................................................
> Any suggestions? I'm having trouble thinking outside the box...
Don't you think that _downcasting_ the return value of your factory
method defeats the whole point of using the factory method in the
first place? It looks like that you need to use "parameterized"
factories so that when you read the packet-id, your factory method
instantiates an object of the correct packet class after reading the
packet-id. As regards to sending the packet, it looks like you need to
have some kind of a "dispatcher" class in place which should have a
send method taking a reference of your base packet class as a
parameter. Don't you think it would solve the downcasting problem? If
you do have some functionality in your the child packet classes that
is forcing you to downcast then may be you should rethink your
object-model design.
Don't you think your problem is a case for re-design instead of using Boost?
Just my two cents.
-- Best regards, Asif
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net