AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
PhysicalDimensionIteratorImpl.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGXMODEL_PHYSICAL_DIMENSION_ITERATOR_IMPL_H
18#define AGXMODEL_PHYSICAL_DIMENSION_ITERATOR_IMPL_H
19
20#include <agxPowerLine/Unit.h>
21
22
23// Only included to help the IDE. Will be removed by the preprocessor.
25
26
27template<typename UnitPtr>
29 m_unit(unit), m_index(0), m_dimensions(unit->getDimensions())
30{
31 this->scanForNonNull();
32}
33
34
35
36template<typename UnitPtr>
38{
39 if (this->isValid())
40 return m_dimensions[m_index];
41 else
42 return nullptr;
43}
44
45
46
47template<typename UnitPtr>
49{
50 if (this->isValid())
51 return m_dimensions[m_index];
52 else
53 return nullptr;
54}
55
56
57
58template<typename UnitPtr>
60{
61 if (m_index == m_dimensions.size())
62 {
63 return *this;
64 }
65
66 ++m_index;
67 this->scanForNonNull();
68
69 return *this;
70}
71
72
73
74template<typename UnitPtr>
76{
77 return m_index < m_dimensions.size() && m_dimensions[m_index] != nullptr;
78}
79
80
81
82template<typename UnitPtr>
84{
85 for (; m_index < m_dimensions.size(); ++m_index)
86 {
87 if (this->isValid())
88 {
89 break;
90 }
91 }
92}
93
94
95
96template <typename UnitPtr>
98{
99 return PhysicalDimensionIterator<UnitPtr>(unit);
100}
101
102
103#endif
Iterator that iterates over the non-null PhysicalDimensions of a Unit.
PhysicalDimensionIterator & operator++()
Move the iterator to the next PhysicalDimension.
detail::PhysicalDimensionIteratorTypes< UnitPtr >::PhysicalDimensionPtr PhysicalDimensionPtr
PhysicalDimensionIterator< UnitPtr > iterateDimensions(UnitPtr unit)