##

GpuLaserDataIterator.hh
Go to the documentation of this file.
/*
* Copyright (C) 2017 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_RENDERING_GPULASERDATAITERATOR_HH_
#define GAZEBO_RENDERING_GPULASERDATAITERATOR_HH_
#include <memory>
namespace gazebo
{
namespace rendering
{
struct GpuLaserData
{
// cppcheck-suppress unusedStructMember
double range;
// cppcheck-suppress unusedStructMember
double intensity;
// cppcheck-suppress unusedStructMember
unsigned int beam;
// cppcheck-suppress unusedStructMember
unsigned int reading;
};
template <typename F>
class GpuLaserDataIterator
{
public: friend F;
public: ~GpuLaserDataIterator();
public: bool operator==(const GpuLaserDataIterator &_rvalue) const;
public: bool operator!=(const GpuLaserDataIterator &_rvalue) const;
public: const GpuLaserData operator*() const;
public: const std::unique_ptr<const GpuLaserData> operator->() const;
public: GpuLaserDataIterator<F> &operator++();
public: GpuLaserDataIterator<F> operator++(int _dummy);
public: GpuLaserDataIterator<F>& operator--();
public: GpuLaserDataIterator<F> operator--(int _dummy);
protected: GpuLaserDataIterator(const unsigned int _index,
const float *_data, const unsigned int _skip,
const unsigned int _rangeOffset,
const unsigned int _intensityOffset,
const unsigned int _horizontalResolution);
// Not using PIMPL because it has no benefit on templated classes
private: unsigned int index = 0;
private: const float *data = nullptr;
private: const unsigned int skip = 0;
private: const unsigned int rangeOffset = 0;
private: const unsigned int intensityOffset = 0;
private: const unsigned int horizontalResolution = 0;
};
}
}
#include "GpuLaserDataIteratorImpl.hh"
#endif
gazebo::rendering::GpuLaserDataIterator::F
friend F
Definition: GpuLaserDataIterator.hh:55
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::GpuLaserData::beam
unsigned int beam
Which plane or cone this reading belongs to [0, vRes)
Definition: GpuLaserDataIterator.hh:39
gazebo::rendering::GpuLaserData::intensity
double intensity
The intensity reading.
Definition: GpuLaserDataIterator.hh:35
gazebo::rendering::GpuLaserDataIterator::operator--
GpuLaserDataIterator< F > & operator--()
Move itereator to previous (prefix: –it)
Definition: GpuLaserDataIteratorImpl.hh:85
gazebo::rendering::GpuLaserDataIterator::operator->
const std::unique_ptr< const GpuLaserData > operator->() const
Dereference operator iter->
Definition: GpuLaserDataIteratorImpl.hh:63
gazebo::rendering::GpuLaserData::reading
unsigned int reading
the index of areading in a plane or cone[0, hRes)
Definition: GpuLaserDataIterator.hh:43
gazebo::rendering::GpuLaserDataIterator::operator*
const GpuLaserData operator*() const
Dereference operator *iter.
Definition: GpuLaserDataIteratorImpl.hh:47
rendering
rendering
Definition: RenderEngine.hh:31
GpuLaserDataIteratorImpl.hh
gazebo::rendering::GpuLaserData
struct containing info about a single ray measurement
Definition: GpuLaserDataIterator.hh:27
gazebo::rendering::GpuLaserData::range
double range
The distance of the reading in meters.
Definition: GpuLaserDataIterator.hh:31
gazebo::rendering::GpuLaserDataIterator::GpuLaserDataIterator
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
gazebo::rendering::GpuLaserDataIterator::operator++
GpuLaserDataIterator< F > & operator++()
Advance iterator to next reading (prefix: ++it)
Definition: GpuLaserDataIteratorImpl.hh:70
gazebo::rendering::GpuLaserDataIterator::operator==
bool operator==(const GpuLaserDataIterator &_rvalue) const
Operator ==.
Definition: GpuLaserDataIteratorImpl.hh:33
gazebo::rendering::GpuLaserDataIterator::~GpuLaserDataIterator
~GpuLaserDataIterator()
Destructor.
Definition: GpuLaserDataIteratorImpl.hh:27
gazebo::rendering::GpuLaserDataIterator
const Bidirectional iterator for laser data
Definition: GpuLaserDataIterator.hh:53
gazebo::rendering::GpuLaserDataIterator::operator!=
bool operator!=(const GpuLaserDataIterator &_rvalue) const
Operator !=.
Definition: GpuLaserDataIteratorImpl.hh:40