X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fnet%2Fprotocol.h;h=cd68d5148735024eaa77f9ef1ebe06a16064de72;hb=ee01d294f9078fbf17dc6a0a645ad3a342c49b1a;hp=fa90e6d250d87531fdc01069a90fe0cab6a90352;hpb=b91b37fd6534a8e546fd6f5d6ddd91d66cd0519f;p=libs%2Fnet.git diff --git a/source/net/protocol.h b/source/net/protocol.h index fa90e6d..cd68d51 100644 --- a/source/net/protocol.h +++ b/source/net/protocol.h @@ -163,8 +163,6 @@ private: protected: unsigned id; - static unsigned next_class_id; - PacketDefBase(unsigned); public: virtual ~PacketDefBase() { } @@ -180,14 +178,11 @@ private: private: CompoundTypeDef
*compound; - static unsigned class_id; - public: PacketTypeDef(unsigned); ~PacketTypeDef(); - static unsigned get_static_class_id() { return class_id; } - virtual unsigned get_class_id() const { return class_id; } + virtual unsigned get_class_id() const { return get_packet_class_id
(); }
template > Protocol::add(unsigned id)
{
@@ -284,7 +291,7 @@ Protocol::PacketDefBuilder > Protocol::add()
template &Protocol::get_packet_by_class() const
{
- const PacketDefBase &pdef = get_packet_by_class_id(PacketTypeDef ::get_static_class_id());
+ const PacketDefBase &pdef = get_packet_by_class_id(get_packet_class_id ());
return static_cast ::PacketTypeDef(unsigned i):
PacketDefBase(i),
compound(new CompoundDef >(NullSerializer ()))
-{
- if(!class_id)
- class_id = next_class_id++;
-}
+{ }
template ::~PacketTypeDef()