Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/common/NvBlastIteratorBase.h

Go to the documentation of this file.

    00001 // This code contains NVIDIA Confidential Information and is disclosed to you
    00002 // under a form of NVIDIA software license agreement provided separately to you.
    00003 //
    00004 // Notice
    00005 // NVIDIA Corporation and its licensors retain all intellectual property and
    00006 // proprietary rights in and to this software and related documentation and
    00007 // any modifications thereto. Any use, reproduction, disclosure, or
    00008 // distribution of this software and related documentation without an express
    00009 // license agreement from NVIDIA Corporation is strictly prohibited.
    00010 //
    00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
    00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
    00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
    00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
    00015 //
    00016 // Information and code furnished is believed to be accurate and reliable.
    00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
    00018 // information or for any infringement of patents or other rights of third parties that may
    00019 // result from its use. No license is granted by implication or otherwise under any patent
    00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
    00021 // This code supersedes and replaces all information previously supplied.
    00022 // NVIDIA Corporation products are not authorized for use as critical
    00023 // components in life support devices or systems without express written approval of
    00024 // NVIDIA Corporation.
    00025 //
    00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
    00027
    00028
    00029 #ifndef NVBLASTITERATORBASE_H
    00030 #define NVBLASTITERATORBASE_H
    00031
    00032
    00033 #include "NvBlastIndexFns.h"
    00034
    00035 namespace Nv
    00036 {
    00037 namespace Blast
    00038 {
    00039
    00044 template<typename T>
    00045 class IteratorBase
    00046 {
    00047 public:
    00049     IteratorBase(T curr);
    00050
    00052     operator    bool() const;
    00053
    00055     operator    T() const;
    00056
    00057 protected:
    00058     T   m_curr;
    00059 };
    00060
    00061
    00063
    00064 template<typename T>
    00065 NV_INLINE IteratorBase<T>::IteratorBase(T curr) : m_curr(curr)
    00066 {
    00067 }
    00068
    00069
    00070 template<typename T>
    00071 NV_INLINE IteratorBase<T>::operator bool() const
    00072 {
    00073     return !isInvalidIndex<T>(m_curr);
    00074 }
    00075
    00076
    00077 template<typename T>
    00078 NV_INLINE IteratorBase<T>::operator T() const
    00079 {
    00080     return m_curr;
    00081 }
    00082
    00083
    00087 template<typename IndexType>
    00088 class LListIt : public IteratorBase<IndexType>
    00089 {
    00090 public:
    00091     LListIt(IndexType curr, IndexType* links);
    00092
    00094     uint32_t    operator ++ ();
    00095
    00096 protected:
    00097     IndexType*  m_links;
    00098 };
    00099
    00100
    00102
    00103 template<typename IndexType>
    00104 NV_INLINE LListIt<IndexType>::LListIt(IndexType curr, IndexType* links) : IteratorBase<IndexType>(curr), m_links(links)
    00105 {
    00106 }
    00107
    00108
    00109 template<typename IndexType>
    00110 NV_INLINE uint32_t LListIt<IndexType>::operator ++ ()
    00111 {
    00112     NVBLAST_ASSERT((bool)(*this));
    00113     return (this->m_curr = m_links[this->m_curr]);
    00114 }
    00115
    00116
    00120 template<typename IndexType>
    00121 class DListIt : public IteratorBase<IndexType>
    00122 {
    00123 public:
    00124     DListIt(IndexType curr, IndexDLink<IndexType>* links);
    00125
    00127     uint32_t    operator ++ ();
    00128
    00129 protected:
    00130     IndexDLink<IndexType>*  m_links;
    00131 };
    00132
    00133
    00135
    00136 template<typename IndexType>
    00137 NV_INLINE DListIt<IndexType>::DListIt(IndexType curr, IndexDLink<IndexType>* links) : IteratorBase<IndexType>(curr), m_links(links)
    00138 {
    00139 }
    00140
    00141
    00142 template<typename IndexType>
    00143 NV_INLINE uint32_t DListIt<IndexType>::operator ++ ()
    00144 {
    00145     NVBLAST_ASSERT((bool)(*this));
    00146     return (this->m_curr = m_links[this->m_curr].m_adj[1]);
    00147 }
    00148
    00149 } // end namespace Blast
    00150 } // end namespace Nv
    00151
    00152
    00153 #endif // #ifndef NVBLASTITERATORBASE_H

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com