Arbitrary sequential element collection. More...

#include <senf/Packets/ListParser.hh>

Inheritance diagram for senf::ListParser< ListPolicy >:

Public Types

typedef ListPolicy policy
 
typedef ListPolicy::element_type value_type
 
typedef ListPolicy::container_type container_type
 
- Public Types inherited from senf::PacketParserBase
typedef detail::packet::iterator data_iterator
 Raw data iterator type. More...
 
typedef detail::packet::size_type size_type
 Unsigned integral type. More...
 
typedef detail::packet::difference_type difference_type
 Signed integral type. More...
 
typedef detail::packet::byte byte
 Unsigned 8bit value, the raw value type. More...
 
typedef PacketDatastate_type
 Type of the 'state' parameter. More...
 
typedef PacketParserBase parser_base_type
 Base type of the next parser. More...
 

Public Member Functions

 ListParser (data_iterator i, state_type s)
 
 ListParser (ListPolicy policy, data_iterator i, state_type s)
 Additional policy specific constructor. More...
 
size_type bytes () const
 
void init () const
 
container_type container () const
 
size_type size () const
 
bool empty () const
 
value_type front () const
 
value_type back () const
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
template<class Range >
void assign (Range const &range)
 
template<class Value >
void push_back (Value const &value, 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
 
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
 
- Public Member Functions inherited from senf::PacketParserBase
data_iterator i () const
 Return beginning of data to parse. More...
 
data_iterator i (size_type offset) const
 Return iterator offset bytes from the start. More...
 
state_type state () const
 Return state of this parser. More...
 
PacketDatadata () const
 Access the packets raw data container. More...
 
void init () const
 Default implementation. More...
 

Static Public Member Functions

static ListParserget (ListPolicy &p)
 
static ListParser const & get (ListPolicy const &p)
 

Static Public Attributes

static const size_type init_bytes = ListPolicy::init_bytes
 

Additional Inherited Members

- Protected Member Functions inherited from senf::PacketParserBase
ParserProtector protect () const
 
 PacketParserBase (data_iterator i, state_type s)
 Standard constructor. More...
 
 PacketParserBase (data_iterator i, state_type s, size_type size)
 Size checking constructor. More...
 
bool check (size_type size) const
 Check size of data container. More...
 
void validate (size_type size) const
 Validate size of data container. More...
 
template<class Parser >
Parser parse (data_iterator i) const
 Create sub-parser. More...
 
template<class Parser , class Arg >
Parser parse (Arg const &arg, data_iterator i) const
 Create sub-parser. More...
 
template<class Parser >
Parser parse (size_type n) const
 Create sub-parser. More...
 
template<class Parser , class Arg >
Parser parse (Arg const &arg, size_type n) const
 Create sub-parser. More...
 
void defaultInit () const
 Default implementation. More...
 
Packet packet () const
 Get packet this parser is parsing from. More...
 
void resize (size_type oldSize, size_type newSize)
 Resize data container. More...
 

Detailed Description

template<class ListPolicy>
class senf::ListParser< ListPolicy >

Arbitrary sequential element collection.

A List is a sequential collection of elements. The element type is given as an arbitrary parser. The list is more flexible than a vector: It is not limited to fixed-size elements and it might not have direct access to the size of the collection.

The cost is however, that a List is only a model of an STL forward sequence. The parser provides a reduced interface to this sequence, the container wrapper provides the complete interface.

ListParser makes use of a policy template argument, ListPolicy, to customize the way the list is laid out. This policy is given quite some freedom in the list implementation. It is however important, that list elements always follow each other without padding (if padding is needed, it needs to be part of the element parser).

You will normally not instantiate ListParser directly, you will use the SENF_PARSER_LIST() helper macro.

Some basic list access methods are defined as parser members. To access the complete list API however you will need to instantiate a container wrapper for the list. See Collection parsers.

See also
How to access Collection parsers
SENF_PARSER_LIST() macro used to define list fields
ListParser_Container list container wrapper API
ExampleListPolicy

Definition at line 65 of file ListParser.hh.

Member Typedef Documentation

◆ container_type

template<class ListPolicy>
typedef ListPolicy::container_type senf::ListParser< ListPolicy >::container_type

Definition at line 87 of file ListParser.hh.

◆ policy

template<class ListPolicy>
typedef ListPolicy senf::ListParser< ListPolicy >::policy

Definition at line 70 of file ListParser.hh.

◆ value_type

template<class ListPolicy>
typedef ListPolicy::element_type senf::ListParser< ListPolicy >::value_type

Definition at line 86 of file ListParser.hh.

Constructor & Destructor Documentation

◆ ListParser() [1/2]

template<class ListPolicy>
senf::ListParser< ListPolicy >::ListParser ( data_iterator  i,
state_type  s 
)

◆ ListParser() [2/2]

template<class ListPolicy>
senf::ListParser< ListPolicy >::ListParser ( ListPolicy  policy,
data_iterator  i,
state_type  s 
)

Additional policy specific constructor.

This constructor may be used, if the policy needs additional parameters.

Member Function Documentation

◆ assign() [1/2]

template<class ListPolicy>
template<class InputIterator >
void senf::ListParser< ListPolicy >::assign ( InputIterator  first,
InputIterator  last 
)

◆ assign() [2/2]

template<class ListPolicy>
template<class Range >
void senf::ListParser< ListPolicy >::assign ( Range const &  range)

◆ back()

template<class ListPolicy>
value_type senf::ListParser< ListPolicy >::back ( ) const

◆ bytes()

template<class ListPolicy>
size_type senf::ListParser< ListPolicy >::bytes ( ) const

◆ container()

template<class ListPolicy>
container_type senf::ListParser< ListPolicy >::container ( ) const

◆ empty()

template<class ListPolicy>
bool senf::ListParser< ListPolicy >::empty ( ) const

◆ front()

template<class ListPolicy>
value_type senf::ListParser< ListPolicy >::front ( ) const

◆ get() [1/2]

template<class ListPolicy>
static ListParser& senf::ListParser< ListPolicy >::get ( ListPolicy &  p)
static

◆ get() [2/2]

template<class ListPolicy>
static ListParser const& senf::ListParser< ListPolicy >::get ( ListPolicy const &  p)
static

◆ init()

template<class ListPolicy>
void senf::ListParser< ListPolicy >::init ( ) const

◆ push_back()

template<class ListPolicy>
template<class Value >
void senf::ListParser< ListPolicy >::push_back ( Value const &  value,
size_type  n = 1 
) const

◆ push_back_space()

template<class ListPolicy>
value_type senf::ListParser< ListPolicy >::push_back_space ( size_type  n = 1) const

◆ push_front()

template<class ListPolicy>
template<class Value >
void senf::ListParser< ListPolicy >::push_front ( Value const &  value,
size_type  n = 1 
) const

◆ push_front_space()

template<class ListPolicy>
value_type senf::ListParser< ListPolicy >::push_front_space ( size_type  n = 1) const

◆ resize() [1/2]

template<class ListPolicy>
void senf::ListParser< ListPolicy >::resize ( size_type  n) const

◆ resize() [2/2]

template<class ListPolicy>
template<class Value >
void senf::ListParser< ListPolicy >::resize ( size_type  n,
Value  value 
) const

◆ size()

template<class ListPolicy>
size_type senf::ListParser< ListPolicy >::size ( ) const

Member Data Documentation

◆ init_bytes

template<class ListPolicy>
const size_type senf::ListParser< ListPolicy >::init_bytes = ListPolicy::init_bytes
static

Definition at line 81 of file ListParser.hh.


The documentation for this class was generated from the following file: