AGX Dynamics  2.37.3.2
PhysicalDimensionIteratorImpl.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx 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 
27 template<typename UnitPtr>
29  m_unit(unit), m_index(0), m_dimensions(unit->getDimensions())
30 {
31  this->scanForNonNull();
32 }
33 
34 
35 
36 template<typename UnitPtr>
38 {
39  if (this->isValid())
40  return m_dimensions[m_index];
41  else
42  return nullptr;
43 }
44 
45 
46 
47 template<typename UnitPtr>
49 {
50  if (this->isValid())
51  return m_dimensions[m_index];
52  else
53  return nullptr;
54 }
55 
56 
57 
58 template<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 
74 template<typename UnitPtr>
76 {
77  return m_index < m_dimensions.size() && m_dimensions[m_index] != nullptr;
78 }
79 
80 
81 
82 template<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 
96 template <typename UnitPtr>
98 {
100 }
101 
102 
103 #endif
Iterator that iterates over the non-null PhysicalDimensions of a Unit.
PhysicalDimensionIterator< UnitPtr > iterateDimensions(UnitPtr unit)
size_t size() const
Definition: Container.h:134
PhysicalDimensionIterator & operator++()
Move the iterator to the next PhysicalDimension.
detail::PhysicalDimensionIteratorTypes< UnitPtr >::PhysicalDimensionPtr PhysicalDimensionPtr