senf::SafePacketParserWrapper< Parser > Class Template Reference

Iterator re-validating Parser wrapper. More...

#include <senf/Packets/SafeIterator.hh>

Inheritance diagram for senf::SafePacketParserWrapper< Parser >:

Public Member Functions

Parser & operator* () const
 Access the stored parser. More...
 
Parser * operator-> () const
 Access the stored parser. More...
 
bool boolean_test () const
 Check validity. More...
 
- Public Member Functions inherited from senf::comparable_safe_bool< class >
 operator bool_type () const
 
bool operator! () const
 

Structors and default members

 SafePacketParserWrapper ()
 Create an empty uninitialized SafePacketParserWrapper. More...
 
 SafePacketParserWrapper (Parser parser)
 Initialize SafePacketParserWrapper from parser. More...
 
SafePacketParserWrapperoperator= (Parser parser)
 Assign parser to this. More...
 

Additional Inherited Members

- Protected Types inherited from senf::safe_bool_base
typedef void(safe_bool_base::* bool_type) () const
 
- Protected Member Functions inherited from senf::comparable_safe_bool< class >
 ~comparable_safe_bool ()
 
- Protected Member Functions inherited from senf::safe_bool_base
void this_type_does_not_support_comparisons () const
 
 safe_bool_base ()
 
 safe_bool_base (const safe_bool_base &)
 
safe_bool_baseoperator= (const safe_bool_base &)
 
 ~safe_bool_base ()
 

Detailed Description

template<class Parser>
class senf::SafePacketParserWrapper< Parser >

Iterator re-validating Parser wrapper.

An ordinary parser will be invalidated whenever the raw data container's size is changed. This can complicate some algorithms considerably.

This wrapper will update the parsers iterator (the value returned by the i() member) on every access. This ensures that the iterator will stay valid.

Attention
Beware however, if you insert or remove data before the safe wrapper, the location will not be updated accordingly and therefore the parser will be invalid.

Additionally a SafePacketParserWrapper has an uninitialized state. The only allowed operations in this state are the boolean test for validity and assigning another parser.

Definition at line 108 of file SafeIterator.hh.

Constructor & Destructor Documentation

◆ SafePacketParserWrapper() [1/2]

template<class Parser>
senf::SafePacketParserWrapper< Parser >::SafePacketParserWrapper ( )

Create an empty uninitialized SafePacketParserWrapper.

◆ SafePacketParserWrapper() [2/2]

template<class Parser>
senf::SafePacketParserWrapper< Parser >::SafePacketParserWrapper ( Parser  parser)

Initialize SafePacketParserWrapper from parser.

Member Function Documentation

◆ boolean_test()

template<class Parser>
bool senf::SafePacketParserWrapper< Parser >::boolean_test ( ) const

Check validity.

◆ operator*()

template<class Parser>
Parser& senf::SafePacketParserWrapper< Parser >::operator* ( ) const

Access the stored parser.

On every access, the stored parsers iterator will be updated / re-validated.

◆ operator->()

template<class Parser>
Parser* senf::SafePacketParserWrapper< Parser >::operator-> ( ) const

Access the stored parser.

On every access, the stored parsers iterator will be updated / re-validated.

◆ operator=()

template<class Parser>
SafePacketParserWrapper& senf::SafePacketParserWrapper< Parser >::operator= ( Parser  parser)

Assign parser to this.


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