Detailed Description
template<class T>
class XSI::CDataArray2D< T >::Accessor
A class for accessing the sub-array data of
CDataArray2D objects.
- Since:
- 7.0
- See also:
-
CIndexSet,
CDataArray,
CDataArray2D
#include <xsi_dataarray2D.h>
List
of all members.
Constructor & Destructor Documentation
Constructs an Accessor object from another Accessor object.
- Parameters:
-
in_accessor |
constant Accessor object. |
Member Function Documentation
Assignment operator.
- Parameters:
-
in_accessor |
constant class object. |
- Returns:
- A reference to this Accessor.
ULONG GetCount |
( |
void |
|
) |
const [inline] |
Returns the number of elements in the array.
- Returns:
- Number of elements.
const T& operator[] |
( |
ULONG |
in_nIndex |
) |
const [inline] |
Accessor to elements at a given index. This operator is called
when reading the data so the return value is read-only.
- Parameters:
-
in_nIndex |
Index in the array. The index must be smaller than the number
of elements in the array, otherwise the results are
unpredicted. |
- Returns:
- A read-only reference to the indexed item.
T& operator[] |
( |
ULONG |
in_nIndex |
) |
[inline] |
Accessor to elements at a given index. This operator can also be
used to access and modify the sub-array stored at the in_nIndex
position.
- Parameters:
-
in_nIndex |
Index in this zero-based array. The index must be smaller than
the number of elements in the array, otherwise the results are
unpredicted. |
- Returns:
- A reference to the indexed item.
- Example:
using namespace XSI;
XSIPLUGINCALLBACK CStatus UnionArrayNode_Evaluate( ICENodeContext& in_ctxt )
{
ULONG out_portID = in_ctxt.GetEvaluatedOutputPortID( );
switch( out_portID )
{
case ID_OUT_result:
{
CDataArray2DLong outData( in_ctxt );
CDataArray2DLong InArray1Data( in_ctxt, ID_IN_InArray1 );
CDataArray2DLong InArray2Data( in_ctxt, ID_IN_InArray2 );
CIndexSet indexSet( in_ctxt );
for(CIndexSet::Iterator it = indexSet.Begin(); it.HasNext(); it.Next())
{
CDataArray2DLong::Accessor a1 = InArray1Data[it];
CDataArray2DLong::Accessor a2 = InArray2Data[it];
ULONG nCount1 = a1.GetCount();
ULONG nCount2 = a2.GetCount();
std::sort( &a1[0], &a1[0]+nCount1 );
std::sort( &a2[0], &a2[0]+nCount2 );
CDataArray2DLong::Accessor out = outData.Resize( it, nCount1 + nCount2 );
LONG* pLast = std::set_union( &a1[0], &a1[0]+nCount1, &a2[0], &a2[0]+nCount2, &out[0]);
ULONG nOutCount = (ULONG)(pLast - &out[0]);
outData.Resize( it, nOutCount );
}
}
break;
};
return CStatus::OK;
}
The documentation for this class was generated from the following
file: