mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier1: temporarily comment
Unused and causes errors due to unimplemented mutex class (needs to be reversed still).
This commit is contained in:
parent
d42ca04e8c
commit
76b927e3b0
@ -96,7 +96,7 @@ public:
|
|||||||
else // ( m_Vector.Count() < index )
|
else // ( m_Vector.Count() < index )
|
||||||
{
|
{
|
||||||
// this is a strange shouldn't-happen case.
|
// this is a strange shouldn't-happen case.
|
||||||
AssertMsg( false, "CUtlStringMap insert unexpected entries." );
|
//AssertMsg( false, "CUtlStringMap insert unexpected entries." );
|
||||||
m_Vector.EnsureCount( index + 1 );
|
m_Vector.EnsureCount( index + 1 );
|
||||||
m_Vector[index] = item;
|
m_Vector[index] = item;
|
||||||
}
|
}
|
||||||
|
@ -196,60 +196,62 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CUtlSymbolTableMT : public CUtlSymbolTable
|
// TODO[ AMOS ]: implement CThreadSpinRWLock
|
||||||
{
|
|
||||||
public:
|
|
||||||
CUtlSymbolTableMT( int growSize = 0, int initSize = 32, bool caseInsensitive = false )
|
|
||||||
: CUtlSymbolTable( growSize, initSize, caseInsensitive )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CUtlSymbol AddString( const char* pString )
|
//class CUtlSymbolTableMT : public CUtlSymbolTable
|
||||||
{
|
//{
|
||||||
m_lock.LockForWrite();
|
//public:
|
||||||
CUtlSymbol result = CUtlSymbolTable::AddString( pString );
|
// CUtlSymbolTableMT( int growSize = 0, int initSize = 32, bool caseInsensitive = false )
|
||||||
m_lock.UnlockWrite();
|
// : CUtlSymbolTable( growSize, initSize, caseInsensitive )
|
||||||
return result;
|
// {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
CUtlSymbol Find( const char* pString ) const
|
// CUtlSymbol AddString( const char* pString )
|
||||||
{
|
// {
|
||||||
m_lock.LockForWrite();
|
// m_lock.LockForWrite();
|
||||||
CUtlSymbol result = CUtlSymbolTable::Find( pString );
|
// CUtlSymbol result = CUtlSymbolTable::AddString( pString );
|
||||||
m_lock.UnlockWrite();
|
// m_lock.UnlockWrite();
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
const char* String( CUtlSymbol id ) const
|
// CUtlSymbol Find( const char* pString ) const
|
||||||
{
|
// {
|
||||||
m_lock.LockForRead();
|
// m_lock.LockForWrite();
|
||||||
const char *pszResult = CUtlSymbolTable::String( id );
|
// CUtlSymbol result = CUtlSymbolTable::Find( pString );
|
||||||
m_lock.UnlockRead();
|
// m_lock.UnlockWrite();
|
||||||
return pszResult;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
const char * StringNoLock( CUtlSymbol id ) const
|
// const char* String( CUtlSymbol id ) const
|
||||||
{
|
// {
|
||||||
return CUtlSymbolTable::String( id );
|
// m_lock.LockForRead();
|
||||||
}
|
// const char *pszResult = CUtlSymbolTable::String( id );
|
||||||
|
// m_lock.UnlockRead();
|
||||||
void LockForRead()
|
// return pszResult;
|
||||||
{
|
// }
|
||||||
m_lock.LockForRead();
|
//
|
||||||
}
|
// const char * StringNoLock( CUtlSymbol id ) const
|
||||||
|
// {
|
||||||
void UnlockForRead()
|
// return CUtlSymbolTable::String( id );
|
||||||
{
|
// }
|
||||||
m_lock.UnlockRead();
|
//
|
||||||
}
|
// void LockForRead()
|
||||||
|
// {
|
||||||
private:
|
// m_lock.LockForRead();
|
||||||
#ifdef WIN32
|
// }
|
||||||
mutable CThreadSpinRWLock m_lock;
|
//
|
||||||
#else
|
// void UnlockForRead()
|
||||||
mutable CThreadRWLock m_lock;
|
// {
|
||||||
#endif
|
// m_lock.UnlockRead();
|
||||||
};
|
// }
|
||||||
|
//
|
||||||
|
//private:
|
||||||
|
//#ifdef WIN32
|
||||||
|
// mutable CThreadSpinRWLock m_lock;
|
||||||
|
//#else
|
||||||
|
// mutable CThreadRWLock m_lock;
|
||||||
|
//#endif
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -268,68 +270,71 @@ typedef void* FileNameHandle_t;
|
|||||||
|
|
||||||
// Symbol table for more efficiently storing filenames by breaking paths and filenames apart.
|
// Symbol table for more efficiently storing filenames by breaking paths and filenames apart.
|
||||||
// Refactored from BaseFileSystem.h
|
// Refactored from BaseFileSystem.h
|
||||||
class CUtlFilenameSymbolTable
|
|
||||||
{
|
|
||||||
// Internal representation of a FileHandle_t
|
|
||||||
// If we get more than 64K filenames, we'll have to revisit...
|
|
||||||
// Right now CUtlSymbol is a short, so this packs into an int/void * pointer size...
|
|
||||||
struct FileNameHandleInternal_t
|
|
||||||
{
|
|
||||||
FileNameHandleInternal_t()
|
|
||||||
{
|
|
||||||
COMPILE_TIME_ASSERT( sizeof( *this ) == sizeof( FileNameHandle_t ) );
|
|
||||||
COMPILE_TIME_ASSERT( sizeof( value ) == 4 );
|
|
||||||
value = 0;
|
|
||||||
|
|
||||||
#ifdef PLATFORM_64BITS
|
// TODO[ AMOS ]: implement CThreadSpinRWLock
|
||||||
pad = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// We pack the path and file values into a single 32 bit value. We were running
|
//class CUtlFilenameSymbolTable
|
||||||
// out of space with the two 16 bit values (more than 64k files) so instead of increasing
|
//{
|
||||||
// the total size we split the underlying pool into two (paths and files) and
|
// // Internal representation of a FileHandle_t
|
||||||
// use a smaller path string pool and a larger file string pool.
|
// // If we get more than 64K filenames, we'll have to revisit...
|
||||||
unsigned int value;
|
// // Right now CUtlSymbol is a short, so this packs into an int/void * pointer size...
|
||||||
|
// struct FileNameHandleInternal_t
|
||||||
#ifdef PLATFORM_64BITS
|
// {
|
||||||
// some padding to make sure we are the same size as FileNameHandle_t on 64 bit.
|
// FileNameHandleInternal_t()
|
||||||
unsigned int pad;
|
// {
|
||||||
#endif
|
// COMPILE_TIME_ASSERT( sizeof( *this ) == sizeof( FileNameHandle_t ) );
|
||||||
|
// COMPILE_TIME_ASSERT( sizeof( value ) == 4 );
|
||||||
static const unsigned int cNumBitsInPath = 12;
|
// value = 0;
|
||||||
static const unsigned int cNumBitsInFile = 32 - cNumBitsInPath;
|
//
|
||||||
|
//#ifdef PLATFORM_64BITS
|
||||||
static const unsigned int cMaxPathValue = 1 << cNumBitsInPath;
|
// pad = 0;
|
||||||
static const unsigned int cMaxFileValue = 1 << cNumBitsInFile;
|
//#endif
|
||||||
|
// }
|
||||||
static const unsigned int cPathBitMask = cMaxPathValue - 1;
|
//
|
||||||
static const unsigned int cFileBitMask = cMaxFileValue - 1;
|
// // We pack the path and file values into a single 32 bit value. We were running
|
||||||
|
// // out of space with the two 16 bit values (more than 64k files) so instead of increasing
|
||||||
// Part before the final '/' character
|
// // the total size we split the underlying pool into two (paths and files) and
|
||||||
unsigned int GetPath() const { return ((value >> cNumBitsInFile) & cPathBitMask); }
|
// // use a smaller path string pool and a larger file string pool.
|
||||||
void SetPath( unsigned int path ) { Assert( path < cMaxPathValue ); value = ((value & cFileBitMask) | ((path & cPathBitMask) << cNumBitsInFile)); }
|
// unsigned int value;
|
||||||
|
//
|
||||||
// Part after the final '/', including extension
|
//#ifdef PLATFORM_64BITS
|
||||||
unsigned int GetFile() const { return (value & cFileBitMask); }
|
// // some padding to make sure we are the same size as FileNameHandle_t on 64 bit.
|
||||||
void SetFile( unsigned int file ) { Assert( file < cMaxFileValue ); value = ((value & (cPathBitMask << cNumBitsInFile)) | (file & cFileBitMask)); }
|
// unsigned int pad;
|
||||||
};
|
//#endif
|
||||||
|
//
|
||||||
public:
|
// static const unsigned int cNumBitsInPath = 12;
|
||||||
FileNameHandle_t FindOrAddFileName( const char *pFileName );
|
// static const unsigned int cNumBitsInFile = 32 - cNumBitsInPath;
|
||||||
FileNameHandle_t FindFileName( const char *pFileName );
|
//
|
||||||
int PathIndex( const FileNameHandle_t &handle ) { return (( const FileNameHandleInternal_t * )&handle)->GetPath(); }
|
// static const unsigned int cMaxPathValue = 1 << cNumBitsInPath;
|
||||||
bool String( const FileNameHandle_t& handle, char *buf, int buflen );
|
// static const unsigned int cMaxFileValue = 1 << cNumBitsInFile;
|
||||||
void RemoveAll();
|
//
|
||||||
void SpewStrings();
|
// static const unsigned int cPathBitMask = cMaxPathValue - 1;
|
||||||
bool SaveToBuffer( CUtlBuffer &buffer );
|
// static const unsigned int cFileBitMask = cMaxFileValue - 1;
|
||||||
bool RestoreFromBuffer( CUtlBuffer &buffer );
|
//
|
||||||
|
// // Part before the final '/' character
|
||||||
private:
|
// unsigned int GetPath() const { return ((value >> cNumBitsInFile) & cPathBitMask); }
|
||||||
CCountedStringPoolBase<unsigned short> m_PathStringPool;
|
// void SetPath( unsigned int path ) { Assert( path < cMaxPathValue ); value = ((value & cFileBitMask) | ((path & cPathBitMask) << cNumBitsInFile)); }
|
||||||
CCountedStringPoolBase<unsigned int> m_FileStringPool;
|
//
|
||||||
mutable CThreadSpinRWLock m_lock;
|
// // Part after the final '/', including extension
|
||||||
};
|
// unsigned int GetFile() const { return (value & cFileBitMask); }
|
||||||
|
// void SetFile( unsigned int file ) { Assert( file < cMaxFileValue ); value = ((value & (cPathBitMask << cNumBitsInFile)) | (file & cFileBitMask)); }
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
//public:
|
||||||
|
// FileNameHandle_t FindOrAddFileName( const char *pFileName );
|
||||||
|
// FileNameHandle_t FindFileName( const char *pFileName );
|
||||||
|
// int PathIndex( const FileNameHandle_t &handle ) { return (( const FileNameHandleInternal_t * )&handle)->GetPath(); }
|
||||||
|
// bool String( const FileNameHandle_t& handle, char *buf, int buflen );
|
||||||
|
// void RemoveAll();
|
||||||
|
// void SpewStrings();
|
||||||
|
// bool SaveToBuffer( CUtlBuffer &buffer );
|
||||||
|
// bool RestoreFromBuffer( CUtlBuffer &buffer );
|
||||||
|
//
|
||||||
|
//private:
|
||||||
|
// CCountedStringPoolBase<unsigned short> m_PathStringPool;
|
||||||
|
// CCountedStringPoolBase<unsigned int> m_FileStringPool;
|
||||||
|
// mutable CThreadSpinRWLock m_lock;
|
||||||
|
//};
|
||||||
|
|
||||||
// This creates a simple class that includes the underlying CUtlSymbol
|
// This creates a simple class that includes the underlying CUtlSymbol
|
||||||
// as a private member and then instances a private symbol table to
|
// as a private member and then instances a private symbol table to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user