AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ConnectionIteratorImpl.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#pragma once
17
19#include <agxPowerLine/Unit.h>
20
21
23
24
25template<typename T>
27 m_source(dimension), m_side(s_firstSearchSide), m_index(0)
28{
29 this->scanForNonNull();
30}
31
32
33template<typename T>
35{
36 if (!this->isValid())
37 return 0;
38
39 return this->getConnection();
40}
41
42
43template<typename T>
45{
46 if (!this->isValid())
47 return *this;
48
49 ++m_index;
50 this->scanForNonNull();
51
52 return *this;
53}
54
55
56template<typename T>
58{
59 return m_source != 0 &&
61 m_index != agx::InvalidIndex;
62}
63
64
65template<typename T>
67{
69}
70
71
72template<typename T>
74{
75 return this->getConnections()[m_index];
76}
77
78
79template<typename T>
81{
82 ConnectionPtr connection = this->getConnection();
83 if (connection == 0)
84 return false;
85
86 return detail::ConnectionIteratorTypes<T>::getTarget(connection) != 0;
87}
88
89
90template<typename T>
92{
93 return this->getConnections().size();
94}
95
96
97template<typename T>
99{
100 this->scanConnectionsForNonNull();
101 if (m_index == agx::InvalidIndex && m_side == s_firstSearchSide) {
102 m_side = agxPowerLine::opposite(m_side);
103 m_index = 0;
104 this->scanConnectionsForNonNull();
105 }
106 if (m_index == agx::InvalidIndex) {
107 this->invalidate();
108 }
109}
110
111
112template<typename T>
114{
115 for (; m_index < this->getNumConnections(); ++m_index) {
116 if (this->isConnectionValid()) {
117 return;
118 }
119 }
120 m_index = agx::InvalidIndex;
121}
122
123
124template<typename T>
126{
127 m_source = 0;
129 m_index = agx::InvalidIndex;
130}
AGXMODEL_EXPORT const agxPowerLine::Side s_firstSearchSide
#define AGXMODEL_EXPORT
Iterator that iterates over all, both input and output, connections that have a non-null Connector.
detail::ConnectionIteratorTypes< T >::ConnectionPtr ConnectionPtr
detail::ConnectionIteratorTypes< T >::SourcePtr SourcePtr
static const ConnectionRefVector & getConnections(SourcePtr source, Side side)
AGXMODEL_EXPORT agxPowerLine::Side opposite(agxPowerLine::Side side)
Connection * ConnectionPtr
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex