#if !defined( __SUB_ARRAY_H ) #define __SUB_ARRAY_H #if( _MSC_VER >= 1000 ) #pragma once #endif #include "vtkBaseArray.h" template class vtkSubArray : public vtkBaseArray { //***** c o n s t r u c t o r s / d e s t r u c t o r public: //! Constructor /*! Constructors allowing the specification of array sizes, additional memory reservation, and initialization with other arrays */ vtkSubArray() { } vtkSubArray( vtkBESSArray& a, const UINT uFirstElement, const UINT uNumberOfElements = 3 ) { Define( a,uFirstElement,uNumberOfElements ); } //! Fake copy constructor vtkSubArray( const vtkSubArray& ) { assert( false ); } //! Destructor informing the source array that the corresponding segment is not accessed any more ~vtkSubArray() { } //***** p u b l i c m e t h o d s //! Clear array, i.e. set size to zero and free all memory void Clear() { m_pData = NULL; m_uSize = 0; } //! Copy void CopyOf( vtkBaseArray& a ) { BaseCopyOf( a ); } //! Redefine the virtual array as a range of elements of another array void Define( vtkBESSArray&, const UINT uFirstElement, const UINT uNumberOfElements = 3 ); //! Assignment of other arrays void operator=( const vtkBaseArray& a ) { assert( false ); } //***** p r o t e c t e d m e t h o d s protected: //! Assure a certain array size void AssureSize( const UINT uSize ) { assert( m_uSize == uSize ); } }; // template class vtkSubArray : public vtkBaseArray //***** D e f i n e template void vtkSubArray:: Define( vtkBESSArray& c_a, const UINT c_uFirstEl, const UINT c_uNEl /* = 3 */ ) { //! Assert matrix defined assert( c_a.Defined() ); //! Assert valid range of rows and columns of the input matrix addressed assert( c_uFirstEl + c_uNEl <= c_a.Size() ); //! Clear the current subarray Clear(); //! Install new data m_pData = &(c_a.GetData())[c_uFirstEl]; m_uSize = c_uNEl; } #endif // if !defined (__SUB_ARRAY_H)