Public Types | Public Member Functions
CDataArray< T > Class Template Reference

Detailed Description

template<class T>
class XSI::CDataArray< T >

This template class encapsulates the 1D data arrays passed to custom node plug-ins during a graph evaluation. The underlying data arrays are zero-based, the following types are available:

CDataArray objects are created based on the current evaluation context and a specific port type (input ports only). Data are usually indexed with a CIndexSet which contains the array index set for the whole evaluation graph.

Note:
If the class type doesn't match the port data type being evaluated, an error occurs at run-time and a class instance is created with an empty array.
Example:
        using namespace XSI;

        CDataArrayVector3f outData( in_ctxt );
        CDataArrayVector3f inData( in_ctxt, ID_IN_vector3 );
        CDataArrayFloat scalarData( in_ctxt, ID_IN_factor );

        CIndexSet indexSet( in_ctxt );
        for(CIndexSet::Iterator it = indexSet.Begin(); it.HasNext(); it.Next())
        {
            outData[it] = inData[it];
            outData[it].ScaleInPlace( scalarData[it] );
        }
Since:
7.0
See also:
CDataArray2D, CIndexSet, ICENodeDef, Type Definitions for CDataArray

#include <xsi_dataarray.h>

Inherits CBaseDataArray.

List of all members.

Public Types

typedef T  TData
  TData is the underlying data type of a CDataArray instance. Possible values are:

Public Member Functions

SICPPSDK_INLINE  CDataArray (ICENodeContext &in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0)
SICPPSDK_INLINE  CDataArray (ICENodeContext &in_ctxt)
SICPPSDK_INLINE  CDataArray ()
SICPPSDK_INLINE  ~CDataArray ()
SICPPSDK_INLINE const TData operator[] (ULONG in_nIndex) const
SICPPSDK_INLINE TData operator[] (ULONG in_nIndex)
SICPPSDK_INLINE CStatus  CopyFrom (ULONG in_nInputPortID, ULONG in_nInstanceIndex=0)
SICPPSDK_INLINE ULONG  GetCount () const
SICPPSDK_INLINE bool  IsConstant () const

Member Typedef Documentation

T TData

TData is the underlying data type of a CDataArray instance. Possible values are:


Constructor & Destructor Documentation

SICPPSDK_INLINE CDataArray ( ICENodeContext in_ctxt,
ULONG  in_nInputPortID,
ULONG  in_nInstanceIndex = 0 
)

Constructor for data types bound to input ports.

Parameters:
in_ctxt ICENode evaluation context.
in_nInputPortID Input port identifier.
in_nInstanceIndex The group instance of the port.
SICPPSDK_INLINE CDataArray ( ICENodeContext in_ctxt )

Constructor for data types bound to output ports.

Parameters:
in_ctxt ICENode evaluation context.
SICPPSDK_INLINE CDataArray ( )

Default Constructor.

SICPPSDK_INLINE ~CDataArray ( )

Destructor.


Member Function Documentation

SICPPSDK_INLINE const T & operator[] ( ULONG  in_nIndex ) const

Accessor to the encapsulated array. 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.
SICPPSDK_INLINE T & operator[] ( ULONG  in_nIndex )

Accessor to elements at a given index.

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.
Note:
CDataArray< bool >::operator [] cannot be used for setting an array element, you must use CDataArray< bool >::Set instead.
SICPPSDK_INLINE CStatus CopyFrom ( ULONG  in_nInputPortID,
ULONG  in_nInstanceIndex = 0 
)

Copy the data from a given input port to this object buffer without allocating memory. This is typically used for passing data by reference from input to output ports, similar to what the built-in 'pass through' node is doing.

Parameters:
in_nInputPortID Input port identifier.
in_nInstanceIndex The group instance of the port.
Returns:
CStatus::OK Success
CStatus::InvalidArgument Fails if in_nInputPortID is not an input port identifier or in_nInstanceIndex is invalid.
CStatus::AccessDenied This array is not an output type or wasn't created properly.
Example:
        // Copy data from the ID_IN_PointPosition port to the current output port
        XSI::CDataArrayVector3f outData( in_ctxt );
        outData.CopyFrom( ID_IN_PointPosition );
SICPPSDK_INLINE ULONG GetCount ( void  ) const

Returns the number of elements in the array.

Returns:
Number of elements.
SICPPSDK_INLINE bool IsConstant ( ) const

Returns true if the array is constant or false otherwise. A constant array has only one value.

Returns:
True if constant, false otherwise.

The documentation for this class was generated from the following file: