Utils: Revamp documentation overview and add some missing docs
[senf.git] / Packets / Packet.hh
index 0ef0cfd..44dcf2f 100644 (file)
@@ -27,8 +27,8 @@
 // Custom includes
 #include <boost/operators.hpp>
 
-#include "Utils/Exception.hh"
-#include "Utils/SafeBool.hh"
+#include "../Utils/Exception.hh"
+#include "../Utils/safe_bool.hh"
 #include "PacketInterpreter.hh"
 
 //#include "Packet.mpp"
@@ -104,7 +104,7 @@ namespace senf {
 
         Packet is protocol agnostic. This class only provides non-protocol dependent members. To
         access the protocol specific features of a packet (like header fields) the ConcretePacket
-        class extending Packet is povided.
+        class extending Packet is provided.
 
         \section packet_semantics Semantics
         
@@ -128,9 +128,14 @@ namespace senf {
         (protocol). For each implemented protocol, typedefs should be provided for these
         instantiations (Example: \ref EthernetPacket is a typedef for
         \ref ConcretePacket < \ref EthernetPacketType >).
+
+        \see 
+            \ref ConcretePacket for the type specific interface\n
+            \ref PacketData for the sequence interface\n
+            \ref packetparser for a specification of the parser interface
       */
     class Packet
-        : public SafeBool<Packet>,
+        : public safe_bool<Packet>,
           public boost::equality_comparable<Packet>
     {
     public:
@@ -179,6 +184,8 @@ namespace senf {
 
                                      Packet      next() const; 
                                         ///< Get next packet in chain
+                                        /**< \returns in - valid() packet, if no next packet 
+                                             exists */
         template <class OtherPacket> OtherPacket next() const; 
                                         ///< Get next packet of given type in chain
                                         /**< \throws InvalidPacketChainException if no such packet
@@ -187,7 +194,8 @@ namespace senf {
                                         ///< Get next packet of given type in chain
                                         /**< \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
         template <class OtherPacket> OtherPacket findNext() const;
                                         ///< Find next packet of given type in chain
                                         /**< findNext() is like next(), it will however return \c
@@ -200,11 +208,14 @@ namespace senf {
                                              *this if it is of the given type.
                                              \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
         
 
                                      Packet      prev() const; 
                                         ///< Get previous packet in chain
+                                        /**< \returns in - valid() packet, if no previous packet 
+                                             exists */
         template <class OtherPacket> OtherPacket prev() const; 
                                         ///< Get previous packet of given type in chain
                                         /**< \throws InvalidPacketChainException if no such packet
@@ -213,7 +224,8 @@ namespace senf {
                                         ///< Get previous packet of given type in chain
                                         /**< \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
         template <class OtherPacket> OtherPacket findPrev() const;
                                         ///< Find previous packet of given type in chain
                                         /**< findPrev() is like prev(), it will however return \c
@@ -226,7 +238,8 @@ namespace senf {
                                              *this if it is of the type 
                                              \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
 
 
                                      Packet      first() const;
@@ -239,7 +252,8 @@ namespace senf {
                                         ///< Return first packet of given type in chain
                                         /**< \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
 
                                      Packet      last() const;
                                         ///< Return last packet in chain
@@ -251,7 +265,8 @@ namespace senf {
                                         ///< Return last packet of given type in chain
                                         /**< \param[in] nothrow This argument always has the value
                                              \c senf::nothrow
-                                             \returns in-valid() packet, if no such packet is found */
+                                             \returns in - valid() packet, if no such packet is
+                                             found */
 
 
         template <class OtherPacket> OtherPacket parseNextAs() const;
@@ -316,10 +331,12 @@ namespace senf {
         bool boolean_test() const;      ///< Check, whether the packet is valid()
                                         /**< \see valid() */
         bool valid() const;             ///< Check, whether the packet is valid()
-                                        /**< An in-valid() packet does not allow any operation
-                                             except checking vor validity and assignment. in-valid()
-                                             packets serve the same role as 0-pointers. */
-        
+                                        /**< An in - valid() packet does not allow any operation
+                                             except checking for validity and assignment. in -
+                                             valid() packets serve the same role as 0-pointers. 
+                                             
+                                             This is an alias for boolean_test() which is called
+                                             when using a packet in a boolean context. */
 
         void finalize() const;          ///< Update calculated fields
                                         /**< This call will update all calculated fields of the
@@ -337,7 +354,7 @@ namespace senf {
                                         /**< This method is provided mostly to help debugging packet
                                              problems. Each concrete packet should implement a dump
                                              method writing out all fields of the packet in a
-                                             readable reresentation. dump() will call this member
+                                             readable representation. dump() will call this member
                                              for each packet/header/interpreter in the chain from \c
                                              this packet up to the end of the chain. */
 
@@ -349,7 +366,7 @@ namespace senf {
         factory_t factory() const;      ///< Return factory instance of \c this packet
                                         /**< The returned factory instance can be used to create new
                                              packets of the given type without knowing the concrete
-                                             type of the packet. The valid may be stored away for
+                                             type of the packet. The value may be stored away for
                                              later use if needed. */
         
         ///@}
@@ -367,6 +384,7 @@ namespace senf {
         
         template <class PacketType>
         friend class ConcretePacket;
+        friend class PacketParserBase;
     };
 
     /** \brief Protocol specific packet handle
@@ -483,7 +501,7 @@ namespace senf {
                                              \param[in] noinit This parameter must always have the
                                                  value \c senf::noinit. */
         static ConcretePacket createAfter(Packet packet, size_type size);
-                                        ///< Create default initializzed packet after \a packet
+                                        ///< Create default initialized packet after \a packet
                                         /**< This member will create a default initialized packet
                                              with the given size. If the size parameter is smaller
                                              than the minimum allowed packet size an exception will
@@ -575,6 +593,9 @@ namespace senf {
 }
 
 ///////////////////////////////hh.e////////////////////////////////////////
+#endif
+#if !defined(HH_Packets__decls_) && !defined(HH_Packet_i_)
+#define HH_Packet_i_
 #include "Packet.cci"
 #include "Packet.ct"
 #include "Packet.cti"
@@ -590,3 +611,4 @@ namespace senf {
 // compile-command: "scons -u test"
 // comment-column: 40
 // End:
+