xsi_dataarray.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 __XSIDATAARRAY_H__
00018 #define __XSIDATAARRAY_H__
00019 
00020 #include <sicppsdk.h>
00021 #include <xsi_icenodecontext.h>
00022 #include <xsi_indexset.h>
00023 
00024 #include <xsi_vector2f.h>
00025 #include <xsi_vector3f.h>
00026 #include <xsi_vector4f.h>
00027 #include <xsi_quaternionf.h>
00028 #include <xsi_rotationf.h>
00029 #include <xsi_matrix3f.h>
00030 #include <xsi_matrix4f.h>
00031 #include <xsi_color4f.h>
00032 #include <xsi_shape.h>
00033 
00034 namespace XSI {
00035 
00036 class CBaseDataArray
00037 {
00038     public:
00039     friend class ICENodeContext;
00040 
00041     CBaseDataArray() :
00042         m_nHandle(UINT_MAX),
00043         m_pData(NULL),
00044         m_bIsConstant(true),
00045         m_nCount(1)
00046     {}
00047 
00048     protected:
00049     SICPPSDK_INLINE ICENodeContext& GetContextRef();
00050     SICPPSDK_INLINE ULONG& GetHandleRef();
00051     SICPPSDK_INLINE void*& GetDataRef();
00052     SICPPSDK_INLINE bool& GetConstantRef();
00053     SICPPSDK_INLINE ULONG& GetCountRef();
00054 
00055     virtual SICPPSDK_INLINE CStatus AcquireInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex );
00056     virtual SICPPSDK_INLINE CStatus CopyFromInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex );
00057     virtual SICPPSDK_INLINE CStatus AcquireOutputDataArray( XSI::siICENodeDataType in_arrayDataType );
00058     virtual SICPPSDK_INLINE CStatus ReleaseDataArray( );
00059     SICPPSDK_INLINE CStatus SetCustomTypeData( ULONG in_nIndex, const unsigned char* in_pData, ULONG in_nSize );
00060     SICPPSDK_INLINE CStatus GetCustomTypeData( ULONG in_nIndex, const unsigned char** out_ppData, ULONG& out_nSize ) const;
00061     SICPPSDK_INLINE CStatus GetCustomTypeData( ULONG in_nIndex, unsigned char** out_ppData, ULONG& out_nSize ) const;
00062     SICPPSDK_INLINE unsigned char* ResizeCustomTypeData( ULONG in_nIndex, ULONG in_nSize );
00063 
00064     SICPPSDK_INLINE CStatus SetStringData( ULONG in_nIndex, const wchar_t* in_pData, ULONG in_nSize );
00065     SICPPSDK_INLINE CStatus GetStringData( ULONG in_nIndex, const wchar_t** out_ppData, ULONG& out_nSize ) const;
00066     SICPPSDK_INLINE CStatus GetStringData( ULONG in_nIndex, wchar_t** out_ppData, ULONG& out_nSize ) const;
00067     SICPPSDK_INLINE wchar_t* ResizeStringData( ULONG in_nIndex, ULONG in_nSize );
00068 
00069     ICENodeContext m_ctxt;
00070     ULONG m_nHandle;
00071     void* m_pData;
00072     bool m_bIsConstant;
00073     ULONG m_nCount;
00074 };
00075 
00076 SICPPSDK_INLINE CStatus CBaseDataArray::AcquireInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00077 {
00078     return m_ctxt.AcquireInputDataArray( *this, in_arrayDataType, in_nInputPortID, in_nInstanceIndex );
00079 }
00080 
00081 SICPPSDK_INLINE CStatus CBaseDataArray::CopyFromInputDataArray( XSI::siICENodeDataType in_arrayDataType, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00082 {
00083     return m_ctxt.CopyFromInputDataArray( *this, in_arrayDataType, in_nInputPortID, in_nInstanceIndex );
00084 }
00085 
00086 SICPPSDK_INLINE CStatus CBaseDataArray::AcquireOutputDataArray( XSI::siICENodeDataType in_arrayDataType )
00087 {
00088     return m_ctxt.AcquireOutputDataArray( *this, in_arrayDataType );
00089 }
00090 
00091 SICPPSDK_INLINE CStatus CBaseDataArray::ReleaseDataArray( )
00092 {
00093     return m_ctxt.ReleaseDataArray( *this );
00094 }
00095 
00096 SICPPSDK_INLINE CStatus CBaseDataArray::SetCustomTypeData( ULONG in_nIndex, const unsigned char* in_pData, ULONG in_nSize )
00097 {
00098     return m_ctxt.SetCustomTypeData( *this, in_nIndex, in_pData, in_nSize );
00099 }
00100 
00101 SICPPSDK_INLINE CStatus CBaseDataArray::GetCustomTypeData( ULONG in_nIndex, const unsigned char** out_ppData, ULONG& out_nSize ) const
00102 {
00103     return m_ctxt.GetCustomTypeData( (CBaseDataArray&)*this, in_nIndex, out_ppData, out_nSize );
00104 }
00105 
00106 SICPPSDK_INLINE CStatus CBaseDataArray::GetCustomTypeData( ULONG in_nIndex, unsigned char** out_ppData, ULONG& out_nSize ) const
00107 {
00108     return m_ctxt.GetCustomTypeData( (CBaseDataArray&)*this, in_nIndex, out_ppData, out_nSize );
00109 }
00110 
00111 SICPPSDK_INLINE unsigned char* CBaseDataArray::ResizeCustomTypeData( ULONG in_nIndex, ULONG in_nSize )
00112 {
00113     return m_ctxt.ResizeCustomTypeData( *this, in_nIndex, in_nSize );
00114 }
00115 
00116 SICPPSDK_INLINE CStatus CBaseDataArray::SetStringData( ULONG in_nIndex, const wchar_t* in_pData, ULONG in_nSize )
00117 {
00118     return m_ctxt.SetStringData( *this, in_nIndex, in_pData, in_nSize );
00119 }
00120 
00121 SICPPSDK_INLINE CStatus CBaseDataArray::GetStringData( ULONG in_nIndex, const wchar_t** out_ppData, ULONG& out_nSize ) const
00122 {
00123     return m_ctxt.GetStringData( (CBaseDataArray&)*this, in_nIndex, out_ppData, out_nSize );
00124 }
00125 
00126 SICPPSDK_INLINE CStatus CBaseDataArray::GetStringData( ULONG in_nIndex, wchar_t** out_ppData, ULONG& out_nSize ) const
00127 {
00128     return m_ctxt.GetStringData( (CBaseDataArray&)*this, in_nIndex, out_ppData, out_nSize );
00129 }
00130 
00131 SICPPSDK_INLINE wchar_t* CBaseDataArray::ResizeStringData( ULONG in_nIndex, ULONG in_nSize )
00132 {
00133     return m_ctxt.ResizeStringData( *this, in_nIndex, in_nSize );
00134 }
00135 
00136 SICPPSDK_INLINE ICENodeContext& CBaseDataArray::GetContextRef()
00137 {
00138     return m_ctxt;
00139 }
00140 
00141 SICPPSDK_INLINE ULONG& CBaseDataArray::GetHandleRef()
00142 {
00143     return m_nHandle;
00144 }
00145 
00146 SICPPSDK_INLINE void*& CBaseDataArray::GetDataRef()
00147 {
00148     return m_pData;
00149 }
00150 
00151 SICPPSDK_INLINE bool& CBaseDataArray::GetConstantRef()
00152 {
00153     return m_bIsConstant;
00154 }
00155 
00156 SICPPSDK_INLINE ULONG& CBaseDataArray::GetCountRef()
00157 {
00158     return m_nCount;
00159 }
00160 
00161 //*****************************************************************************
00206 //*****************************************************************************
00207 
00208 template <class T>
00209 class CDataArray : public CBaseDataArray
00210 {
00211 public:
00228     typedef T TData;
00229 
00235     SICPPSDK_INLINE CDataArray( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00236 
00240     SICPPSDK_INLINE CDataArray( ICENodeContext& in_ctxt ) ;
00241 
00244     SICPPSDK_INLINE CDataArray< T >( ) ;
00245 
00248     SICPPSDK_INLINE ~CDataArray( );
00249 
00255     SICPPSDK_INLINE const TData& operator[]( ULONG in_nIndex ) const;
00256 
00263     SICPPSDK_INLINE TData& operator[]( ULONG in_nIndex ) ;
00264 
00281     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00282 
00286     SICPPSDK_INLINE ULONG GetCount() const;
00287 
00291     SICPPSDK_INLINE bool IsConstant() const;
00292 
00293 private:
00294     SICPPSDK_INLINE void Clear();
00295     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00296 
00297 #ifdef _DEBUG
00298     TData* m_pDebugData;
00299 #endif
00300 
00301 };
00302 
00303 template< class T >
00304 SICPPSDK_INLINE CDataArray<T>::CDataArray( )
00305 {
00306 #ifdef _DEBUG
00307     m_pDebugData = NULL;
00308 #endif
00309 }
00310 
00311 template< class T >
00312 SICPPSDK_INLINE CDataArray<T>::CDataArray( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00313 {
00314     m_ctxt = in_ctxt;
00315 
00316     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00317 
00318 #ifdef _DEBUG
00319     m_pDebugData = (T*)GetDataRef();
00320 #endif
00321 }
00322 
00323 template< class T >
00324 SICPPSDK_INLINE CDataArray<T>::CDataArray( ICENodeContext& in_ctxt )
00325 {
00326     m_ctxt = in_ctxt;
00327 
00328     AcquireOutputDataArray( GetDefaultType() );
00329 
00330 #ifdef _DEBUG
00331     m_pDebugData = (T*)GetDataRef();
00332 #endif
00333 }
00334 
00335 template< class T >
00336 SICPPSDK_INLINE CDataArray<T>::~CDataArray( )
00337 {
00338     ReleaseDataArray( );
00339 }
00340 
00341 template< class T >
00342 SICPPSDK_INLINE const T& CDataArray<T>::operator[]( ULONG in_index ) const
00343 {
00344     assert( !m_bIsConstant ? in_index < m_nCount : true );
00345     T* pData = (T*)GetDataRef();
00346 
00347     if (!pData) 
00348     {
00349         assert( pData != NULL );
00350         static T defVal;
00351         return defVal;
00352     }
00353     
00354     if (m_bIsConstant) 
00355     {
00356         return *pData;
00357     }
00358     
00359     return pData[in_index]; 
00360 }
00361 
00362 template< class T >
00363 SICPPSDK_INLINE T& CDataArray<T>::operator[]( ULONG in_index )
00364 {
00365     assert( !m_bIsConstant ? in_index < m_nCount : true );
00366     T* pData = (T*)GetDataRef();
00367     
00368     if (!pData) 
00369     {
00370         assert( pData != NULL );
00371         static T defVal;
00372         return defVal;
00373     }
00374     
00375     if (m_bIsConstant) 
00376     {
00377         return *pData;
00378     }
00379     
00380     return pData[in_index];     
00381 }
00382 
00383 template< class T >
00384 SICPPSDK_INLINE CStatus CDataArray<T>::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00385 {
00386     CStatus st = CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00387 
00388 #ifdef _DEBUG
00389     m_pDebugData = (T*)GetDataRef();
00390 #endif
00391 
00392     return st;
00393 }
00394 
00395 template< class T >
00396 SICPPSDK_INLINE void CDataArray<T>::Clear()
00397 {
00398     ReleaseDataArray( );
00399     m_nHandle = UINT_MAX;
00400     m_nCount = 0;
00401     m_bIsConstant = false;
00402 }
00403 
00404 template< class T >
00405 SICPPSDK_INLINE ULONG CDataArray<T>::GetCount() const
00406 {
00407     return m_nCount;
00408 }
00409 
00410 template< class T >
00411 SICPPSDK_INLINE bool CDataArray<T>::IsConstant() const
00412 {
00413     return m_bIsConstant;
00414 }
00415 
00416 //*****************************************************************************
00417 // NB: Do not use the Doxygen \class tag for this template!!!
00424 //*****************************************************************************
00425 template<>
00426 class CDataArray< bool > : public CBaseDataArray
00427 {
00428     public:
00429 
00432     SICPPSDK_INLINE CDataArray< bool >( ) ;
00433 
00439     SICPPSDK_INLINE CDataArray< bool >( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00440 
00444     SICPPSDK_INLINE CDataArray< bool >( ICENodeContext& in_ctxt ) ;
00445 
00448     SICPPSDK_INLINE ~CDataArray< bool >( );
00449 
00466     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00467 
00473     SICPPSDK_INLINE const bool operator[]( ULONG in_nIndex ) const;
00474 
00481     SICPPSDK_INLINE CStatus Set( ULONG in_nIndex, bool in_bVal ) ;
00482 
00486     SICPPSDK_INLINE ULONG GetCount() const;
00487 
00491     SICPPSDK_INLINE bool IsConstant() const;
00492 
00493 private:
00494     SICPPSDK_INLINE void Clear();
00495     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00496 
00497     CBitsetHelper m_bitset;
00498 };
00499 
00500 SICPPSDK_INLINE CDataArray<bool>::CDataArray( )
00501 {
00502 }
00503 
00504 SICPPSDK_INLINE CDataArray<bool>::CDataArray( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00505 {
00506     m_ctxt = in_ctxt;
00507 
00508     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00509 
00510     m_bitset.GetCountRef() = GetCountRef();
00511     m_bitset.GetArrayRef() = (ULONG*)GetDataRef();
00512 }
00513 
00514 SICPPSDK_INLINE CDataArray<bool>::CDataArray( ICENodeContext& in_ctxt )
00515 {
00516     m_ctxt = in_ctxt;
00517     m_bIsConstant = true;
00518     m_nCount = 1;
00519 
00520     AcquireOutputDataArray( GetDefaultType() );
00521 
00522     m_bitset.GetCountRef() = m_nCount;
00523     m_bitset.GetArrayRef() = (ULONG*)GetDataRef();
00524 }
00525 
00526 SICPPSDK_INLINE CDataArray<bool>::~CDataArray( )
00527 {
00528     ReleaseDataArray( );
00529 }
00530 
00531 SICPPSDK_INLINE CStatus CDataArray<bool>::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00532 {
00533     CStatus st = CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00534 
00535     m_bitset.GetCountRef() = GetCountRef();
00536     m_bitset.GetArrayRef() = (ULONG*)GetDataRef();
00537 
00538     return st;
00539 }
00540 
00541 SICPPSDK_INLINE CStatus CDataArray<bool>::Set( ULONG in_nIndex, bool in_bVal )
00542 {
00543     return m_bitset.SetBit( in_nIndex, in_bVal );
00544 }
00545 
00546 SICPPSDK_INLINE const bool CDataArray<bool>::operator[] ( ULONG in_nIndex ) const
00547 {
00548     ULONG nIndex = m_bIsConstant ? 0 : in_nIndex;
00549     return m_bitset.GetBit( nIndex );
00550 }
00551 
00552 SICPPSDK_INLINE void CDataArray<bool>::Clear()
00553 {
00554     ReleaseDataArray( );
00555     m_nHandle = UINT_MAX;
00556     m_bIsConstant = true;
00557     m_nCount = 1;
00558     m_bitset.Clear();
00559 }
00560 
00561 SICPPSDK_INLINE XSI::siICENodeDataType CDataArray<bool>::GetDefaultType()
00562 {
00563     return siICENodeDataBool;
00564 }
00565 
00566 SICPPSDK_INLINE ULONG CDataArray<bool>::GetCount() const
00567 {
00568     return m_nCount;
00569 }
00570 
00571 SICPPSDK_INLINE bool CDataArray<bool>::IsConstant() const
00572 {
00573     return m_bIsConstant;
00574 }
00575 
00576 //*****************************************************************************
00583 //*****************************************************************************
00584 class CDataArrayCustomType : public CBaseDataArray
00585 {
00586     public:
00587     typedef unsigned char TData;
00588 
00591     SICPPSDK_INLINE CDataArrayCustomType( ) ;
00592 
00598     SICPPSDK_INLINE CDataArrayCustomType( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00599 
00603     SICPPSDK_INLINE CDataArrayCustomType( ICENodeContext& in_ctxt ) ;
00604 
00607     SICPPSDK_INLINE ~CDataArrayCustomType( );
00608 
00625     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00626 
00635     SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize );
00636 
00646     SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize  ) const;
00647 
00657     SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize  ) const;
00658 
00664     SICPPSDK_INLINE TData* Resize( ULONG in_nIndex, ULONG in_nSize );
00665 
00669     SICPPSDK_INLINE ULONG GetCount() const;
00670 
00674     SICPPSDK_INLINE bool IsConstant() const;
00675 
00676 private:
00677     SICPPSDK_INLINE void Clear();
00678     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00679 };
00680 
00681 SICPPSDK_INLINE CDataArrayCustomType::CDataArrayCustomType( )
00682 {
00683 }
00684 
00685 SICPPSDK_INLINE CDataArrayCustomType::CDataArrayCustomType( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00686 {
00687     m_ctxt = in_ctxt;
00688 
00689     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00690 }
00691 
00692 SICPPSDK_INLINE CDataArrayCustomType::CDataArrayCustomType( ICENodeContext& in_ctxt )
00693 {
00694     m_ctxt = in_ctxt;
00695 
00696     AcquireOutputDataArray( GetDefaultType() );
00697 }
00698 
00699 SICPPSDK_INLINE CDataArrayCustomType::~CDataArrayCustomType( )
00700 {
00701     ReleaseDataArray( );
00702 }
00703 
00704 SICPPSDK_INLINE CStatus CDataArrayCustomType::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00705 {
00706     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00707 }
00708 
00709 SICPPSDK_INLINE void CDataArrayCustomType::Clear()
00710 {
00711     ReleaseDataArray( );
00712     m_nHandle = UINT_MAX;
00713     m_bIsConstant = false;
00714     m_nCount = 0;
00715 }
00716 
00717 SICPPSDK_INLINE ULONG CDataArrayCustomType::GetCount() const
00718 {
00719     return m_nCount;
00720 }
00721 
00722 SICPPSDK_INLINE bool CDataArrayCustomType::IsConstant() const
00723 {
00724     return m_bIsConstant;
00725 }
00726 
00727 SICPPSDK_INLINE CStatus CDataArrayCustomType::SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize )
00728 {
00729     return SetCustomTypeData( in_nIndex, in_pData, in_nSize );
00730 }
00731 
00732 SICPPSDK_INLINE CStatus CDataArrayCustomType::GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize ) const
00733 {
00734     return GetCustomTypeData( in_nIndex, out_ppData, out_nSize );
00735 }
00736 
00737 SICPPSDK_INLINE CStatus CDataArrayCustomType::GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize ) const
00738 {
00739     return GetCustomTypeData( in_nIndex, out_ppData, out_nSize );
00740 }
00741 
00742 SICPPSDK_INLINE CDataArrayCustomType::TData* CDataArrayCustomType::Resize( ULONG in_nIndex, ULONG in_nSize )
00743 {
00744     return ResizeCustomTypeData( in_nIndex, in_nSize );
00745 }
00746 
00747 //*****************************************************************************
00755 //*****************************************************************************
00756 class CDataArrayString : public CBaseDataArray
00757 {
00758     public:
00759     typedef wchar_t TData;
00760 
00763     SICPPSDK_INLINE CDataArrayString( ) ;
00764 
00770     SICPPSDK_INLINE CDataArrayString( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00771 
00775     SICPPSDK_INLINE CDataArrayString( ICENodeContext& in_ctxt ) ;
00776 
00779     SICPPSDK_INLINE ~CDataArrayString( );
00780 
00797     SICPPSDK_INLINE CStatus CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex=0 ) ;
00798 
00805     SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const CString& in_str );
00806 
00812     SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, CString& out_str ) const;
00813 
00819     SICPPSDK_INLINE CString operator[]( ULONG in_nIndex ) const;
00820 
00829     SICPPSDK_INLINE CStatus SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nCount );
00830 
00843     SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, const TData** out_ppStr, ULONG& out_nCount ) const;
00844 
00854     SICPPSDK_INLINE CStatus GetData( ULONG in_nIndex, TData** out_ppStr, ULONG& out_nCount ) const;
00855 
00861     SICPPSDK_INLINE TData* Resize( ULONG in_nIndex, ULONG in_nCount );
00862 
00866     SICPPSDK_INLINE ULONG GetCount() const;
00867 
00871     SICPPSDK_INLINE bool IsConstant() const;
00872 
00873 private:
00874     SICPPSDK_INLINE void Clear();
00875     static SICPPSDK_INLINE XSI::siICENodeDataType GetDefaultType( );
00876 };
00877 
00878 SICPPSDK_INLINE CDataArrayString::CDataArrayString( )
00879 {
00880 }
00881 
00882 SICPPSDK_INLINE CDataArrayString::CDataArrayString( ICENodeContext& in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00883 {
00884     m_ctxt = in_ctxt;
00885 
00886     AcquireInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00887 }
00888 
00889 SICPPSDK_INLINE CDataArrayString::CDataArrayString( ICENodeContext& in_ctxt )
00890 {
00891     m_ctxt = in_ctxt;
00892 
00893     AcquireOutputDataArray( GetDefaultType() );
00894 }
00895 
00896 SICPPSDK_INLINE CDataArrayString::~CDataArrayString( )
00897 {
00898     ReleaseDataArray( );
00899 }
00900 
00901 SICPPSDK_INLINE CStatus CDataArrayString::CopyFrom( ULONG in_nInputPortID, ULONG in_nInstanceIndex )
00902 {
00903     return CopyFromInputDataArray( GetDefaultType(), in_nInputPortID, in_nInstanceIndex );
00904 }
00905 
00906 SICPPSDK_INLINE void CDataArrayString::Clear()
00907 {
00908     ReleaseDataArray( );
00909     m_nHandle = UINT_MAX;
00910     m_bIsConstant = false;
00911     m_nCount = 0;
00912 }
00913 
00914 SICPPSDK_INLINE ULONG CDataArrayString::GetCount() const
00915 {
00916     return m_nCount;
00917 }
00918 
00919 SICPPSDK_INLINE bool CDataArrayString::IsConstant() const
00920 {
00921     return m_bIsConstant;
00922 }
00923 
00924 SICPPSDK_INLINE CStatus CDataArrayString::SetData( ULONG in_nIndex, const CString& in_str )
00925 {
00926     return SetStringData( in_nIndex, in_str.GetWideString(), in_str.Length() );
00927 }
00928 
00929 SICPPSDK_INLINE CStatus CDataArrayString::GetData( ULONG in_nIndex, CString& out_str ) const
00930 {
00931     const wchar_t* pzStr;
00932     ULONG nSize;
00933     CStatus st = GetStringData( in_nIndex, &pzStr, nSize );
00934     out_str = CString( pzStr, nSize );
00935     return st;
00936 }
00937 
00938 SICPPSDK_INLINE CString CDataArrayString::operator[]( ULONG i ) const
00939 {
00940     CString str;
00941     GetData( i, str );
00942     return str;
00943 }
00944 
00945 SICPPSDK_INLINE CStatus CDataArrayString::SetData( ULONG in_nIndex, const TData* in_pData, ULONG in_nSize )
00946 {
00947     return SetStringData( in_nIndex, in_pData, in_nSize );
00948 }
00949 
00950 SICPPSDK_INLINE CStatus CDataArrayString::GetData( ULONG in_nIndex, const TData** out_ppData, ULONG& out_nSize ) const
00951 {
00952     return GetStringData( in_nIndex, out_ppData, out_nSize );
00953 }
00954 
00955 SICPPSDK_INLINE CStatus CDataArrayString::GetData( ULONG in_nIndex, TData** out_ppData, ULONG& out_nSize ) const
00956 {
00957     return GetStringData( in_nIndex, out_ppData, out_nSize );
00958 }
00959 
00960 SICPPSDK_INLINE CDataArrayString::TData* CDataArrayString::Resize( ULONG in_nIndex, ULONG in_nSize )
00961 {
00962     return ResizeStringData( in_nIndex, in_nSize );
00963 }
00964 
01041 typedef XSI::CDataArray< float > CDataArrayFloat;
01042 typedef XSI::CDataArray< LONG > CDataArrayLong;
01043 typedef XSI::CDataArray< bool > CDataArrayBool;
01044 typedef XSI::CDataArray< XSI::MATH::CVector2f > CDataArrayVector2f;
01045 typedef XSI::CDataArray< XSI::MATH::CVector3f > CDataArrayVector3f;
01046 typedef XSI::CDataArray< XSI::MATH::CVector4f > CDataArrayVector4f;
01047 typedef XSI::CDataArray< XSI::MATH::CQuaternionf > CDataArrayQuaternionf;
01048 typedef XSI::CDataArray< XSI::MATH::CRotationf > CDataArrayRotationf;
01049 typedef XSI::CDataArray< XSI::MATH::CMatrix3f > CDataArrayMatrix3f;
01050 typedef XSI::CDataArray< XSI::MATH::CMatrix4f > CDataArrayMatrix4f;
01051 typedef XSI::CDataArray< XSI::MATH::CColor4f > CDataArrayColor4f;
01052 typedef XSI::CDataArray< XSI::MATH::CShape> CDataArrayShape;
01053 
01054 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayFloat::GetDefaultType( ){return siICENodeDataFloat;}
01055 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayLong::GetDefaultType( ){return siICENodeDataLong;}
01056 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayVector2f::GetDefaultType( ){return siICENodeDataVector2;}
01057 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayVector3f::GetDefaultType( ){return siICENodeDataVector3;}
01058 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayVector4f::GetDefaultType( ){return siICENodeDataVector4;}
01059 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayQuaternionf::GetDefaultType( ){return siICENodeDataQuaternion;}
01060 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayMatrix3f::GetDefaultType( ){return siICENodeDataMatrix33;}
01061 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayMatrix4f::GetDefaultType( ){return siICENodeDataMatrix44;}
01062 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayColor4f::GetDefaultType( ){return siICENodeDataColor4;}
01063 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayRotationf::GetDefaultType( ){return siICENodeDataRotation;}
01064 template<> SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayShape::GetDefaultType( ){return siICENodeDataShape;}
01065 SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayCustomType::GetDefaultType(){return siICENodeDataCustomType;}
01066 SICPPSDK_INLINE XSI::siICENodeDataType CDataArrayString::GetDefaultType(){return siICENodeDataString;}
01067 
01068 };
01069 
01070 #endif // __XSIDATAARRAY_H__