X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fprotocol.h;h=cd68d5148735024eaa77f9ef1ebe06a16064de72;hb=ee01d294f9078fbf17dc6a0a645ad3a342c49b1a;hp=3457a9d7288cf47b915d1e4249cecbc6db3f9c55;hpb=2fbfce0c327c852d33c6713af646abf07b241108;p=libs%2Fnet.git diff --git a/source/net/protocol.h b/source/net/protocol.h index 3457a9d..cd68d51 100644 --- a/source/net/protocol.h +++ b/source/net/protocol.h @@ -14,7 +14,6 @@ class bad_packet: public std::runtime_error { public: bad_packet(const std::string &w): std::runtime_error(w) { } - virtual ~bad_packet() throw() { } }; @@ -22,7 +21,6 @@ class buffer_error: public std::runtime_error { public: buffer_error(const std::string &w): std::runtime_error(w) { } - virtual ~buffer_error() throw() { } }; @@ -165,8 +163,6 @@ private: protected: unsigned id; - static unsigned next_class_id; - PacketDefBase(unsigned); public: virtual ~PacketDefBase() { } @@ -182,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)
{
@@ -286,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()