Template Class PointCloud2IteratorBase

Class Documentation

template<typename T, typename TT, typename U, typename C, template<typename> class V>
class PointCloud2IteratorBase

Private base class for PointCloud2Iterator and PointCloud2ConstIterator T is the type of the value on which the child class will be templated TT is the type of the value to be retrieved (same as T except for constness) U is the type of the raw data in PointCloud2 (only uchar and const uchar are supported) C is the type of the pointcloud to intialize from (const or not) V is the derived class (yop, curiously recurring template pattern)

Public Functions

PointCloud2IteratorBase()
PointCloud2IteratorBase(C &cloud_msg, const std::string &field_name)
Parameters
  • cloud_msg – The PointCloud2 to iterate upon

  • field_name – The field to iterate upon

V<T> &operator=(const V<T> &iter)

Assignment operator

Parameters

iter – the iterator to copy data from

Returns

a reference to *this

TT &operator[](size_t i) const

Access the i th element starting at the current pointer (useful when a field has several elements of the same type)

Parameters

i

Returns

a reference to the i^th value from the current position

TT &operator*() const

Dereference the iterator. Equivalent to accessing it through [0]

Returns

the value to which the iterator is pointing

V<T> &operator++()

Increase the iterator to the next element

Returns

a reference to the updated iterator

V<T> operator+(int i)

Basic pointer addition

Parameters

i – the amount to increase the iterator by

Returns

an iterator with an increased position

V<T> &operator+=(int i)

Increase the iterator by a certain amount

Returns

a reference to the updated iterator

bool operator!=(const V<T> &iter) const

Compare to another iterator

Returns

whether the current iterator points to a different address than the other one

V<T> end() const

Return the end iterator

Returns

the end iterator (useful when performing normal iterator processing with ++)