AGX Dynamics
2.38.0.2
Loading...
Searching...
No Matches
IndexListRange.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2024. 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 AGX_INDEXLISTRANGE_H
18
#define AGX_INDEXLISTRANGE_H
19
20
#include <
agxData/Array.h
>
21
22
namespace
agx
23
{
24
template
<
typename
T>
25
class
IndexListRange
26
{
27
public
:
28
typedef
T
Type
;
29
typedef
const
T*
iterator
;
30
public
:
31
IndexListRange
(
const
agxData::Array<T>
& indexList,
IndexRange
range );
32
33
iterator
begin
()
const
;
34
iterator
end
()
const
;
35
36
size_t
size
()
const
;
37
38
const
T&
operator[]
(
size_t
index )
const
;
39
40
private
:
41
const
agxData::Array<T>
& m_indexList;
42
43
IndexListRange<T>
& operator=(
const
IndexListRange<T>
&) {
agxAbort
(); }
44
IndexRange
m_range;
45
};
46
47
48
template
<
typename
T>
49
IndexListRange<T>::IndexListRange
(
const
agxData::Array<T>
& indexList,
IndexRange
range ) :
50
m_indexList( indexList ) , m_range( range )
51
{
52
agxAssert
( range.
end
() <= indexList.size() );
53
}
54
55
template
<
typename
T>
56
typename
IndexListRange<T>::iterator
IndexListRange<T>::begin
()
const
57
{
58
return
&m_indexList[ m_range.begin() ];
59
}
60
61
template
<
typename
T>
62
typename
IndexListRange<T>::iterator
IndexListRange<T>::end
()
const
63
{
64
// Special handling when the range extends to the end of the Array since
65
// we can't take the address of the 'end' element.
66
return
m_range.end() == m_indexList.size() ? m_indexList.end() : &m_indexList[ m_range.end() ];
67
}
68
69
template
<
typename
T>
70
size_t
IndexListRange<T>::size
()
const
71
{
72
return
m_range.size();
73
}
74
75
template
<
typename
T>
76
const
T&
IndexListRange<T>::operator[]
(
size_t
index )
const
77
{
78
return
m_indexList[ m_range[index] ];
79
}
80
}
81
82
83
84
#endif
Array.h
agxData::Val
Only use as member allocated variable.
Definition
Value.h:285
agx::IndexListRange
Definition
IndexListRange.h:26
agx::IndexListRange::IndexListRange
IndexListRange(const agxData::Array< T > &indexList, IndexRange range)
Definition
IndexListRange.h:49
agx::IndexListRange::size
size_t size() const
Definition
IndexListRange.h:70
agx::IndexListRange::begin
iterator begin() const
Definition
IndexListRange.h:56
agx::IndexListRange::operator[]
const T & operator[](size_t index) const
Definition
IndexListRange.h:76
agx::IndexListRange::Type
T Type
Definition
IndexListRange.h:28
agx::IndexListRange::iterator
const T * iterator
Definition
IndexListRange.h:29
agx::IndexListRange::end
iterator end() const
Definition
IndexListRange.h:62
agx::IndexRangeT< agx::UInt >
agx::IndexRangeT::end
T & end()
Definition
IndexRange.h:217
agxAbort
#define agxAbort()
Definition
debug.h:164
agxAssert
#define agxAssert(expr)
Definition
debug.h:143
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition
AddedMassInteraction.h:23
include
agx
IndexListRange.h
Generated on Sun Sep 1 2024 11:24:35 for AGX Dynamics by
1.9.8