unsigned Protocol::serialize(const P &pkt, char *buf, unsigned size) const
{
const PacketTypeDef<P> &pdef = get_packet_by_class<P>();
+ if(!pdef.get_id())
+ throw std::invalid_argument("no packet id");
char *ptr = pdef.serialize(pkt, buf+4, buf+size);
size = ptr-buf;
header_def.serialize(PacketHeader(pdef.get_id(), size), buf, buf+4);
}
-template<typename P>
-unsigned Protocol::PacketTypeDef<P>::class_id = 0;
-
template<typename P>
Protocol::PacketTypeDef<P>::PacketTypeDef(unsigned i):
PacketDefBase(i),