X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketRegistry.ih;h=94b9169d903513cbff4c452544d1c7dc29335275;hb=47368f306a577d1e46df69a7f729bd3893cbe5e7;hp=2a752b2c68e15c6f6bdcd9473cfe0e6ebd056875;hpb=c52cd7d87dbb525c1267aad27391b8b7365dbb57;p=senf.git diff --git a/Packets/PacketRegistry.ih b/Packets/PacketRegistry.ih index 2a752b2..94b9169 100644 --- a/Packets/PacketRegistry.ih +++ b/Packets/PacketRegistry.ih @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -24,42 +24,33 @@ #define IH_PacketRegistryImpl_ 1 // Custom includes -#include "Packet.hh" -#include "DataPacket.hh" +#include #include "typeidvalue.hh" ///////////////////////////////ih.p//////////////////////////////////////// -namespace satcom { -namespace pkf { -namespace impl { +namespace senf { +namespace detail { - struct PkReg_Entry { - virtual void registerInterpreter(Packet const * p, - Packet::iterator b, Packet::iterator e) = 0; - virtual Packet::ptr reinterpret(Packet * p) = 0; - }; - - template + template struct PkReg_EntryImpl : public PkReg_Entry { - virtual void registerInterpreter(Packet const * p, Packet::iterator b, Packet::iterator e); - virtual Packet::ptr reinterpret(Packet * p); + virtual PacketInterpreterBase::factory_t factory() const; }; - template - class PacketRegistryImpl : private boost::noncopyable + class PacketRegistryImpl + : private boost::noncopyable { public: /////////////////////////////////////////////////////////////////////////// // Types - + typedef KeyType key_t; - typedef impl::PkReg_Entry Entry; - + typedef PkReg_Entry Entry; + /////////////////////////////////////////////////////////////////////////// ///\name Structors and default members ///@{ @@ -73,30 +64,27 @@ namespace impl { ///@} /////////////////////////////////////////////////////////////////////////// - template + template void registerPacket(key_t key); - key_t key(satcom::lib::TypeIdValue const & type); + key_t key(senf::TypeIdValue const & type); + boost::optional key(senf::TypeIdValue const & type, bool); - Entry * lookup(key_t key); + Entry const & lookup(key_t key); + Entry const * lookup(key_t key, bool); protected: private: - template - static void registerInterpreter(Packet * p, Packet::iterator b, Packet::iterator e); - - typedef boost::shared_ptr Entry_ptr; + typedef boost::intrusive_ptr Entry_ptr; typedef std::map PacketMap; - typedef std::map ReversePacketMap; + typedef std::map ReversePacketMap; PacketMap registry_; ReversePacketMap reverseRegistry_; }; - extern PkReg_EntryImpl pkreg_dataEntry; - -}}} +}} ///////////////////////////////ih.e//////////////////////////////////////// #endif @@ -104,5 +92,10 @@ namespace impl { // Local Variables: // mode: c++ -// c-file-style: "satcom" +// fill-column: 100 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: