"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSTL/Src/ResourceMan/LSTLResourceManCrtp.h

00001 
00018 #ifndef __LSTL_RESOURCEMANCRTP_H__
00019 #define __LSTL_RESOURCEMANCRTP_H__
00020 
00021 #include "../LSTLib.h"
00022 #include "../Map/LSTLMap.h"
00023 #include "../SharedPtr/LSTLSharedPtr.h"
00024 
00025 namespace lstl {
00026 
00035         template <typename _tDerivedType,
00036                 typename _tKeyType, typename _tMappedType>
00037         class CResourceManCrtp {
00038         public :
00039                 // == Various constructors.
00040                 LSE_CALLCTOR                                                    CResourceManCrtp() {
00041                 }
00042                 virtual LSE_CALLCTOR                                    ~CResourceManCrtp() {
00043                 }
00044 
00045 
00046                 // == Functions.
00055                 _tMappedType LSE_CALL                                   GetRes( const _tKeyType &_tKey ) {
00056                         LSUINT32 ui32Index;
00057                         if ( m_mList.ItemExists( _tKey, ui32Index ) ) {
00058                                 return m_mList.GetByIndex( ui32Index );
00059                         }
00060                         return static_cast<_tDerivedType *>(this)->AddRes( _tKey );
00061                 }
00065                 LSVOID LSE_CALL                                                 Release() {
00066                         m_mList.Reset();
00067                 }
00068 
00069 
00070         protected :
00071                 // == Members.
00075                 CMap<_tKeyType, _tMappedType>                   m_mList;
00076 
00077 
00078                 // == Functions.
00086                 _tMappedType LSE_CALL                                   AddRes( const _tKeyType &/*_tKey*/ ) {
00087                         _tMappedType tRet;
00088                         return tRet;
00089                 }
00090         };
00091 
00092 }       // namespace lstl
00093 
00094 #endif  // __LSTL_RESOURCEMANCRTP_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator