"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSTL/Src/Vector/LSTLSVectorPoD.h

00001 
00034 #ifndef __LSTL_SVECTORPOD_H__
00035 #define __LSTL_SVECTORPOD_H__
00036 
00037 #include "../LSTLib.h"
00038 #include "LSTLSVectorCrtp.h"
00039 #include <cassert>
00040 #include <new>
00041 
00042 
00043 namespace lstl {
00044 
00050         template <typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
00051         class CSVectorPoD : public CSVectorCrtp<CSVectorPoD<_tType, _tDataType, _uAllocSize>, _tType, _tDataType, _uAllocSize> {
00052         public :
00053                 // == Various constructors.
00054                 LSE_CALL                                        CSVectorPoD() {
00055                 }
00056                 explicit LSE_CALL                       CSVectorPoD( LSUINT32 _ui32Total ) :
00057                         Parent() {
00058                         Parent::Allocate( _ui32Total );
00059                 }
00060                 LSE_CALL                                        ~CSVectorPoD() {
00061                         Parent::Reset();
00062                 }
00063 
00064 
00065         protected :
00066                 // == Members.
00067                 
00068         private :
00069                 typedef CSVectorCrtp<CSVectorPoD<_tType, _tDataType, _uAllocSize>, _tType, _tDataType, _uAllocSize>
00070                                                                         Parent;
00071         };
00072 
00073 
00074         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00075         // VARIATIONS
00076         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00077         // 1-byte storage = max of 255 elements.
00078         template <typename _tType, unsigned _uAllocSize = 32>
00079         class CSVector8 : public CSVectorPoD<_tType, LSUINT8, _uAllocSize> {
00080         public :
00081                 LSE_CALL CSVector8() {}
00082                 explicit LSE_CALL CSVector8( LSUINT8 _tTotal ) :
00083                         CSVectorPoD<_tType, LSUINT8, _uAllocSize>( _tTotal ) {}
00084         };
00085 
00086         // 2-byte storage = max of 65,535 elements.
00087         template <typename _tType, unsigned _uAllocSize = 32>
00088         class CSVector16 : public CSVectorPoD<_tType, LSUINT16, _uAllocSize> {
00089         public :
00090                 LSE_CALL CSVector16() {}
00091                 explicit LSE_CALL CSVector16( LSUINT16 _tTotal ) :
00092                         CSVectorPoD<_tType, LSUINT16, _uAllocSize>( _tTotal ) {}
00093         };
00094 
00095         // 4-byte storage = max of 4,294,967,295 elements.
00096         template <typename _tType, unsigned _uAllocSize = 32>
00097         class CSVector32 : public CSVectorPoD<_tType, LSUINT32, _uAllocSize> {
00098         public :
00099                 LSE_CALL CSVector32() {}
00100                 explicit LSE_CALL CSVector32( LSUINT32 _tTotal ) :
00101                         CSVectorPoD<_tType, LSUINT32, _uAllocSize>( _tTotal ) {}
00102         };
00103 
00104 }       // namespace lstl
00105 
00106 #endif  // __LSTL_SVECTORPOD_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator