GpuLaserDataIterator.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GAZEBO_RENDERING_GPULASERDATAITERATOR_HH_
18#define GAZEBO_RENDERING_GPULASERDATAITERATOR_HH_
19
20#include <memory>
21
22namespace gazebo
23{
24 namespace rendering
25 {
28 {
30 // cppcheck-suppress unusedStructMember
31 double range;
32
34 // cppcheck-suppress unusedStructMember
35 double intensity;
36
38 // cppcheck-suppress unusedStructMember
39 unsigned int beam;
40
42 // cppcheck-suppress unusedStructMember
43 unsigned int reading;
44 };
45
52 template <typename F>
54 {
55 public: friend F;
56
58 public: ~GpuLaserDataIterator();
59
63 public: bool operator==(const GpuLaserDataIterator &_rvalue) const;
64
68 public: bool operator!=(const GpuLaserDataIterator &_rvalue) const;
69
72 public: const GpuLaserData operator*() const;
73
76 public: const std::unique_ptr<const GpuLaserData> operator->() const;
77
81
85 public: GpuLaserDataIterator<F> operator++(int _dummy);
86
90
94 public: GpuLaserDataIterator<F> operator--(int _dummy);
95
97 protected: GpuLaserDataIterator(const unsigned int _index,
98 const float *_data, const unsigned int _skip,
99 const unsigned int _rangeOffset,
100 const unsigned int _intensityOffset,
101 const unsigned int _horizontalResolution);
102
103
104 // Not using PIMPL because it has no benefit on templated classes
105
107 private: unsigned int index = 0;
108
110 private: const float *data = nullptr;
111
113 private: const unsigned int skip = 0;
114
116 private: const unsigned int rangeOffset = 0;
117
119 private: const unsigned int intensityOffset = 0;
120
122 private: const unsigned int horizontalResolution = 0;
123 };
124 }
125}
126
128
129#endif
130
rendering
Definition RenderEngine.hh:31
const Bidirectional iterator for laser data
Definition GpuLaserDataIterator.hh:54
const std::unique_ptr< const GpuLaserData > operator->() const
Dereference operator iter->
Definition GpuLaserDataIteratorImpl.hh:63
friend F
Definition GpuLaserDataIterator.hh:55
GpuLaserDataIterator< F > & operator--()
Move itereator to previous (prefix: –it)
Definition GpuLaserDataIteratorImpl.hh:85
bool operator!=(const GpuLaserDataIterator &_rvalue) const
Operator !=.
Definition GpuLaserDataIteratorImpl.hh:40
GpuLaserDataIterator< F > & operator++()
Advance iterator to next reading (prefix: ++it)
Definition GpuLaserDataIteratorImpl.hh:70
GpuLaserDataIterator(const unsigned int _index, const float *_data, const unsigned int _skip, const unsigned int _rangeOffset, const unsigned int _intensityOffset, const unsigned int _horizontalResolution)
contstruct an iterator to a specified index
Definition GpuLaserDataIteratorImpl.hh:100
const GpuLaserData operator*() const
Dereference operator *iter.
Definition GpuLaserDataIteratorImpl.hh:47
bool operator==(const GpuLaserDataIterator &_rvalue) const
Operator ==.
Definition GpuLaserDataIteratorImpl.hh:33
~GpuLaserDataIterator()
Destructor.
Definition GpuLaserDataIteratorImpl.hh:27
Forward declarations for the common classes.
Definition Animation.hh:27
struct containing info about a single ray measurement
Definition GpuLaserDataIterator.hh:28
unsigned int reading
the index of areading in a plane or cone[0, hRes)
Definition GpuLaserDataIterator.hh:43
double intensity
The intensity reading.
Definition GpuLaserDataIterator.hh:35
unsigned int beam
Which plane or cone this reading belongs to [0, vRes)
Definition GpuLaserDataIterator.hh:39
double range
The distance of the reading in meters.
Definition GpuLaserDataIterator.hh:31