senf::VectorParser< ElementParser, AuxPolicy > Struct Template Reference

Collection of fixed-size elements. More...

#include <senf/Packets/VectorParser.hh>

Inheritance diagram for senf::VectorParser< ElementParser, AuxPolicy >:

Public Types

typedef ElementParser value_type
 
typedef detail::ArrayParser_iterator< value_typeiterator
 
typedef iterator const_iterator
 
typedef VectorParser_Container< ElementParser, AuxPolicy > 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

 VectorParser (data_iterator i, state_type s)
 
 VectorParser (AuxPolicy policy, data_iterator i, state_type s)
 Additional sizer specific constructor. More...
 
size_type bytes () const
 
void init () const
 
container_type container () const
 
size_type size () const
 
bool empty () const
 
iterator begin () const
 
iterator end () const
 
value_type operator[] (difference_type i) const
 
value_type front () const
 
value_type back () const
 
template<class InputIterator >
void assign (InputIterator first, InputIterator last)
 
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 Attributes

static const size_type init_bytes = AuxPolicy::aux_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 ElementParser, class AuxPolicy>
struct senf::VectorParser< ElementParser, AuxPolicy >

Collection of fixed-size elements.

A Vector is a collection of fixed-size elements of which the size of the collection can be determined directly (that is without traversing the collection). This allows very efficient random access to the elements of the collection.

A vector is a model of an STL random-access sequence. The parser only provides a reduced interface, the container wrapper however completes this interface.

VectorParser makes use of a policy template argument, AuxPolicy, to customize the way the containers size is obtained. You will normally not instantiate VectorParser directly, you will use the 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 Collection parsers.

See also
How to access Collection parsers
SENF_PARSER_VECTOR() macro used to define vector fields
VectorParser_Container vector container wrapper API

Definition at line 58 of file VectorParser.hh.

Member Typedef Documentation

◆ const_iterator

template<class ElementParser , class AuxPolicy >
typedef iterator senf::VectorParser< ElementParser, AuxPolicy >::const_iterator

Definition at line 78 of file VectorParser.hh.

◆ container_type

template<class ElementParser , class AuxPolicy >
typedef VectorParser_Container<ElementParser,AuxPolicy> senf::VectorParser< ElementParser, AuxPolicy >::container_type

Definition at line 79 of file VectorParser.hh.

◆ iterator

template<class ElementParser , class AuxPolicy >
typedef detail::ArrayParser_iterator<value_type> senf::VectorParser< ElementParser, AuxPolicy >::iterator

Definition at line 77 of file VectorParser.hh.

◆ value_type

template<class ElementParser , class AuxPolicy >
typedef ElementParser senf::VectorParser< ElementParser, AuxPolicy >::value_type

Definition at line 76 of file VectorParser.hh.

Constructor & Destructor Documentation

◆ VectorParser() [1/2]

template<class ElementParser , class AuxPolicy >
senf::VectorParser< ElementParser, AuxPolicy >::VectorParser ( data_iterator  i,
state_type  s 
)

◆ VectorParser() [2/2]

template<class ElementParser , class AuxPolicy >
senf::VectorParser< ElementParser, AuxPolicy >::VectorParser ( AuxPolicy  policy,
data_iterator  i,
state_type  s 
)

Additional sizer specific constructor.

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

Member Function Documentation

◆ assign()

template<class ElementParser , class AuxPolicy >
template<class InputIterator >
void senf::VectorParser< ElementParser, AuxPolicy >::assign ( InputIterator  first,
InputIterator  last 
)

◆ back()

template<class ElementParser , class AuxPolicy >
value_type senf::VectorParser< ElementParser, AuxPolicy >::back ( ) const

◆ begin()

template<class ElementParser , class AuxPolicy >
iterator senf::VectorParser< ElementParser, AuxPolicy >::begin ( ) const

◆ bytes()

template<class ElementParser , class AuxPolicy >
size_type senf::VectorParser< ElementParser, AuxPolicy >::bytes ( ) const

◆ container()

template<class ElementParser , class AuxPolicy >
container_type senf::VectorParser< ElementParser, AuxPolicy >::container ( ) const

◆ empty()

template<class ElementParser , class AuxPolicy >
bool senf::VectorParser< ElementParser, AuxPolicy >::empty ( ) const

◆ end()

template<class ElementParser , class AuxPolicy >
iterator senf::VectorParser< ElementParser, AuxPolicy >::end ( ) const

◆ front()

template<class ElementParser , class AuxPolicy >
value_type senf::VectorParser< ElementParser, AuxPolicy >::front ( ) const

◆ init()

template<class ElementParser , class AuxPolicy >
void senf::VectorParser< ElementParser, AuxPolicy >::init ( ) const

◆ operator[]()

template<class ElementParser , class AuxPolicy >
value_type senf::VectorParser< ElementParser, AuxPolicy >::operator[] ( difference_type  i) const

◆ push_back()

template<class ElementParser , class AuxPolicy >
template<class Value >
void senf::VectorParser< ElementParser, AuxPolicy >::push_back ( Value const &  value,
size_type  n = 1 
) const

◆ push_back_space()

template<class ElementParser , class AuxPolicy >
value_type senf::VectorParser< ElementParser, AuxPolicy >::push_back_space ( size_type  n = 1) const

◆ push_front()

template<class ElementParser , class AuxPolicy >
template<class Value >
void senf::VectorParser< ElementParser, AuxPolicy >::push_front ( Value const &  value,
size_type  n = 1 
) const

◆ push_front_space()

template<class ElementParser , class AuxPolicy >
value_type senf::VectorParser< ElementParser, AuxPolicy >::push_front_space ( size_type  n = 1) const

◆ resize() [1/2]

template<class ElementParser , class AuxPolicy >
void senf::VectorParser< ElementParser, AuxPolicy >::resize ( size_type  n) const

◆ resize() [2/2]

template<class ElementParser , class AuxPolicy >
template<class Value >
void senf::VectorParser< ElementParser, AuxPolicy >::resize ( size_type  n,
Value  value 
) const

◆ size()

template<class ElementParser , class AuxPolicy >
size_type senf::VectorParser< ElementParser, AuxPolicy >::size ( ) const

Member Data Documentation

◆ init_bytes

template<class ElementParser , class AuxPolicy >
const size_type senf::VectorParser< ElementParser, AuxPolicy >::init_bytes = AuxPolicy::aux_bytes
static

Definition at line 71 of file VectorParser.hh.


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