30 #ifndef PXFOUNDATION_PXSTRIDEITERATOR_H 31 #define PXFOUNDATION_PXSTRIDEITERATOR_H 92 struct StripConst<const X>
118 : mPtr(strideIterator.ptr()), mStride(strideIterator.stride())
160 return *byteAdd(mPtr, i * stride());
168 mPtr = byteAdd(mPtr, stride());
178 mPtr = byteAdd(mPtr, stride());
187 mPtr = byteSub(mPtr, stride());
197 mPtr = byteSub(mPtr, stride());
222 mPtr = byteAdd(mPtr, i * stride());
231 mPtr = byteSub(mPtr, i * stride());
241 int byteDiff =
static_cast<int>(
reinterpret_cast<const PxU8*
>(mPtr) - reinterpret_cast<const PxU8*>(other.
mPtr));
242 return byteDiff /
static_cast<int>(stride());
251 return mPtr == other.
mPtr;
260 return mPtr != other.
mPtr;
269 return mPtr < other.
mPtr;
278 return mPtr > other.
mPtr;
287 return mPtr <= other.
mPtr;
296 return mPtr >= other.
mPtr;
302 return const_cast<T*
>(
reinterpret_cast<const T*
>(
reinterpret_cast<const PxU8*
>(ptr) +
bytes));
307 return const_cast<T*
>(
reinterpret_cast<const T*
>(
reinterpret_cast<const PxU8*
>(ptr) -
bytes));
312 int byteDiff =
static_cast<int>(
reinterpret_cast<const PxU8*
>(mPtr) - reinterpret_cast<const PxU8*>(other.
mPtr));
313 return (stride() == other.
stride()) && (
abs(byteDiff) % stride() == 0);
323 template <
typename T>
333 template <
typename T>
342 template <
typename T>
353 #endif // PXFOUNDATION_PXSTRIDEITERATOR_H Definition: GuContactBuffer.h:37
PX_INLINE T * ptr() const
Get pointer to element.
Definition: PxStrideIterator.h:126
PX_INLINE T & operator[](unsigned int i) const
Indexing operator.
Definition: PxStrideIterator.h:158
PX_INLINE bool operator!=(const PxStrideIterator &other) const
Inequality operator.
Definition: PxStrideIterator.h:257
PX_INLINE PxStrideIterator(T *ptr=NULL, PxU32 stride=sizeof(T))
Constructor.
Definition: PxStrideIterator.h:107
PX_INLINE bool operator==(const PxStrideIterator &other) const
Equality operator.
Definition: PxStrideIterator.h:248
#define PX_SHARED_ASSERT(exp)
Definition: PxSharedAssert.h:39
PxU32 mStride
Definition: PxStrideIterator.h:317
PX_INLINE bool operator<=(const PxStrideIterator &other) const
Less or equal than operator.
Definition: PxStrideIterator.h:284
PX_INLINE int operator-(const PxStrideIterator &other) const
Iterator difference.
Definition: PxStrideIterator.h:238
PX_INLINE PxStrideIterator & operator-=(unsigned int i)
Subtraction compound assignment operator.
Definition: PxStrideIterator.h:229
PX_INLINE PxStrideIterator< T > operator+(int i, PxStrideIterator< T > it)
Addition operator.
Definition: PxStrideIterator.h:324
PX_INLINE PxStrideIterator operator++(int)
Post-increment operator.
Definition: PxStrideIterator.h:175
uint8_t PxU8
Definition: PxSimpleTypes.h:75
PX_INLINE bool operator<(const PxStrideIterator &other) const
Less than operator.
Definition: PxStrideIterator.h:266
PX_INLINE T & operator*() const
Indirection operator.
Definition: PxStrideIterator.h:142
T * mPtr
Definition: PxStrideIterator.h:316
PX_INLINE bool operator>(const PxStrideIterator &other) const
Greater than operator.
Definition: PxStrideIterator.h:275
PX_INLINE T * operator->() const
Dereferencing operator.
Definition: PxStrideIterator.h:150
PX_INLINE PxStrideIterator operator--(int)
Post-decrement operator.
Definition: PxStrideIterator.h:194
PX_INLINE PxStrideIterator & operator--()
Pre-decrement operator.
Definition: PxStrideIterator.h:185
PX_INLINE bool operator>=(const PxStrideIterator &other) const
Greater or equal than operator.
Definition: PxStrideIterator.h:293
PX_INLINE PxStrideIterator(const PxStrideIterator< typename StripConst< T >::Type > &strideIterator)
Copy constructor.
Definition: PxStrideIterator.h:117
PX_INLINE bool isCompatible(const PxStrideIterator &other) const
Definition: PxStrideIterator.h:310
PX_INLINE PxStrideIterator & operator+=(unsigned int i)
Addition compound assignment operator.
Definition: PxStrideIterator.h:220
Iterator class for iterating over arrays of data that may be interleaved with other data...
Definition: PxStrideIterator.h:81
PX_INLINE PxU32 stride() const
Get stride.
Definition: PxStrideIterator.h:134
PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a)
platform-specific absolute value
Definition: PxWindowsIntrinsics.h:51
PX_INLINE PxStrideIterator operator+(unsigned int i) const
Addition operator.
Definition: PxStrideIterator.h:204
uint32_t PxU32
Definition: Px.h:48
static PX_INLINE T * byteSub(T *ptr, PxU32 bytes)
Definition: PxStrideIterator.h:305
PX_INLINE PxStrideIterator operator-(unsigned int i) const
Subtraction operator.
Definition: PxStrideIterator.h:212
#define PX_INLINE
Definition: PxPreprocessor.h:336
PX_INLINE PxStrideIterator< T > PxMakeIterator(T *ptr, PxU32 stride=sizeof(T))
Stride iterator factory function which infers the iterator type.
Definition: PxStrideIterator.h:334
PX_INLINE PxStrideIterator & operator++()
Pre-increment operator.
Definition: PxStrideIterator.h:166
static PX_INLINE T * byteAdd(T *ptr, PxU32 bytes)
Definition: PxStrideIterator.h:300