Packets: Add packet diagrams
[senf.git] / Packets / VectorParser.hh
index e9378a5..db9e0de 100644 (file)
@@ -23,8 +23,8 @@
 /** \file
     \brief VectorParser public header */
 
-#ifndef HH_VectorParser_
-#define HH_VectorParser_ 1
+#ifndef HH_SENF_Packets_VectorParser_
+#define HH_SENF_Packets_VectorParser_ 1
 
 // Custom includes
 #include <boost/iterator/iterator_facade.hpp>
@@ -54,7 +54,16 @@ namespace senf {
         VectorParser makes use of a policy template argument, \a AuxPolicy, to customize the way the
         containers size is obtained. You will normally not instantiate VectorParser directly, you
         will use the \ref SENF_PARSER_VECTOR() helper macro.
+
+        Some basic vector access methods are defined as parser members. To access the complete list
+        API however you will need to instantiate a container wrapper for the vector. See \ref
+        packet_usage_fields_collection.
         
+        \see
+            \ref How to access \ref packet_usage_fields_collection \n
+            SENF_PARSER_VECTOR() macro used to define vector fields \n
+            VectorParser_Container vector container wrapper API
+
         \ingroup parsecollection
      */
     template <class ElementParser, class AuxPolicy>
@@ -129,7 +138,7 @@ namespace senf {
       */
     template <class ElementParser, class AuxPolicy>
     class VectorParser_Container
-        : private AuxPolicy
+        : private AuxPolicy::WrapperPolicy
     {
     public:
         ///////////////////////////////////////////////////////////////////////////
@@ -236,12 +245,19 @@ namespace senf {
         SENF_PARSER_VECTOR        ( vec,       vec_size_, senf::UInt32Parser );
         \endcode
 
+        \warning Realize, that the \a size field is controlled by the vector parser. This field
+            should therefore be declared either read-only or private and must be changed only via
+            the vector parser.
+
         Further additional tags are supported which modify the way, the \a size field is
         interpreted:
 
         <table class="senf fixedcolumn">
         <tr><td>\c bytes(\a size)</td><td>\a size gives the size of the vector in bytes not the
         number of contained elements</td></tr>
+        
+        <tr><td>\c packetSize()</td><td>Use the size of the packet to get the vector size. The
+        vector will occupy all space up to the end of the packet.</td></tr>
 
         <tr><td>\c transform(\a transform, \a size)</td><td>The \a transform is applied to the \a
         size value, the value is not used directly</td>
@@ -262,12 +278,18 @@ namespace senf {
         The tags are applied to the \a size parameter:
         \code
         SENF_PARSER_VECTOR ( vec, transform(MyTransform, vec_size_), senf::UInt32Parser );
+        SENF_PARSER_VECTOR ( vec, packetSize(), senf::UInt32Parser );
         \endcode
         
         \param[in] name field name
         \param[in] size name of field giving the vector size
         \param[in] elt_type vector element type
 
+        \see 
+            How to use \ref packet_usage_fields_collection \n
+            senf::VectorParser the vector parser API for vector field access
+            senf::VectorParser_Container the vector parser container API for vector field access
+
         \hideinitializer
         \ingroup packetparsermacros
      */
@@ -287,8 +309,8 @@ namespace senf {
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
-#if !defined(HH_Packets__decls_) && !defined(HH_VectorParser_i_)
-#define HH_VectorParser_i_
+#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_VectorParser_i_)
+#define HH_SENF_Packets_VectorParser_i_
 //#include "VectorParser.cci"
 #include "VectorParser.ct"
 #include "VectorParser.cti"