Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-29 16:21:49


AMDG

Robert Dailey wrote:
> Is there any reason why the ID needs to be available at runtime?
> Instead of your specialization, I do:
>
> class WalkPacket : Packet
> {
> static const PacketId ID = PID_WALKPACKET;
> };
>
> Is there any reason why this isn't sufficient?

The dispatcher needs to know what the ID of a packet is to
do its job. The idea is that instead of passing the ID and the packet
separately,
the packet knows its own ID. It is possible, though to replace the ID
type with
std::string in the dispatcher and use std::string(typeid(packet).name())
avoiding the ID's entirely inside the dispatcher.

In Christ,
Steven Watanabe


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