AGXDynamics  2.35.0.3
Deformable1DIterator.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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_DEFORMABLE1DITERATOR_H
18 #define AGXMODEL_DEFORMABLE1DITERATOR_H
19 
21 
22 namespace agxModel
23 {
25  {
26  public:
30 
33  const agxModel::Deformable1DNodeRef* operator-> () const;
34 
37 
38  agxModel::Deformable1DIterator& operator++ ();
39  agxModel::Deformable1DIterator& operator-- ();
40  agxModel::Deformable1DIterator operator++ ( int );
41  agxModel::Deformable1DIterator operator-- ( int );
42 
46  agx::Bool isBegin() const;
47 
51  agx::Bool isEnd() const;
52 
56  agx::Bool equal( const agxModel::Deformable1DIterator& other ) const;
57 
63 
69 
73  agxModel::Deformable1DIterator next() const;
74 
78  agxModel::Deformable1DIterator prev() const;
79 
83  agxModel::Deformable1DNode* get() const;
84 
88  const agxModel::Segment* getSegment() const;
89 
90  private:
91  Deformable1DNodeRef m_node;
92  };
93 
95  {
96  m_node = other.m_node;
97  return *this;
98  }
99 
101  {
102  return m_node;
103  }
104 
106  {
107  return &m_node;
108  }
109 
111  {
112  return m_node == other.m_node;
113  }
114 
116  {
117  return !( *this == other );
118  }
119 
121  {
122  return inc();
123  }
124 
126  {
127  return dec();
128  }
129 
131  {
132  Deformable1DIterator ret = *this;
133  ++(*this);
134  return ret;
135  }
136 
138  {
139  Deformable1DIterator ret = *this;
140  --(*this);
141  return ret;
142  }
143 
145  {
146  return m_node == nullptr;
147  }
148 
150  {
151  return *this == other;
152  }
153 
155  {
156  if ( m_node == nullptr )
157  return *this;
158 
159  m_node = m_node->getNumBranches() > 0 ? static_cast< Deformable1DNode* >(m_node->getBranch(0)) : nullptr;
160 
161  return *this;
162  }
163 
165  {
166  if ( m_node == nullptr )
167  return *this;
168 
169  m_node = static_cast< Deformable1DNode* >(m_node->getParent());
170 
171  return *this;
172  }
173 
175  {
176  return Deformable1DIterator(m_node != nullptr && m_node->getNumBranches() > 0 ? static_cast< Deformable1DNode* >(m_node->getBranch(0)) : nullptr);
177  }
178 
180  {
181  return Deformable1DIterator(m_node != nullptr ? static_cast< Deformable1DNode* >(m_node->getParent()) : nullptr);
182  }
183 
185  {
186  return m_node;
187  }
188 
190  {
191  return m_node != nullptr ? m_node->getSegment() : nullptr;
192  }
193 }
194 
195 #endif // AGXMODEL_DEFORMABLE1DITERATOR_H
agxModel::Deformable1DIterator
Definition: Deformable1DIterator.h:24
agxModel
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
agxModel::Deformable1DIterator::operator++
agxModel::Deformable1DIterator & operator++()
Definition: Deformable1DIterator.h:120
agxModel::Deformable1DIterator::dec
agxModel::Deformable1DIterator & dec()
Decrement this by one.
Definition: Deformable1DIterator.h:164
agx::operator*
Vec3T< T > operator*(const Vec3T< T > &v, const AffineMatrix4x4T< T > &m)
Definition: AffineMatrix4x4.h:864
agxModel::Deformable1DIterator::next
agxModel::Deformable1DIterator next() const
Definition: Deformable1DIterator.h:174
agxModel::Deformable1DIterator::isEnd
agx::Bool isEnd() const
Definition: Deformable1DIterator.h:144
agxModel::Deformable1DIterator::get
agxModel::Deformable1DNode * get() const
Definition: Deformable1DIterator.h:184
agxModel::Deformable1DIterator::inc
agxModel::Deformable1DIterator & inc()
Increment this by one.
Definition: Deformable1DIterator.h:154
agxModel::Deformable1DIterator::prev
agxModel::Deformable1DIterator prev() const
Definition: Deformable1DIterator.h:179
agxModel::Deformable1DIterator::operator!=
agx::Bool operator!=(const agxModel::Deformable1DIterator &other) const
Definition: Deformable1DIterator.h:115
agxModel::Deformable1DIterator::getSegment
const agxModel::Segment * getSegment() const
Definition: Deformable1DIterator.h:189
agxModel::Deformable1DIterator::operator->
const agxModel::Deformable1DNodeRef * operator->() const
Definition: Deformable1DIterator.h:105
agx::ref_ptr< Deformable1DNode >
agxModel::Deformable1DIterator::operator==
agx::Bool operator==(const agxModel::Deformable1DIterator &other) const
Definition: Deformable1DIterator.h:110
agxModel::Deformable1DIterator::operator--
agxModel::Deformable1DIterator & operator--()
Definition: Deformable1DIterator.h:125
agxModel::Deformable1DIterator::operator=
agxModel::Deformable1DIterator & operator=(const agxModel::Deformable1DIterator &other)
Definition: Deformable1DIterator.h:94
Deformable1DNode.h
agxModel::Deformable1DIterator::equal
agx::Bool equal(const agxModel::Deformable1DIterator &other) const
Same as == to be used with exports to languages with not complete support for operator overloading.
Definition: Deformable1DIterator.h:149
agx::operator!=
bool operator!=(T val, InvalidIndexStruct)
Definition: agx.h:196
agxModel::Segment
A Deformable1D segment is the segment between two nodes, or if this is the last segment,...
Definition: Deformable1DSegment.h:42
agx::Bool
bool Bool
Definition: Integer.h:48
agxModel::Deformable1DIterator::Deformable1DIterator
Deformable1DIterator(agxModel::Deformable1DNodeRef node)
AGXMODEL_EXPORT
#define AGXMODEL_EXPORT
Definition: agxModel/export.h:42
agx::operator==
bool operator==(T val, InvalidIndexStruct)
Definition: agx.h:190
agxModel::Deformable1DNode
Special node implementation of segments in e.g., a Deformable1D object.
Definition: Deformable1DNode.h:36
agxModel::Deformable1DIterator::operator*
const agxModel::Deformable1DNodeRef & operator*() const
Definition: Deformable1DIterator.h:100