X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketRegistry.hh;h=93f951aa3f6a1522b972ee36b28cca141ee701fc;hb=9a988902090d28007578e93bffd809f6bd913155;hp=96370a1b32c7c1dee3ff5e55b04fc0002dc7baf6;hpb=ac6a813d9d99f7add4e13aff7a4bcd314d5604a6;p=senf.git diff --git a/Packets/PacketRegistry.hh b/Packets/PacketRegistry.hh index 96370a1..93f951a 100644 --- a/Packets/PacketRegistry.hh +++ b/Packets/PacketRegistry.hh @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2006 +// Copyright (C) 2006 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) // Kompetenzzentrum fuer Satelitenkommunikation (SatCom) // Stefan Bund @@ -20,7 +20,6 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// TODO: Add parameterless create() method #ifndef HH_PacketRegistryImpl_ #define HH_PacketRegistryImpl_ 1 @@ -44,14 +43,14 @@ namespace senf { The PacketRegistry provides a generic facility to associate an arbitrary key with Packets. Example keys are Ethertype or IP protocols. - + Every PacketRegistry is identified by a type tag: \code struct SomeTag { typedef some_key_type key_t; }; \endcode - The key type can be an arbitrary valuetype. The PacketRegistry + The key type can be an arbitrary value type. The PacketRegistry for this Tag can then be accessed using PacketRegistry::. @@ -69,7 +68,7 @@ namespace senf { Normally, packet classes are registered statically and not procedurally. To this end, the RegistrationProxy is provided: \code - PacketRegistry::RegistrationProxy + PacketRegistry::RegistrationProxy registerSomePacket (key_of_somePacket); \endcode This global variable declaration will register \c SomePacket @@ -79,26 +78,29 @@ namespace senf { constructor during global construction time. The PacketRegistry's purpose is mostly to assist in - implementing the \v v_nextInterpreter() member of packet + implementing the v_nextInterpreter() member of packet facades. This is further supported by the PacketRegistryMixin class. + + \todo Add parameterless create() method */ template class PacketRegistry { public: - // TODO: This fails to work within a library since the linker will - // remove all unused object files ... /** \brief Statically register a packet type in a PacketRegistry + + \fixme This fails to work within a library since the linker will + remove all unused object files ... */ template struct RegistrationProxy { RegistrationProxy(typename Tag::key_t key); }; - + /** \brief Register new packet type - + Register \c OtherPacket in the packet registry \c Tag under the given \c key. @@ -107,14 +109,14 @@ namespace senf { any other packet class in this registry. The Packet must not already be registered in the registry. - \param OtherPacket packet to regiser + \param OtherPacket packet to register \param key key of the packet */ template static void registerPacket(typename Tag::key_t key); /** \brief Find key of a packet - + Return the key of \c OtherPacket as registered in the \c Tag registry @@ -130,17 +132,17 @@ namespace senf { \param key Key of packet type to create instance of \param b begin iterator argument to Packet::create() - \param e end iterator argment to Packet::create() + \param e end iterator argument to Packet::create() \returns new Instance of the packet type registered under key or DataPacket, if the key is not registered. */ template static Packet::ptr create(typename Tag::key_t key, InputIterator b, InputIterator e); - + private: typedef impl::PacketRegistryImpl Registry; static Registry & registry(); - + template friend class PacketRegistryMixin; }; @@ -152,7 +154,7 @@ namespace senf { This mixin class provides a new registerInterpreter implementation which can be used besides the methods provided - bei senf::Packet to add a new interpreter to the + by senf::Packet to add a new interpreter to the interpreter chain. \code @@ -177,14 +179,14 @@ namespace senf { { protected: /** \brief add interpreter to interpreter chain - + This method is used by v_nextInterpreter() to add a new interpreter to the interpreter chain (see the Packet reference for more). Instead of specifying the type of packet to use as a template argument it is specified using the \c key value from the \c Tag registry */ - void registerInterpreter(typename Tag::key_t key, + void registerInterpreter(typename Tag::key_t key, Packet::iterator b, Packet::iterator e) const; }; @@ -202,5 +204,8 @@ namespace senf { // Local Variables: // mode: c++ +// fill-column: 100 // c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" // End: