vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn::EndpointIterator Class Reference

An iterator that goes forward in an EndpointContainer skipping the NULLs, that also acts a bit like a pointer/smart pointer (can treat it as a vrpn_Endpoint *) More...

#include <vrpn_EndpointContainer.h>

Public Types

typedef EndpointIterator type
 
typedef EndpointContainer const container_type
 
typedef container_type::pointer pointer
 
typedef container_type::reference reference
 
typedef container_type::size_type size_type
 

Public Member Functions

 EndpointIterator ()
 Default constructor, equal to all other default-constructed instances and all end()
 
 EndpointIterator (container_type &container)
 Constructor with container, points to beginning of container.
 
 EndpointIterator (container_type &container, size_type index)
 Constructor with container and raw index into container.
 
bool valid () const
 Does this iterator refer to a valid element?
 
pointer get_pointer () const
 Extract the pointer (NULL if iterator is invalid)
 
 operator pointer () const
 Implicit conversion operator to pointer.
 
typeoperator++ ()
 prefix ++ operator, increments (and skips any nulls)
 
Smart pointer idiom operators
pointer operator-> () const
 
reference operator* () const
 
Comparison operators, primarily for loop use
bool operator== (type const &other) const
 
bool operator!= (type const &other) const
 

Detailed Description

An iterator that goes forward in an EndpointContainer skipping the NULLs, that also acts a bit like a pointer/smart pointer (can treat it as a vrpn_Endpoint *)

Because we know at design time that it iterates through pointers, we have pointer-related operator overloads that mean there's no need to double-dereference.

Fulfills the InputIterator concept: http://en.cppreference.com/w/cpp/concept/InputIterator

All end() iterators compare equal to each other and to the default-constructed iterator. They are the only invalid iterators: incrementing an iterator past the end makes it the same as the default-constructed iterator.

That is, for all EndpointIterators it, we enforce the class invariant it.valid() || (it == EndpointIterator()) (and that's actually an XOR)

Definition at line 164 of file vrpn_EndpointContainer.h.

Member Typedef Documentation

◆ container_type

◆ pointer

typedef container_type::pointer vrpn::EndpointIterator::pointer

Definition at line 169 of file vrpn_EndpointContainer.h.

◆ reference

typedef container_type::reference vrpn::EndpointIterator::reference

Definition at line 170 of file vrpn_EndpointContainer.h.

◆ size_type

typedef container_type::size_type vrpn::EndpointIterator::size_type

Definition at line 171 of file vrpn_EndpointContainer.h.

◆ type

Constructor & Destructor Documentation

◆ EndpointIterator() [1/3]

vrpn::EndpointIterator::EndpointIterator ( )
inline

Default constructor, equal to all other default-constructed instances and all end()

Definition at line 175 of file vrpn_EndpointContainer.h.

References valid(), and VRPN_ASSERT_MSG.

Here is the call graph for this function:

◆ EndpointIterator() [2/3]

vrpn::EndpointIterator::EndpointIterator ( container_type & container)
inline

Constructor with container, points to beginning of container.

Definition at line 188 of file vrpn_EndpointContainer.h.

References VRPN_ECITERATOR_ASSERT_INVARIANT.

◆ EndpointIterator() [3/3]

vrpn::EndpointIterator::EndpointIterator ( container_type & container,
size_type index )
inline

Constructor with container and raw index into container.

Definition at line 198 of file vrpn_EndpointContainer.h.

References VRPN_ECITERATOR_ASSERT_INVARIANT.

Member Function Documentation

◆ get_pointer()

pointer vrpn::EndpointIterator::get_pointer ( ) const
inline

Extract the pointer (NULL if iterator is invalid)

Definition at line 217 of file vrpn_EndpointContainer.h.

References VRPN_ECITERATOR_ASSERT_INVARIANT.

Referenced by operator pointer(), and operator->().

◆ operator pointer()

vrpn::EndpointIterator::operator pointer ( ) const
inline

Implicit conversion operator to pointer.

Definition at line 226 of file vrpn_EndpointContainer.h.

References get_pointer(), and VRPN_ECITERATOR_ASSERT_INVARIANT.

Here is the call graph for this function:

◆ operator!=()

bool vrpn::EndpointIterator::operator!= ( type const & other) const
inline

Definition at line 272 of file vrpn_EndpointContainer.h.

◆ operator*()

reference vrpn::EndpointIterator::operator* ( ) const
inline

Definition at line 259 of file vrpn_EndpointContainer.h.

References VRPN_ECITERATOR_ASSERT_INVARIANT.

◆ operator++()

type & vrpn::EndpointIterator::operator++ ( )
inline

prefix ++ operator, increments (and skips any nulls)

Invariant might be invalid here, since the user might have just deleted something.

Definition at line 233 of file vrpn_EndpointContainer.h.

References VRPN_ECITERATOR_ASSERT_INVARIANT.

◆ operator->()

pointer vrpn::EndpointIterator::operator-> ( ) const
inline

Definition at line 253 of file vrpn_EndpointContainer.h.

References get_pointer(), and VRPN_ECITERATOR_ASSERT_INVARIANT.

Here is the call graph for this function:

◆ operator==()

bool vrpn::EndpointIterator::operator== ( type const & other) const
inline

Definition at line 268 of file vrpn_EndpointContainer.h.

◆ valid()

bool vrpn::EndpointIterator::valid ( ) const
inline

Does this iterator refer to a valid element?

Class invariant: valid() || (*this == type()) That is, there is only one invalid value.

Definition at line 211 of file vrpn_EndpointContainer.h.

Referenced by EndpointIterator().


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