NvBlastIteratorBase.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTITERATORBASE_H
30 #define NVBLASTITERATORBASE_H
31 
32 
33 #include "NvBlastIndexFns.h"
34 
35 namespace Nv
36 {
37 namespace Blast
38 {
39 
44 template<typename T>
46 {
47 public:
49  IteratorBase(T curr);
50 
52  operator bool() const;
53 
55  operator T() const;
56 
57 protected:
58  T m_curr;
59 };
60 
61 
63 
64 template<typename T>
66 {
67 }
68 
69 
70 template<typename T>
72 {
73  return !isInvalidIndex<T>(m_curr);
74 }
75 
76 
77 template<typename T>
79 {
80  return m_curr;
81 }
82 
83 
87 template<typename IndexType>
88 class LListIt : public IteratorBase<IndexType>
89 {
90 public:
91  LListIt(IndexType curr, IndexType* links);
92 
94  uint32_t operator ++ ();
95 
96 protected:
97  IndexType* m_links;
98 };
99 
100 
102 
103 template<typename IndexType>
104 NV_INLINE LListIt<IndexType>::LListIt(IndexType curr, IndexType* links) : IteratorBase<IndexType>(curr), m_links(links)
105 {
106 }
107 
108 
109 template<typename IndexType>
111 {
112  NVBLAST_ASSERT((bool)(*this));
113  return (this->m_curr = m_links[this->m_curr]);
114 }
115 
116 
120 template<typename IndexType>
121 class DListIt : public IteratorBase<IndexType>
122 {
123 public:
124  DListIt(IndexType curr, IndexDLink<IndexType>* links);
125 
127  uint32_t operator ++ ();
128 
129 protected:
131 };
132 
133 
135 
136 template<typename IndexType>
137 NV_INLINE DListIt<IndexType>::DListIt(IndexType curr, IndexDLink<IndexType>* links) : IteratorBase<IndexType>(curr), m_links(links)
138 {
139 }
140 
141 
142 template<typename IndexType>
144 {
145  NVBLAST_ASSERT((bool)(*this));
146  return (this->m_curr = m_links[this->m_curr].m_adj[1]);
147 }
148 
149 } // end namespace Blast
150 } // end namespace Nv
151 
152 
153 #endif // #ifndef NVBLASTITERATORBASE_H
IndexDLink< IndexType > * m_links
Definition: NvBlastIteratorBase.h:130
T m_curr
Definition: NvBlastIteratorBase.h:58
IndexType * m_links
Definition: NvBlastIteratorBase.h:97
#define NVBLAST_ASSERT(exp)
Definition: NvBlastAssert.h:37
#define NV_INLINE
Definition: NvPreprocessor.h:350
Definition: NvBlastIteratorBase.h:121
IteratorBase(T curr)
Definition: NvBlastIteratorBase.h:65
Definition: NvBlastIteratorBase.h:88
Definition: NvBlastIteratorBase.h:45
Definition: NvBlastArray.h:37