00001
00002
00004
00005 #if !defined(AFX_TARRAY_H__5C18C5F4_170D_4D56_BFDA_B5173B41596D__INCLUDED_)
00006 #define AFX_TARRAY_H__5C18C5F4_170D_4D56_BFDA_B5173B41596D__INCLUDED_
00007
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011
00012
00013
00014 template <class TYPE> class CTArray
00015 {
00016
00017 private:
00018 TYPE* m_memory;
00019 bool m_isAllocated;
00020 long m_dimension;
00021 long m_activeIndex;
00022
00023 public:
00024 CTArray();
00025 CTArray( long dimension );
00026 CTArray( TYPE* memory, long dimension, long activeIndex = 0 );
00027 CTArray( const CTArray< TYPE >& array );
00028 ~CTArray();
00029
00030 public:
00031 void Construction( long dimension );
00032 void Construction( TYPE* memory, long dimension, long activeIndex = 0 );
00033 void Construction( const CTArray< TYPE >& array );
00034 void Destruction();
00035
00036 void ImportFrom( const void* source );
00037 void ExportTo( void* destination ) const;
00038
00039 TYPE& operator[]( long index ) const;
00040 TYPE& operator*() const;
00041
00042 CTArray< TYPE >& operator= ( const CTArray< TYPE >& array );
00043 CTArray< TYPE >& operator&=( const CTArray< TYPE> & array );
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 bool Is_index_valid( long index ) const;
00067
00068
00069 public:
00070 bool IsNull() const;
00071 bool IsNotNull() const;
00072 long GetDimension() const;
00073 long GetSizeInBytes() const;
00074
00075 long GetLowerBound() const;
00076 long GetUpperBound() const;
00077
00078 TYPE * GetMemoryPointer() const;
00079
00080 private:
00081 void Verification( char* message ) const;
00082
00083 };
00084
00085 #ifndef _TARRAY_CPP_BY_MAY_HUANG_28_SEPT_2005_
00086 #define _TARRAY_CPP_BY_MAY_HUANG_28_SEPT_2005_
00087 #include "TArray.cpp"
00088 #endif
00089
00090 #endif // !defined(AFX_TARRAY_H__5C18C5F4_170D_4D56_BFDA_B5173B41596D__INCLUDED_)