Public Member Functions
CICEAttributeDataArray2DString Class Reference

Detailed Description

This class is a specialization of CICEAttributeDataArray2D which allows access to the ICEAttribute data as a 2D array of type siICENodeDataString. CICEAttributeDataArray2DString objects are read-only and can be filled with the methods supplied with the ICEAttribute class.

Note:
Data of type siICENodeDataString can be created with custom ICENodes.
See also:
ICEAttribute::GetDataArray2D, ICEAttribute::GetDataArray2DChunk, CICEAttributeDataArrayString, Type Definitions for CICEAttributeDataArray
Since:
9.0 (2011)
Example:
This example demonstrates how to iterate over the siICENodeDataString 2D attributes on a geometry. For a more detailed example, check out the ICEAttribute/netview_ICEAttribute Inspect ICE Attributes example.
        using namespace XSI;

        Application app;
        X3DObject x3dObj = app.GetSelection().GetItem(0);
        ICEAttribute attr = x3dObj.GetActivePrimitive().GetGeometry().GetICEAttributeFromName( L"MyStringData2DAttribute" );

        // Log the string and number of characters.
        CICEAttributeDataArray2DString stringData2D;

        attr.GetDataArray2D( stringData2D );

        for( ULONG i=0; i<stringData2D.GetCount( ); i++ )
        {
            CICEAttributeDataArrayString stringData;
            stringData2D.GetSubArray( i, stringData );
            for( ULONG j=0; j<stringData.GetCount( ); j++ )
            {
                ULONG nCount;
                const CICEAttributeDataArrayString::TData* pStr;
                stringData.GetData( j, &pStr, nCount );

                app.LogMessage( CString( pStr, nCount ) + L":" + CString( nCount ) );
            }
        }

#include <xsi_iceattributedataarray2D.h>

Inheritance diagram for CICEAttributeDataArray2DString:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CICEAttributeDataArray2DString ()
 ~CICEAttributeDataArray2DString ()
CStatus GetSubArray (ULONG in_index, CBaseICEAttributeDataArray &out_dataArray) const
CStatus ResizeSubArray (ULONG in_index, ULONG in_size, CBaseICEAttributeDataArray &out_dataArray)
CStatus SetSubArray (ULONG in_index, const wchar_t **in_ppData, ULONG in_count)

Constructor & Destructor Documentation

Constructor.

Destructor.


Member Function Documentation

CStatus GetSubArray ( ULONG  in_index,
CBaseICEAttributeDataArray out_dataArray 
) const [inline]

Returns the sub-array containing the string data at a given index.

Parameters:
in_indexIndex in the array. The index must be smaller than the number of elements in the array, otherwise the result is unpredictable.
Return values:
out_dataArrayA read-only reference to a CICEAttributeDataArrayString object.
Returns:
CStatus::OK Success
CStatus::InvalidArgument If in_index or out_dataArray is invalid.
CStatus ResizeSubArray ( ULONG  in_index,
ULONG  in_size,
CBaseICEAttributeDataArray out_dataArray 
) [inline]

Changes the size of the sub-array at a given index and returns a new array pointing to the resized sub-array. This is only supported for writable attributes and not available for built-in attributes.

Parameters:
in_indexIndex in the array. The index must be smaller than the number of elements in the array, otherwise the result is unpredictable. If this DataArray2D is an array chunk, in_index is relative to the chunk offset.
out_dataArrayA reference to a CICEAttributeDataArray<T> object at a specific index.
in_sizeThe size of the array.
Returns:
CStatus::OK Success
CStatus::InvalidArgument If in_index or out_dataArray is invalid.
CStatus SetSubArray ( ULONG  in_index,
const wchar_t **  in_ppData,
ULONG  in_count 
)

Set the sub-array at a given index This is only supported for writable attributes and not available for built-in attributes.

Parameters:
in_indexIndex in the array. The index must be smaller than the number of elements in the array, otherwise the result is unpredictable. If this DataArray2D is an array chunk, in_index is relative to the chunk offset.
in_arrayarray containing the input strings, all strings in the array must be NULL-terminated
Returns:
CStatus::OK Success
CStatus::InvalidArgument If in_index, in_ppData or in_count is invalid.
Since:
12.0 (2014)
Example:
This example demonstrates how to set a subarray
        // Template class to log the values in a CICEAttributeDataArray2D
        template < class T >
        class CICEAttributeData2DLogger
        {
            public:
            static void Log( ICEAttribute& attr )
            {
                CICEAttributeDataArray2D< T > data2D;
                attr.GetDataArray2D( data2D );
        
                Application xsi;
                for( ULONG i=0; i<data2D.GetCount( ); i++ )
                {
                    CICEAttributeDataArray< T > data;
                    data2D.GetSubArray( i, data );
                    for( ULONG j=0; j<data.GetCount( ); j++ )
                    {
                        xsi.LogMessage( CString( data[ j ] ) );
                    }
                }
            }
        };

        // Template specilization to log the values in a CICEAttributeDataArray2DString
        template < >
        class CICEAttributeData2DLogger< XSI::CString >
        {
            public:
            static void Log( ICEAttribute& attr )
            {
                CICEAttributeDataArray2DString data2D;
                attr.GetDataArray2D( data2D );
        
                Application xsi;
                for( ULONG i=0; i<data2D.GetCount( ); i++ )
                {
                    CICEAttributeDataArrayString data;
                    data2D.GetSubArray( i, data );
                    for( ULONG j=0; j<data.GetCount( ); j++ )
                    {
                        xsi.LogMessage( data[ j ] );
                    }
                }
            }
        };

        Application xsi;
        Model root = xsi.GetActiveSceneRoot();
        X3DObject cone( CreatePrim( L"cone", L"MeshSurface", L"", L"") );
        {
            ICEAttribute attr = cone.GetActivePrimitive().GetGeometry().AddICEAttribute( "DataArray2DString", XSI::siICENodeDataString, XSI::siICENodeStructureArray, XSI::siICENodeContextComponent0D );

            CString l_connSet(L"cone");
            ApplyOp( L"ICETree", l_connSet, siConstructionModeModeling );

            AddICECompoundNode("Set Data", "cone.polymsh.ICETree");
            AddICENode("$XSI_DSPRESETS\\ICENodes\\GetDataNode.Preset", "cone.polymsh.ICETree");
            SetValue("cone.polymsh.ICETree.SceneReferenceNode.reference", "self.DataArray2DString");
            SetValue("cone.polymsh.ICETree.Set_Data.Reference", "self.foo");
            ConnectICENodes("cone.polymsh.ICETree.Set_Data.Value", "cone.polymsh.ICETree.SceneReferenceNode.value");
            ConnectICENodes("cone.polymsh.ICETree.port1", "cone.polymsh.ICETree.Set_Data.Execute");

            DisplayPortValues("cone.polymsh.ICETree.Set_Data.Value", true, 0, true, "", 0, 0, 0, 1, false, true, 0.62, 1, 0.62, 1, false, 0, 10000, 1, false, false, 0, 10, false, true, false, 100);

            CICEAttributeDataArray2DString data;
            attr.GetDataArray2D( data );


            CICEAttributeData2DLogger<CString>::Log( attr );    
            ULONG l_nbElem = attr.GetElementCount();

            typedef const wchar_t* RawWStringType;
            typedef const wchar_t** RawWStringArray;

            {
                RawWStringType sub0[2] = {L"even", L"EVEN"};
                RawWStringType sub1[2] = {L"odd", L"ODD"};

                for (ULONG i=l_nbElem; i>0; i--)
                {
                    data.SetSubArray(i-1, (i-1)%2==0 ? sub0 : sub1, 2);
                }

                CICEAttributeData2DLogger<CString>::Log( attr );
            }

            {
                RawWStringType sub3[3] = {L"three", L"THREE", L"thrEE"};
                RawWStringType sub4[4] = {L"four", L"Four", L"FouR", L"FOUR"};
                RawWStringType sub5[5] = {L"FIVE", L"FivE", L"fIVe", L"Five", L"five"};

                CICEAttributeDataArray2DString dataChunk;
                attr.GetDataArray2DChunk(3, 3, dataChunk);

                dataChunk.SetSubArray(0, sub3, 3);
                dataChunk.SetSubArray(1, sub4, 4);
                dataChunk.SetSubArray(2, sub5, 5);
            }

        }

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