Link statically against boost_unit_test_framework library
[senf.git] / Packets / ParseArray.hh
index 2914c86..b7e40bd 100644 (file)
@@ -20,6 +20,9 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+/** \file
+    \brief ParseArray public header */
+
 #ifndef HH_ParseArray_
 #define HH_ParseArray_ 1
 
     collection parser, what kind of sequence is modelled (e.g. random access sequence, forward
     sequence etc). Most collections will also provide a kind of container wrapper to allow extensive
     manipulations of the collection contents. A container wrapper is initialized with the collection
-    parser and then provides a more complete sequence interface.
-
-    \important Parser lifetime has to be tightly checked when working with collection parsers since
+    parser and then provides a more complete sequence interface. Additionally, the collection
+    wrapper has a longer lifetime than an ordinary parser: While a parser will be invalidated
+    whenever the collection is changed, the container wrapper will stay valid as long as the
+    collection is changed through the wrapper (directly or indirectly, where indirectly means that a
+    sub-field or sub-collection of the collection is changed). Some collections may provide even
+    more lifetime guarantees but this guarantee should be met by all collection wrappers.
+
+    \warning Parser lifetime has to be tightly checked when working with collection parsers since
     \e every change of the collections size will invalidate \e all parsers and iterators referencing
     the \e complete packet chain. Collection wrappers do \e not invalidate if the change is \e after
     the collection.
@@ -87,14 +95,29 @@ namespace senf {
         value_type operator[](difference_type i) const;
     };
 
+    /** \brief Define array field
+
+        This macro is a special helper to define a senf::Parse_Array type field, a fixed size
+        collection of fixed size elements.
+        
+        \param[in] name field name
+        \param[in] elt_type array element type
+        \param[in] size constant number of elements
+        \hideinitializer
+        \ingroup packetparsermacros
+     */
+#   define SENF_PARSER_ARRAY(name, elt_type, size)                                                \
+        typedef senf::Parse_Array<size,elt_type> BOOST_PP_CAT(name, _array_t);                    \
+        SENF_PARSER_FIELD( name, BOOST_PP_CAT(name, _array_t) )
+
 }
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #endif
-#if !defined(SENF_PACKETS_DECL_ONLY) && !defined(HH_ParseArray_i_)
+#if !defined(HH_Packets__decls_) && !defined(HH_ParseArray_i_)
 #define HH_ParseArray_i_
 //#include "ParseArray.cci"
-//#include "ParseArray.ct"
+#include "ParseArray.ct"
 #include "ParseArray.cti"
 #endif