NEW FILE HEADER / COPYRIGHT FORMAT
[senf.git] / Packets / PacketInterpreter.hh
index 7e5f522..707e4b4 100644 (file)
@@ -1,6 +1,8 @@
+// $Id$
+//
 // Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// 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
 #define HH_PacketInterpreter_ 1
 
 // Custom includes
-#include <boost/intrusive/ilist.hpp>
+#include "../boost/intrusive/ilist.hpp"
 #include <boost/optional.hpp>
 #include <boost/range.hpp>
 #include <boost/type_traits/aligned_storage.hpp>
 #include <boost/type_traits/alignment_of.hpp>
-#include "Utils/intrusive_refcount.hh"
-#include "Utils/pool_alloc_mixin.hh"
+#include "../Utils/intrusive_refcount.hh"
+#include "../Utils/pool_alloc_mixin.hh"
 #include "PacketData.hh"
-#include "typeidvalue.hh"
+#include "../Utils/TypeIdValue.hh"
 
 //#include "PacketInterpreter.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
@@ -42,7 +44,12 @@ namespace senf {
 
     template <class PacketType> class PacketInterpreter;
 
-    /** \brief
+    /** \brief Internal: Base packet interpreter class
+        
+        \internal
+
+        This is the base class for the persistent interpreter. This class encapsulates all the
+        functionality accessible via the packet handle, most handle operations are just forwarded.
       */
     class PacketInterpreterBase
         : protected PacketData, 
@@ -70,6 +77,14 @@ namespace senf {
         enum Prepend_t { Prepend };
         enum NoInit_t { noinit };
 
+        /** \brief Internal: Abstract packet factory
+
+            \internal
+
+            This abstract class provides an abstract packet factory interface. It allows to call
+            almost any one of the create / createAfter / createBefore static PacketInterpreter
+            without static information on the type of packet to create.
+         */
         struct Factory { 
             virtual ~Factory();
 
@@ -168,6 +183,11 @@ namespace senf {
         ptr appendClone(detail::PacketImpl * impl, iterator base, iterator new_base);
         ptr appendClone(detail::PacketImpl * impl, range r);
 
+    public:
+        // Need this for g++ < 4.0. Since PacketInterpreter is not publicly visible, it should not
+        // be a real problem to make impl() public here
+        using PacketData::impl;
+
     private:
         // abstract packet type interface
 
@@ -194,9 +214,16 @@ namespace senf {
         friend class intrusive_refcount_t<PacketInterpreterBase>;
         template <class PacketType> friend class PacketInterpreter;
         friend class detail::packet::test::TestDriver;
+        friend class PacketParserBase;
     };
 
-    /** \brief Concrete packet interpreter
+    /** \brief Internal: Concrete packet interpreter
+
+        \internal
+
+        Instantiations of this class build the interpreter chain. This class is accessed by the
+        packet handles. It provides the packet-type specific functionality in addition to the
+        interface defined in the PacketInterpreterBase class.
 
         \see PacketTypeBase for the \a PacketType interface
       */
@@ -296,6 +323,12 @@ namespace senf {
 
         // factory
 
+        /** \brief Internal: Implementation of abstract factory interface
+            
+            \internal
+
+            Implements the abstract factory interface for \a PacketType
+         */
         struct FactoryImpl : public Factory {
             // Create completely new packet
 
@@ -341,12 +374,20 @@ namespace senf {
         friend class FactoryImpl;
     };
 
+    /** \brief Invalid packet chain operation
+
+        This exception signals an invalid operation on the chain like trying to find a non-existent
+        chain member and other similar error conditions. 
+     */
     struct InvalidPacketChainException : public std::exception
     { virtual char const * what() const throw() { return "invalid packet chain"; } };
     
 }
 
 ///////////////////////////////hh.e////////////////////////////////////////
+#endif
+#if !defined(HH_Packets__decls_) && !defined(HH_PacketInterpreter_i_)
+#define HH_PacketInterpreter_i_
 #include "PacketInterpreter.cci"
 #include "PacketInterpreter.ct"
 #include "PacketInterpreter.cti"
@@ -359,4 +400,6 @@ namespace senf {
 // c-file-style: "senf"
 // indent-tabs-mode: nil
 // ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
 // End: