some small fixes
[senf.git] / Packets / PacketRegistry.hh
index ef1fa26..8233d66 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+//     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
 #include <map>
 #include <boost/utility.hpp> // for boost::noncopyable
 #include <boost/optional.hpp>
-#include "Utils/Exception.hh"
+#include "../Utils/Exception.hh"
 #include "Packet.hh"
 
 //#include "PacketRegistry.mpp"
@@ -193,6 +193,23 @@ packet of which the key is requested
         static Registry & registry();
     };
 
+    /** \brief Statically add an entry to a packet registry
+
+        This macro will declare an anonymous global variable in such a way, that constructing this
+        variable will add a registration to the given packet registry.
+
+        \hideinitializer
+     */
+#   define SENF_PACKET_REGISTRY_REGISTER( registry, value, type )                                       \
+        namespace {                                                                                     \
+            senf::PacketRegistry< registry >::RegistrationProxy< type >                                 \
+                packetRegistration_ ## __LINE__ ( value );                                              \
+        }
+
+    /** \brief Entry not found in registry
+
+        This exception is signaled whenever a throwing lookup operation fails.
+     */
     struct PacketTypeNotRegisteredException : public std::exception
     { virtual char const * what() const throw() { return "packet type not registered"; } };
 
@@ -200,7 +217,7 @@ packet of which the key is requested
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
-#if !defined(SENF_PACKETS_DECL_ONLY) && !defined(HH_PacketRegistryImpl_i_)
+#if !defined(HH_Packets__decls_) && !defined(HH_PacketRegistryImpl_i_)
 #define HH_PacketRegistryImpl_i_
 //#include "PacketRegistry.cci"
 #include "PacketRegistry.ct"
@@ -218,10 +235,3 @@ packet of which the key is requested
 // comment-column: 40
 // End:
 
-//  LocalWords:  PacketRegistry hh dil Fraunhofer Institut fuer offene FOKUS de
-//  LocalWords:  Kommunikationssysteme Kompetenzzentrum Satelitenkommunikation
-//  LocalWords:  SatCom Bund stefan bund fokus fraunhofer Ethertype IP struct
-//  LocalWords:  SomeTag endcode senf SomePacket registerPacket ingroup param
-//  LocalWords:  registerSomePacket RegistrationProxy namespace PacketType key
-//  LocalWords:  registerPacketType ConcretePacket PacketTypeNotRegistered href
-//  LocalWords:  http www org html