00001
00002
00004
00005 #if !defined(AFX_TMATRIX_H__D0F25BB1_AE4C_42ED_BFD4_89FECA42E86A__INCLUDED_)
00006 #define AFX_TMATRIX_H__D0F25BB1_AE4C_42ED_BFD4_89FECA42E86A__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012 #include "TArray.h"
00013
00014
00015 template <class TYPE> class CTMatrix
00016 {
00017 private:
00018 TYPE* m_memory;
00019 long m_rows;
00020 long m_columns;
00021
00022
00023 public:
00024 CTMatrix();
00025 CTMatrix( long rows, long columns );
00026 CTMatrix( const CTMatrix< TYPE >& matrix );
00027 ~CTMatrix();
00028
00029 public:
00030 void Construction( long rows, long columns );
00031 void Construction( const CTMatrix< TYPE >& matrix );
00032 void Destruction();
00033
00034 void ImportFrom( const void* source );
00035 void ExportTo( void* destination ) const;
00036
00037 CTMatrix< TYPE >& operator=( const CTMatrix< TYPE >& matrix ) ;
00038
00039 #ifdef _DEBUG
00040 CTArray< TYPE >& operator[]( long index ) const;
00041 #else // _DEBUG
00042 TYPE* operator[]( long index ) const;
00043 #endif // _DEBUG
00044
00045
00046
00047
00048 bool Is_row_valid( long row ) const;
00049 bool Is_column_valid( long column ) const;
00050
00051 public:
00052 bool IsNull() const;
00053 bool IsNotNull() const;
00054
00055 long GetRows() const;
00056 long GetColumns() const;
00057
00058 long Get_height() const;
00059 long Get_width() const;
00060
00061
00062
00063
00064 long GetElements() const;
00065 long GetSizeInBytes() const;
00066
00067 TYPE * GetMemoryPointer() const;
00068
00069
00070
00071
00072 private:
00073 void Initialization();
00074
00075 void Verification( char* message ) const;
00076
00077 };
00078
00079
00080 #ifndef WIN32
00081 #include "TMatrix.cpp"
00082 #endif
00083
00084 #endif // !defined(AFX_TMATRIX_H__D0F25BB1_AE4C_42ED_BFD4_89FECA42E86A__INCLUDED_)