#include "PacketParser.hh"
//#include "ListParser.mpp"
-///////////////////////////////hh.p////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
namespace senf {
API however you will need to instantiate a container wrapper for the list. See \ref
packet_usage_fields_collection.
- \see
- \ref How to access \ref packet_usage_fields_collection
+ \see
+ How to access \ref packet_usage_fields_collection \n
SENF_PARSER_LIST() macro used to define list fields \n
ListParser_Container list container wrapper API \n
ExampleListPolicy
static const size_type init_bytes = ListPolicy::init_bytes;
- ///////////////////////////////////////////////////////////////////////////
+ //-////////////////////////////////////////////////////////////////////////
// Container interface
typedef typename ListPolicy::element_type value_type;
value_type back() const;
template <class Value> void push_back (Value const & value, size_type n=1) const;
- void push_back_space (size_type n=1) const;
+ value_type push_back_space (size_type n=1) const;
template <class Value> void push_front (Value const & value, size_type n=1) const;
- void push_front_space (size_type n=1) const;
+ value_type push_front_space (size_type n=1) const;
void resize (size_type n) const;
template <class Value> void resize (size_type n, Value value) const;
This is the container wrapper used for list parsers. The container wrapper will stay valid
after changing the collection. However the container still depends on the packet and will be
invalidated if the Packet is deallocated or if the packet size is changed from without the
- container wrapper (more precisely, it is invalided if the insertion/deletion happens before
+ container wrapper (more precisely, it is invalidated if the insertion/deletion happens before
the vector in the packet data).
The vector container wrapper provides a complete STL random-access sequence interface.
: private ListPolicy
{
public:
- ///////////////////////////////////////////////////////////////////////////
+ //-////////////////////////////////////////////////////////////////////////
// Types
typedef ListPolicy policy;
typedef iterator const_iterator;
typedef PacketParserBase::state_type state_type;
- ///////////////////////////////////////////////////////////////////////////
+ //-////////////////////////////////////////////////////////////////////////
///\name Structors and default members
- ///@{
+ //\{
// no default constructor
// default copy
ListParser_Container(parser_type const & list);
~ListParser_Container();
- ///@}
- ///////////////////////////////////////////////////////////////////////////
+ //\}
+ //-////////////////////////////////////////////////////////////////////////
///\name Accessors
- ///@{
+ //\{
size_type size() const;
bool empty() const;
value_type front() const;
value_type back() const;
- ///@}
+ //\}
///\name Mutators
- ///@{
+ //\{
// All these operations can be quite inefficient depending on the list type
- void shift(iterator pos, size_type n=1);
+ value_type shift(iterator pos, size_type n=1);
template <class Value>
void insert(iterator pos, Value const & t);
template <class Value>
void clear();
template <class Value> void push_back (Value const & value, size_type n=1);
- void push_back_space (size_type n=1);
+ value_type push_back_space (size_type n=1);
template <class Value> void push_front (Value const & value, size_type n=1);
- void push_front_space (size_type n=1);
- void resize (size_type n);
+ value_type push_front_space (size_type n=1);
+ void resize (size_type n);
template <class Value> void resize (size_type n, Value value);
- ///@}
+ //\}
///\name Parser interface
- ///@{
+ //\{
parser_type parser() const;
data_iterator i() const;
size_type bytes() const;
void init() const;
- ///@}
+ //\}
private:
friend class detail::ListParser_Iterator<ListParser_Container>;
// Define the list
SENF_PARSER_LIST ( list, list_size_, EltParser );
\endcode
-
+
Here \c EltParser can be an arbitrary parser and need not have a fixed size.
\warning Realize, that the \a size field is controlled by the list parser. This field
<tr><td>\c transform(\a transform, \c bytes(\a size))</td><td>The \a transform is applied to
the \a size value. The value is then interpreted containing the list size in bytes not
- number of elements</td>
+ number of elements</td>
</table>
The optional \a transform is a class with the following layout
static value_type get(other_type v);
static other_type set(value_type v);
};
- \endcode
+ \endcode
\c other_type is \a size ::\c value_type, the type of the value returned by the \a size
field, whereas the \c value_type typedef is the arbitrary return type of the transform.
\param[in] size name of field giving the list size
\param[in] elt_type list element type
- \see
+ \see
How to use \ref packet_usage_fields_collection \n
senf::ListParser the list parser API for list field access
senf::ListParser_Container the list parser container API for list field access
}
-///////////////////////////////hh.e////////////////////////////////////////
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
#endif
#if !defined(HH_SENF_Packets_Packets__decls_) && !defined(HH_SENF_Packets_ListParser_i_)
#define HH_SENF_Packets_ListParser_i_