xsi_dataarray2D.h
Go to the documentation of this file.
00001 //*****************************************************************************
00011 //*****************************************************************************
00012 
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016 
00017 #ifndef __XSIDATAARRAY2D_H__
00018 #define __XSIDATAARRAY2D_H__
00019 
00020 #include <sicppsdk.h>
00021 #include <xsi_icenodecontext.h>
00022 #include <xsi_indexset.h>
00023 #include <xsi_dataarray.h>
00024 
00025 #include <xsi_vector2f.h>
00026 #include <xsi_vector3f.h>
00027 #include <xsi_vector4f.h>
00028 #include <xsi_quaternionf.h>
00029 #include <xsi_rotationf.h>
00030 #include <xsi_matrix3f.h>
00031 #include <xsi_matrix4f.h>
00032 #include <xsi_color4f.h>
00033 
00034 namespace XSI {
00035 
00036 class ICENodeContext;
00037 
00038 class CBaseDataArray2D : public CBaseDataArray
00039 {
00040     public:
00041     friend class ICENodeContext;
00042 
00043     CBaseDataArray2D() : m_bIsSubArrayConstant(false) {}
00044 
00045     protected:
00046     SICPPSDK_INLINE CStatus AcquireInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex );
00047     SICPPSDK_INLINE CStatus CopyFromInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex );
00048     SICPPSDK_INLINE CStatus AcquireOutputDataArray( XSI::siICENodeDataType in_arrayDataType );
00049     SICPPSDK_INLINE CStatus ReleaseDataArray( );
00050     SICPPSDK_INLINE CStatus GetSubArray( ULONG in_nArrayIndex, void*& out_ppData, ULONG& out_nCount, ULONG& out_nStartBit ) const;
00051     SICPPSDK_INLINE CStatus ResizeSubArray( ULONG in_nArrayIndex, ULONG in_nSize, void*& out_ppData, ULONG& out_nCount, ULONG& out_nStartBit );
00052     SICPPSDK_INLINE bool GetSubArrayConstant() const;
00053     SICPPSDK_INLINE bool& GetSubArrayConstantRef();
00054 
00055     SICPPSDK_INLINE CStatus SetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const unsigned char* in_pData, ULONG in_nSize );
00056     SICPPSDK_INLINE CStatus GetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const unsigned char** out_ppData, ULONG& out_nSize ) const;
00057     SICPPSDK_INLINE CStatus GetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, unsigned char** out_ppData, ULONG& out_nSize ) const;
00058     SICPPSDK_INLINE unsigned char* ResizeCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nArrayIndex, ULONG in_nSize );
00059 
00060     SICPPSDK_INLINE CStatus SetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const wchar_t* in_pData, ULONG in_nCount );
00061     SICPPSDK_INLINE CStatus GetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const wchar_t** out_ppData, ULONG& out_nCount ) const;
00062     SICPPSDK_INLINE CStatus GetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, wchar_t** out_ppData, ULONG& out_nCount ) const;
00063     SICPPSDK_INLINE wchar_t* ResizeStringData2D( ULONG in_nAccessIndex, ULONG in_nArrayIndex, ULONG in_nCount );
00064 
00065     private:
00066     bool m_bIsSubArrayConstant;
00067 };
00068 
00069 SICPPSDK_INLINE CStatus CBaseDataArray2D::AcquireInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00070 {
00071     return m_ctxt.AcquireInputDataArray2D( *this, in_arrayDataType, in_nInputPortID, in_nInstanceIndex );
00072 }
00073 
00074 SICPPSDK_INLINE CStatus CBaseDataArray2D::CopyFromInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00075 {
00076     return m_ctxt.CopyFromInputDataArray2D( *this, in_arrayDataType, in_nInputPortID, in_nInstanceIndex );
00077 }
00078 
00079 SICPPSDK_INLINE CStatus CBaseDataArray2D::AcquireOutputDataArray( XSI::siICENodeDataType in_arrayDataType )
00080 {
00081     return m_ctxt.AcquireOutputDataArray2D( *this, in_arrayDataType );
00082 }
00083 
00084 SICPPSDK_INLINE CStatus CBaseDataArray2D::ReleaseDataArray( )
00085 {
00086     return m_ctxt.ReleaseDataArray( *this );
00087 }
00088 
00089 SICPPSDK_INLINE CStatus CBaseDataArray2D::ResizeSubArray( ULONG in_nArrayIndex, ULONG in_nSize, void*& out_ppData, ULONG& out_nCount, ULONG& out_nStartBit )
00090 {
00091     return m_ctxt.ResizeSubArray( *this, in_nArrayIndex, in_nSize, out_ppData, out_nCount, out_nStartBit );
00092 }
00093 
00094 SICPPSDK_INLINE CStatus CBaseDataArray2D::GetSubArray( ULONG in_nArrayIndex, void*& out_ppData, ULONG& out_nCount, ULONG& out_nStartBit ) const
00095 {
00096     return m_ctxt.GetSubArray( (CBaseDataArray2D&)*this, in_nArrayIndex, out_ppData, out_nCount, out_nStartBit );
00097 }
00098 
00099 SICPPSDK_INLINE bool& CBaseDataArray2D::GetSubArrayConstantRef()
00100 {
00101     return m_bIsSubArrayConstant;
00102 }
00103 
00104 SICPPSDK_INLINE bool CBaseDataArray2D::GetSubArrayConstant() const
00105 {
00106     return m_bIsSubArrayConstant;
00107 }
00108 
00109 SICPPSDK_INLINE CStatus CBaseDataArray2D::SetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const unsigned char* in_pData, ULONG in_nSize )
00110 {
00111     return m_ctxt.SetCustomTypeData2D( *this, in_nAccessIndex, in_nIndex, in_pData, in_nSize );
00112 }
00113 
00114 SICPPSDK_INLINE CStatus CBaseDataArray2D::GetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const unsigned char** out_ppData, ULONG& out_nSize ) const
00115 {
00116     return m_ctxt.GetCustomTypeData2D( (CBaseDataArray&)*this, in_nAccessIndex, in_nIndex, out_ppData, out_nSize );
00117 }
00118 
00119 SICPPSDK_INLINE CStatus CBaseDataArray2D::GetCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nIndex, unsigned char** out_ppData, ULONG& out_nSize ) const
00120 {
00121     return m_ctxt.GetCustomTypeData2D( (CBaseDataArray&)*this, in_nAccessIndex, in_nIndex, out_ppData, out_nSize );
00122 }
00123 
00124 SICPPSDK_INLINE unsigned char* CBaseDataArray2D::ResizeCustomTypeData2D( ULONG in_nAccessIndex, ULONG in_nArrayIndex, ULONG in_nSize )
00125 {
00126     return m_ctxt.ResizeCustomTypeData2D( *this, in_nAccessIndex, in_nArrayIndex, in_nSize );
00127 }
00128 
00129 SICPPSDK_INLINE CStatus CBaseDataArray2D::SetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const wchar_t* in_pData, ULONG in_nCount )
00130 {
00131     return m_ctxt.SetStringData2D( *this, in_nAccessIndex, in_nIndex, in_pData, in_nCount );
00132 }
00133 
00134 SICPPSDK_INLINE CStatus CBaseDataArray2D::GetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, const wchar_t** out_ppData, ULONG& out_nCount ) const
00135 {
00136     return m_ctxt.GetStringData2D( (CBaseDataArray&)*this, in_nAccessIndex, in_nIndex, out_ppData, out_nCount );
00137 }
00138 
00139 SICPPSDK_INLINE CStatus CBaseDataArray2D::GetStringData2D( ULONG in_nAccessIndex, ULONG in_nIndex, wchar_t** out_ppData, ULONG& out_nCount ) const
00140 {
00141     return m_ctxt.GetStringData2D( (CBaseDataArray&)*this, in_nAccessIndex, in_nIndex, out_ppData, out_nCount );
00142 }
00143 
00144 SICPPSDK_INLINE wchar_t* CBaseDataArray2D::ResizeStringData2D( ULONG in_nAccessIndex, ULONG in_nArrayIndex, ULONG in_nCount )
00145 {
00146     return m_ctxt.ResizeStringData2D( *this, in_nAccessIndex, in_nArrayIndex, in_nCount );
00147 }
00148 
00149 //*****************************************************************************
00222 //*****************************************************************************
00223 
00224 template <class T>
00225 class CDataArray2D : public CBaseDataArray2D
00226 {
00227     public:
00228 
00245     typedef T TData;
00246 
00247     //*****************************************************************************
00253     //*****************************************************************************
00254 
00255     class Accessor
00256     {
00257         public:
00258         friend class CDataArray2D<T>;
00259 
00262         Accessor( ) : m_pData(NULL), m_nCount(0), m_bIsConstant(false)
00263         {
00264         }
00265 
00268         Accessor( const Accessor& in_accessor )
00269         {
00270             *this = in_accessor;
00271         }
00272 
00277         Accessor& operator=( const Accessor& in_accessor )
00278         {
00279             m_pData = in_accessor.m_pData;
00280             m_nCount = in_accessor.m_nCount;
00281             m_bIsConstant = in_accessor.m_bIsConstant;
00282             return *this;
00283         }
00284 
00288         ULONG GetCount() const
00289         {
00290             return m_nCount;
00291         }
00292 
00298         const T& operator[]( ULONG in_nIndex ) const
00299         {
00300             return m_pData[ m_bIsConstant ? 0 : in_nIndex ];
00301         }
00302 
00361         T& operator[]( ULONG in_nIndex )
00362         {
00363             return m_pData[ m_bIsConstant ? 0 : in_nIndex ];
00364         }
00365 
00366         private:
00367         void*& GetDataRef()
00368         {
00369             return (void*&)m_pData;
00370         }
00371 
00372         ULONG& GetCountRef()
00373         {
00374             return m_nCount;
00375         }
00376 
00377         void SetAsConstant( bool in_bConst )
00378         {
00379             m_bIsConstant = in_bConst;
00380         }
00381 
00382         T* m_pData;
00383         ULONG m_nCount;
00384         bool m_bIsConstant;
00385     };
00386 
00392     SICPPSDK_INLINE CDataArray2D( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00393 
00397     SICPPSDK_INLINE CDataArray2D( ICENodeContext& in_ctxt ) ;
00398 
00401     SICPPSDK_INLINE CDataArray2D( ) ;
00402 
00405     SICPPSDK_INLINE ~CDataArray2D( );
00406 
00423     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00424 
00430     SICPPSDK_INLINE Accessor operator[]( ULONG in_nArrayIndex ) const;
00431 
00438     SICPPSDK_INLINE Accessor Resize( ULONG in_nArrayIndex, ULONG in_nSize );
00439 
00443     SICPPSDK_INLINE ULONG GetCount() const;
00444 
00448     SICPPSDK_INLINE bool IsConstant() const;
00449 
00450 private:
00451     SICPPSDK_INLINE Accessor Get( ULONG in_nArrayIndex ) const;
00452     SICPPSDK_INLINE void Clear();
00453     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00454 };
00455 
00456 template< class T >
00457 SICPPSDK_INLINE CDataArray2D<T>::CDataArray2D( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00458 {
00459     m_ctxt = in_ctxt;
00460 
00461     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00462 }
00463 
00464 template< class T >
00465 SICPPSDK_INLINE CDataArray2D<T>::CDataArray2D( ICENodeContext& in_ctxt )
00466 {
00467     m_ctxt = in_ctxt;
00468 
00469     AcquireOutputDataArray( GetDefaultType() );
00470 }
00471 
00472 template< class T >
00473 SICPPSDK_INLINE CDataArray2D<T>::~CDataArray2D( )
00474 {
00475     ReleaseDataArray( );
00476 }
00477 
00478 template< class T >
00479 SICPPSDK_INLINE CDataArray2D<T>::CDataArray2D( )
00480 {
00481 }
00482 
00483 template< class T >
00484 SICPPSDK_INLINE CStatus CDataArray2D<T>::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00485 {
00486     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00487 }
00488 
00489 template< class T >
00490 SICPPSDK_INLINE typename CDataArray2D<T>::Accessor CDataArray2D<T>::Get( ULONG in_nArrayIndex ) const
00491 {
00492     Accessor a;
00493     ULONG nNotused;
00494     GetSubArray( in_nArrayIndex, a.GetDataRef(), (ULONG&)a.GetCountRef(), nNotused );
00495     a.SetAsConstant( GetSubArrayConstant() );
00496 
00497     return a;
00498 }
00499 
00500 template< class T >
00501 SICPPSDK_INLINE typename CDataArray2D<T>::Accessor CDataArray2D<T>::operator[]( ULONG in_nArrayIndex ) const
00502 {
00503     return Get( in_nArrayIndex );
00504 }
00505 
00506 template< class T >
00507 SICPPSDK_INLINE typename CDataArray2D<T>::Accessor CDataArray2D<T>::Resize( ULONG in_nArrayIndex, ULONG in_nSize )
00508 {
00509     ULONG nNotused;
00510     Accessor a;
00511     ResizeSubArray( in_nArrayIndex, in_nSize, a.GetDataRef(), (ULONG&)a.GetCountRef(), nNotused );
00512     a.SetAsConstant( GetSubArrayConstant() );
00513     return a;
00514 }
00515 
00516 template< class T >
00517 SICPPSDK_INLINE void CDataArray2D<T>::Clear()
00518 {
00519     ReleaseDataArray( );
00520     m_nHandle = UINT_MAX;
00521     m_nCount = 0;
00522     m_bIsConstant = false;
00523     m_bIsSubArrayConstant = false;
00524 }
00525 
00526 template< class T >
00527 SICPPSDK_INLINE ULONG CDataArray2D<T>::GetCount() const
00528 {
00529     return m_nCount;
00530 }
00531 
00532 template< class T >
00533 SICPPSDK_INLINE bool CDataArray2D<T>::IsConstant() const
00534 {
00535     return m_bIsConstant;
00536 }
00537 
00538 //*****************************************************************************
00539 // NB: Do not use the Doxygen \class tag for this template!!!
00546 //*****************************************************************************
00547 
00548 template <>
00549 class CDataArray2D<bool> : public CBaseDataArray2D
00550 {
00551     public:
00552     //*****************************************************************************
00559     //*****************************************************************************
00560     class Accessor
00561     {
00562         public:
00563         friend class CDataArray2D<bool>;
00564 
00567         Accessor( ) : m_nStartbit(0), m_bIsConstant(false)
00568         {
00569         }
00570 
00573         Accessor( const Accessor& in_accessor )
00574         {
00575             *this = in_accessor;
00576         }
00577 
00582         Accessor& operator=( const Accessor& in_accessor )
00583         {
00584             m_bitset = in_accessor.m_bitset;
00585             m_nStartbit = in_accessor.m_nStartbit;
00586             m_bIsConstant = in_accessor.m_bIsConstant;
00587             return *this;
00588         }
00589 
00595         const bool operator[] ( ULONG in_nIndex ) const
00596         {
00597             ULONG nIndex = m_nStartbit + (m_bitset.GetCount() == UINT_MAX ? 0 : in_nIndex);
00598             return m_bitset.GetBit( nIndex );
00599         }
00600 
00607         CStatus Set( ULONG in_nIndex, bool in_bVal )
00608         {
00609             return m_bitset.SetBit( m_nStartbit + in_nIndex, in_bVal );
00610         }
00611 
00615         ULONG GetCount() const
00616         {
00617             return m_bitset.GetCount( );
00618         }
00619 
00620         private:
00621 
00622         void SetAsConstant( bool in_bConst )
00623         {
00624             m_bIsConstant = in_bConst;
00625         }
00626 
00627         ULONG m_nStartbit;
00628         CBitsetHelper m_bitset;
00629         bool m_bIsConstant;
00630     };
00631 
00637     SICPPSDK_INLINE CDataArray2D( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00638 
00642     SICPPSDK_INLINE CDataArray2D( ICENodeContext& in_ctxt ) ;
00643 
00646     SICPPSDK_INLINE CDataArray2D( ) ;
00647 
00650     SICPPSDK_INLINE ~CDataArray2D( );
00651 
00668     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00669 
00675     SICPPSDK_INLINE Accessor operator[]( ULONG in_nArrayIndex ) const;
00676 
00683     SICPPSDK_INLINE Accessor Resize( ULONG in_nArrayIndex, ULONG in_nSize );
00684 
00688     SICPPSDK_INLINE ULONG GetCount() const;
00689 
00693     SICPPSDK_INLINE bool IsConstant() const;
00694 
00695 private:
00696     SICPPSDK_INLINE Accessor Get( ULONG in_nArrayIndex ) const;
00697     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00698 };
00699 
00700 SICPPSDK_INLINE CDataArray2D<bool>::CDataArray2D( )
00701 {
00702 }
00703 
00704 SICPPSDK_INLINE CDataArray2D<bool>::CDataArray2D( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00705 {
00706     m_ctxt = in_ctxt;
00707 
00708     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00709 }
00710 
00711 SICPPSDK_INLINE CDataArray2D<bool>::CDataArray2D( ICENodeContext& in_ctxt )
00712 {
00713     m_ctxt = in_ctxt;
00714 
00715     AcquireOutputDataArray( GetDefaultType() );
00716 }
00717 
00718 SICPPSDK_INLINE CDataArray2D<bool>::~CDataArray2D( )
00719 {
00720     ReleaseDataArray( );
00721 }
00722 
00723 SICPPSDK_INLINE CStatus CDataArray2D<bool>::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00724 {
00725     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00726 }
00727 
00728 SICPPSDK_INLINE CDataArray2D<bool>::Accessor CDataArray2D<bool>::Get( ULONG in_nArrayIndex ) const
00729 {
00730     Accessor a;
00731     GetSubArray( in_nArrayIndex, (void*&)a.m_bitset.GetArrayRef(), (ULONG&)a.m_bitset.GetCountRef(), a.m_nStartbit );
00732     a.SetAsConstant( GetSubArrayConstant() );
00733     return a;
00734 }
00735 
00736 SICPPSDK_INLINE CDataArray2D<bool>::Accessor CDataArray2D<bool>::operator[]( ULONG in_nArrayIndex ) const
00737 {
00738     return Get( in_nArrayIndex );
00739 }
00740 
00741 SICPPSDK_INLINE CDataArray2D<bool>::Accessor CDataArray2D<bool>::Resize( ULONG in_nArrayIndex, ULONG in_nSize )
00742 {
00743     Accessor a;
00744     ResizeSubArray( in_nArrayIndex, in_nSize, (void*&)a.m_bitset.GetArrayRef(), (ULONG&)a.m_bitset.GetCountRef(), a.m_nStartbit );
00745     a.SetAsConstant( GetSubArrayConstant() );
00746     return a;
00747 }
00748 
00749 SICPPSDK_INLINE ULONG CDataArray2D<bool>::GetCount() const
00750 {
00751     return m_nCount;
00752 }
00753 
00754 SICPPSDK_INLINE bool CDataArray2D<bool>::IsConstant() const
00755 {
00756     return m_bIsConstant;
00757 }
00758 
00759 //*****************************************************************************
00766 //*****************************************************************************
00767 class CDataArray2DCustomType : public CBaseDataArray2D
00768 {
00769     public:
00770 
00771     typedef unsigned char TData;
00772 
00773     //*****************************************************************************
00778     //*****************************************************************************
00779 
00780     class Accessor
00781     {
00782         public:
00783         friend class CDataArray2DCustomType;
00784 
00787         Accessor( ) : m_nAccessIndex(0), m_nCount(0), m_bIsConstant(false), m_pParent(NULL)
00788         {
00789         }
00790 
00793         Accessor( const Accessor& in_accessor )
00794         {
00795             *this = in_accessor;
00796         }
00797 
00802         Accessor& operator=( const Accessor& in_accessor )
00803         {
00804             m_nCount = in_accessor.m_nCount;
00805             m_nAccessIndex = in_accessor.m_nAccessIndex;
00806             m_bIsConstant = in_accessor.m_bIsConstant;
00807             m_pParent = in_accessor.m_pParent;
00808             return *this;
00809         }
00810 
00819         SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize );
00820 
00832         SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize  ) const;
00833 
00845         SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize  ) const;
00846 
00853         SICPPSDK_INLINE TData* Resize( ULONG in_nIndex, ULONG in_nSize );
00854 
00858         ULONG GetCount() const
00859         {
00860             return m_nCount;
00861         }
00862 
00863         private:
00864         void SetAsConstant( bool in_bConst )
00865         {
00866             m_bIsConstant = in_bConst;
00867         }
00868 
00869         void SetIndex( ULONG in_nIndex )
00870         {
00871             m_nAccessIndex = in_nIndex;
00872         }
00873 
00874         void SetParent( CDataArray2DCustomType* in_pParent )
00875         {
00876             m_pParent = in_pParent;
00877         }
00878 
00879         ULONG& GetCountRef()
00880         {
00881             return m_nCount;
00882         }
00883 
00884         ULONG m_nAccessIndex;
00885         ULONG m_nCount;
00886         bool m_bIsConstant;
00887         CDataArray2DCustomType* m_pParent;
00888     };
00889 
00895     SICPPSDK_INLINE CDataArray2DCustomType( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00896 
00900     SICPPSDK_INLINE CDataArray2DCustomType( ICENodeContext& in_ctxt ) ;
00901 
00904     SICPPSDK_INLINE CDataArray2DCustomType( ) ;
00905 
00908     SICPPSDK_INLINE ~CDataArray2DCustomType( );
00909 
00926     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00927 
00933     SICPPSDK_INLINE Accessor operator[]( ULONG in_nArrayIndex ) const;
00934 
00941     SICPPSDK_INLINE Accessor Resize( ULONG in_nArrayIndex, ULONG in_nSize );
00942 
00946     SICPPSDK_INLINE ULONG GetCount() const;
00947 
00951     SICPPSDK_INLINE bool IsConstant() const;
00952 
00953 private:
00954     SICPPSDK_INLINE Accessor Get( ULONG in_nArrayIndex ) const;
00955     SICPPSDK_INLINE void Clear();
00956     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00957 };
00958 
00959 SICPPSDK_INLINE CDataArray2DCustomType::CDataArray2DCustomType( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00960 {
00961     m_ctxt = in_ctxt;
00962 
00963     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00964 }
00965 
00966 SICPPSDK_INLINE CDataArray2DCustomType::CDataArray2DCustomType( ICENodeContext& in_ctxt )
00967 {
00968     m_ctxt = in_ctxt;
00969 
00970     AcquireOutputDataArray( GetDefaultType() );
00971 }
00972 
00973 SICPPSDK_INLINE CDataArray2DCustomType::~CDataArray2DCustomType( )
00974 {
00975     ReleaseDataArray( );
00976 }
00977 
00978 SICPPSDK_INLINE CDataArray2DCustomType::CDataArray2DCustomType( )
00979 {
00980 }
00981 
00982 SICPPSDK_INLINE CStatus CDataArray2DCustomType::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00983 {
00984     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00985 }
00986 
00987 SICPPSDK_INLINE CDataArray2DCustomType::Accessor CDataArray2DCustomType::Get( ULONG in_nArrayIndex ) const
00988 {
00989     ULONG nNotused;
00990     void* pNotused;
00991 
00992     Accessor a;
00993     GetSubArray( in_nArrayIndex, pNotused, (ULONG&)a.GetCountRef(), nNotused );
00994     a.SetParent( (CDataArray2DCustomType*)this );
00995     a.SetAsConstant( GetSubArrayConstant() );
00996     a.SetIndex( in_nArrayIndex );
00997     return a;
00998 }
00999 
01000 SICPPSDK_INLINE CDataArray2DCustomType::Accessor CDataArray2DCustomType::operator[]( ULONG in_nArrayIndex ) const
01001 {
01002     return Get( in_nArrayIndex );
01003 }
01004 
01005 SICPPSDK_INLINE CDataArray2DCustomType::Accessor CDataArray2DCustomType::Resize( ULONG in_nArrayIndex, ULONG in_nSize )
01006 {
01007     ULONG nNotused;
01008     void* pNotused;
01009 
01010     Accessor a;
01011     ResizeSubArray( in_nArrayIndex, in_nSize, pNotused, (ULONG&)a.GetCountRef(), nNotused );
01012     a.SetParent( (CDataArray2DCustomType*)this );
01013     a.SetAsConstant( GetSubArrayConstant() );
01014     a.SetIndex( in_nArrayIndex );
01015     return a;
01016 }
01017 
01018 SICPPSDK_INLINE void CDataArray2DCustomType::Clear()
01019 {
01020     ReleaseDataArray( );
01021     m_nHandle = UINT_MAX;
01022     m_nCount = 0;
01023     m_bIsConstant = false;
01024 }
01025 
01026 SICPPSDK_INLINE ULONG CDataArray2DCustomType::GetCount() const
01027 {
01028     return m_nCount;
01029 }
01030 
01031 SICPPSDK_INLINE bool CDataArray2DCustomType::IsConstant() const
01032 {
01033     return m_bIsConstant;
01034 }
01035 
01036 SICPPSDK_INLINE CStatus CDataArray2DCustomType::Accessor::SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize )
01037 {
01038     return m_pParent->SetCustomTypeData2D( m_nAccessIndex, in_nIndex, in_pData, in_nSize );
01039 }
01040 
01041 SICPPSDK_INLINE CStatus CDataArray2DCustomType::Accessor::GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize  ) const
01042 {
01043     return m_pParent->GetCustomTypeData2D( m_nAccessIndex, in_nIndex, out_ppData, out_nSize );
01044 }
01045 
01046 SICPPSDK_INLINE CStatus CDataArray2DCustomType::Accessor::GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize  ) const
01047 {
01048     return m_pParent->GetCustomTypeData2D( m_nAccessIndex, in_nIndex, out_ppData, out_nSize );
01049 }
01050 
01051 SICPPSDK_INLINE CDataArray2DCustomType::TData* CDataArray2DCustomType::Accessor::Resize( ULONG in_nIndex, ULONG in_nSize )
01052 {
01053     return m_pParent->ResizeCustomTypeData2D( m_nAccessIndex, in_nIndex, in_nSize );
01054 }
01055 
01056 //*****************************************************************************
01063 //*****************************************************************************
01064 class CDataArray2DString : public CBaseDataArray2D
01065 {
01066     public:
01067 
01068     typedef wchar_t TData;
01069 
01070     //*****************************************************************************
01075     //*****************************************************************************
01076 
01077     class Accessor
01078     {
01079         public:
01080         friend class CDataArray2DString;
01081 
01084         Accessor( ) : m_nAccessIndex(0), m_nCount(0), m_bIsConstant(false), m_pParent(NULL)
01085         {
01086         }
01087 
01090         Accessor( const Accessor& in_accessor )
01091         {
01092             *this = in_accessor;
01093         }
01094 
01099         Accessor& operator=( const Accessor& in_accessor )
01100         {
01101             m_nCount = in_accessor.m_nCount;
01102             m_nAccessIndex = in_accessor.m_nAccessIndex;
01103             m_bIsConstant = in_accessor.m_bIsConstant;
01104             m_pParent = in_accessor.m_pParent;
01105             return *this;
01106         }
01107 
01113         SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const CString& in_str );
01114 
01120         SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, CString& out_str ) const;
01121 
01127         SICPPSDK_INLINE CString operator[]( ULONG in_nIndex ) const;
01128 
01136         SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const TData* in_pStr, ULONG in_nSize );
01137 
01151         SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, const TData** out_ppStr, ULONG& out_nCount ) const;
01152 
01166         SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, TData** out_ppStr, ULONG& out_nCount ) const;
01167 
01174         SICPPSDK_INLINE TData* Resize( ULONG in_nIndex, ULONG in_nCount );
01175 
01179         ULONG GetCount() const
01180         {
01181             return m_nCount;
01182         }
01183 
01184         private:
01185         void SetAsConstant( bool in_bConst )
01186         {
01187             m_bIsConstant = in_bConst;
01188         }
01189 
01190         void SetIndex( ULONG in_nIndex )
01191         {
01192             m_nAccessIndex = in_nIndex;
01193         }
01194 
01195         void SetParent( CDataArray2DString* in_pParent )
01196         {
01197             m_pParent = in_pParent;
01198         }
01199 
01200         ULONG& GetCountRef()
01201         {
01202             return m_nCount;
01203         }
01204 
01205         ULONG m_nAccessIndex;
01206         ULONG m_nCount;
01207         bool m_bIsConstant;
01208         CDataArray2DString* m_pParent;
01209     };
01210 
01216     SICPPSDK_INLINE CDataArray2DString( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
01217 
01221     SICPPSDK_INLINE CDataArray2DString( ICENodeContext& in_ctxt ) ;
01222 
01225     SICPPSDK_INLINE CDataArray2DString( ) ;
01226 
01229     SICPPSDK_INLINE ~CDataArray2DString( );
01230 
01247     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
01248 
01254     SICPPSDK_INLINE Accessor operator[]( ULONG in_nArrayIndex ) const;
01255 
01262     SICPPSDK_INLINE Accessor Resize( ULONG in_nArrayIndex, ULONG in_nCount );
01263 
01267     SICPPSDK_INLINE ULONG GetCount() const;
01268 
01272     SICPPSDK_INLINE bool IsConstant() const;
01273 
01274 private:
01275     SICPPSDK_INLINE Accessor Get( ULONG in_nArrayIndex ) const;
01276     SICPPSDK_INLINE void Clear();
01277     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
01278 };
01279 
01280 SICPPSDK_INLINE CDataArray2DString::CDataArray2DString( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
01281 {
01282     m_ctxt = in_ctxt;
01283 
01284     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
01285 }
01286 
01287 SICPPSDK_INLINE CDataArray2DString::CDataArray2DString( ICENodeContext& in_ctxt )
01288 {
01289     m_ctxt = in_ctxt;
01290 
01291     AcquireOutputDataArray( GetDefaultType() );
01292 }
01293 
01294 SICPPSDK_INLINE CDataArray2DString::~CDataArray2DString( )
01295 {
01296     ReleaseDataArray( );
01297 }
01298 
01299 SICPPSDK_INLINE CDataArray2DString::CDataArray2DString( )
01300 {
01301 }
01302 
01303 SICPPSDK_INLINE CStatus CDataArray2DString::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
01304 {
01305     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
01306 }
01307 
01308 SICPPSDK_INLINE CDataArray2DString::Accessor CDataArray2DString::Get( ULONG in_nArrayIndex ) const
01309 {
01310     ULONG nNotused;
01311     void* pNotused;
01312 
01313     Accessor a;
01314     GetSubArray( in_nArrayIndex, pNotused, (ULONG&)a.GetCountRef(), nNotused );
01315     a.SetParent( (CDataArray2DString*)this );
01316     a.SetAsConstant( GetSubArrayConstant() );
01317     a.SetIndex( in_nArrayIndex );
01318     return a;
01319 }
01320 
01321 SICPPSDK_INLINE CDataArray2DString::Accessor CDataArray2DString::operator[]( ULONG in_nArrayIndex ) const
01322 {
01323     return Get( in_nArrayIndex );
01324 }
01325 
01326 SICPPSDK_INLINE CDataArray2DString::Accessor CDataArray2DString::Resize( ULONG in_nArrayIndex, ULONG in_nSize )
01327 {
01328     ULONG nNotused;
01329     void* pNotused;
01330 
01331     Accessor a;
01332     ResizeSubArray( in_nArrayIndex, in_nSize, pNotused, (ULONG&)a.GetCountRef(), nNotused );
01333     a.SetParent( (CDataArray2DString*)this );
01334     a.SetAsConstant( GetSubArrayConstant() );
01335     a.SetIndex( in_nArrayIndex );
01336     return a;
01337 }
01338 
01339 SICPPSDK_INLINE void CDataArray2DString::Clear()
01340 {
01341     ReleaseDataArray( );
01342     m_nHandle = UINT_MAX;
01343     m_nCount = 0;
01344     m_bIsConstant = false;
01345 }
01346 
01347 SICPPSDK_INLINE ULONG CDataArray2DString::GetCount() const
01348 {
01349     return m_nCount;
01350 }
01351 
01352 SICPPSDK_INLINE bool CDataArray2DString::IsConstant() const
01353 {
01354     return m_bIsConstant;
01355 }
01356 
01357 SICPPSDK_INLINE CStatus CDataArray2DString::Accessor::SetData( ULONG in_nIndex, const CString& in_str )
01358 {
01359     return m_pParent->SetStringData2D( m_nAccessIndex, in_nIndex, in_str.GetWideString(), in_str.Length() );
01360 }
01361 
01362 SICPPSDK_INLINE CStatus CDataArray2DString::Accessor::GetData( ULONG in_nIndex, CString& out_str ) const
01363 {
01364     const wchar_t* pzStr;
01365     ULONG nSize;
01366     CStatus st = m_pParent->GetStringData2D( m_nAccessIndex, in_nIndex, &pzStr, nSize );
01367     out_str = CString(pzStr,nSize);
01368     return st;
01369 }
01370 
01371 SICPPSDK_INLINE CString CDataArray2DString::Accessor::operator[]( ULONG i ) const
01372 {
01373     CString str;
01374     GetData( i, str );
01375     return str;
01376 }
01377 
01378 SICPPSDK_INLINE CStatus CDataArray2DString::Accessor::SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize )
01379 {
01380     return m_pParent->SetStringData2D( m_nAccessIndex, in_nIndex, in_pData, in_nSize );
01381 }
01382 
01383 SICPPSDK_INLINE CStatus CDataArray2DString::Accessor::GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize  ) const
01384 {
01385     return m_pParent->GetStringData2D( m_nAccessIndex, in_nIndex, out_ppData, out_nSize );
01386 }
01387 
01388 SICPPSDK_INLINE CStatus CDataArray2DString::Accessor::GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize  ) const
01389 {
01390     return m_pParent->GetStringData2D( m_nAccessIndex, in_nIndex, out_ppData, out_nSize );
01391 }
01392 
01393 SICPPSDK_INLINE CDataArray2DString::TData* CDataArray2DString::Accessor::Resize( ULONG in_nIndex, ULONG in_nSize )
01394 {
01395     return m_pParent->ResizeStringData2D( m_nAccessIndex, in_nIndex, in_nSize );
01396 }
01397 
01398 // Explicit template instances
01476 typedef CDataArray2D< float > CDataArray2DFloat;
01477 typedef CDataArray2D< LONG > CDataArray2DLong;
01478 typedef CDataArray2D< bool > CDataArray2DBool;
01479 typedef CDataArray2D< XSI::MATH::CVector2f > CDataArray2DVector2f;
01480 typedef CDataArray2D< XSI::MATH::CVector3f > CDataArray2DVector3f;
01481 typedef CDataArray2D< XSI::MATH::CVector4f > CDataArray2DVector4f;
01482 typedef CDataArray2D< XSI::MATH::CQuaternionf > CDataArray2DQuaternionf;
01483 typedef CDataArray2D< XSI::MATH::CRotationf > CDataArray2DRotationf;
01484 typedef CDataArray2D< XSI::MATH::CMatrix3f > CDataArray2DMatrix3f;
01485 typedef CDataArray2D< XSI::MATH::CMatrix4f > CDataArray2DMatrix4f;
01486 typedef CDataArray2D< XSI::MATH::CColor4f > CDataArray2DColor4f;
01487 typedef XSI::CDataArray2D< XSI::MATH::CShape> CDataArray2DShape;
01488 
01489 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DFloat::GetDefaultType( ){return siICENodeDataFloat;}
01490 SICPPSDK_INLINE siICENodeDataType CDataArray2DBool::GetDefaultType( ){return siICENodeDataBool;}
01491 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DLong::GetDefaultType( ){return siICENodeDataLong;}
01492 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DVector2f::GetDefaultType( ){return siICENodeDataVector2;}
01493 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DVector3f::GetDefaultType( ){return siICENodeDataVector3;}
01494 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DVector4f::GetDefaultType( ){return siICENodeDataVector4;}
01495 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DQuaternionf::GetDefaultType( ){return siICENodeDataQuaternion;}
01496 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DMatrix3f::GetDefaultType( ){return siICENodeDataMatrix33;}
01497 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DMatrix4f::GetDefaultType( ){return siICENodeDataMatrix44;}
01498 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DColor4f::GetDefaultType( ){return siICENodeDataColor4;}
01499 template<> SICPPSDK_INLINE siICENodeDataType CDataArray2DRotationf::GetDefaultType( ){return siICENodeDataRotation;}
01500 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArray2DShape::GetDefaultType( ){return siICENodeDataShape;}
01501 SICPPSDK_INLINE XSI::siICENodeDataType CDataArray2DCustomType::GetDefaultType( ){return siICENodeDataCustomType;}
01502 SICPPSDK_INLINE XSI::siICENodeDataType CDataArray2DString::GetDefaultType( ){return siICENodeDataString;}
01503 }; // XSI
01504 
01505 #endif // __XSIDATAARRAY2D_H__