"L. Spiro Engine"
|
Classes | |
class | C128BitInteger |
A 128-bit integer class. More... | |
class | CLargeInteger |
A large-integer template class. More... | |
class | CStd |
Standard CRT-type functions. More... | |
class | CSearch |
Standard search-and-sort routines. More... | |
class | CExternalByteStream |
Allows treating an external array of bytes as a stream. More... | |
class | IStream |
The base interface for all streams. More... | |
class | CTime |
High-resolution time class. More... | |
Typedefs | |
typedef LSINT32 | LSBOOL |
typedef LSUINT8 | LSUTF8 |
typedef LSUINT16 | LSUTF16 |
typedef LSUINT32 | LSUTF32 |
typedef wchar_t | LSUTFX |
Enumerations | |
enum | LSSTD_LARGE_INTEGER_EXCEPTIONS { LSSTD_LIE_OVERFLOW, LSSTD_LIE_DIVISIONBYZERO, LSSTD_LIE_INVALIDCONVERSION } |
enum | LSSTD_ERRORS { LSSTD_E_SUCCESS, LSSTD_E_OUTOFMEMORY, LSSTD_E_FILENOTFOUND, LSSTD_E_INVALIDWRITEPERMISSIONS, LSSTD_E_NODISKSPACE, LSSTD_E_INVALIDFILETYPE, LSSTD_E_INVALIDCALL, LSSTD_E_INVALIDDATA, LSSTD_E_INTERNALERROR, LSSTD_E_FEATURENOTSUPPORTED } |
Functions | |
F | m_ui32TotalIndices (0UL) |
F | m_ui32AllocIndices (0UL) |
CIndexSorter< _tType > &LSE_CALL | operator= (const CIndexSorter< _tType > &_isOther) |
CIndexSorter< _tType > &LSE_CALL | Sort (const _tType *_ptData, LSUINT32 _ui32Total, LSBOOL _bCheckIfSorted=true) |
CIndexSorter< _tType > &LSE_CALL | QuickSort (const _tType *_ptData, LSUINT32 _ui32Total, LSBOOL _bCheckIfSorted=false) |
CIndexSorter< _tType > &LSE_CALL | InsertionSort (const _tType *_ptData, LSUINT32 _ui32Total) |
const LSUINT32 *LSE_CALL | GetIndices () const |
LSVOID LSE_CALL | PrepareFor (LSUINT32 _ui32Total) |
LSVOID LSE_CALL | Reset () |
LSBOOL LSE_CALL | ReadBits (LSUINT8 *_pui8Buffer, LSUINT32 _ui32BitsToRead) const |
virtual LSUINT32 LSE_CALL | ReadBytes (LSUINT8 *_pui8Buffer, LSUINT32 _ui32BytesToRead) const |
virtual LSUINT64 LSE_CALL | ReadUInt64 () const |
virtual LSUINT32 LSE_CALL | ReadUInt32 () const |
virtual LSUINT16 LSE_CALL | ReadUInt16 () const |
virtual LSUINT8 LSE_CALL | ReadUInt8 () const |
virtual LSFLOAT LSE_CALL | ReadFloat () const |
virtual LSDOUBLE LSE_CALL | ReadDouble () const |
LSBOOL LSE_CALL | WriteBits (const LSUINT8 *_pui8Buffer, LSUINT32 _ui32BitsToWrite) |
virtual LSUINT32 LSE_CALL | WriteBytes (const LSUINT8 *_pui8Buffer, LSUINT32 _ui32BytesToWrite) |
virtual LSBOOL LSE_CALL | WriteUInt64 (const LSUINT64 &_ui64Value) |
virtual LSBOOL LSE_CALL | WriteUInt32 (LSUINT32 _ui32Value) |
virtual LSBOOL LSE_CALL | WriteUInt16 (LSUINT16 _ui16Value) |
virtual LSBOOL LSE_CALL | WriteUInt8 (LSUINT8 _ui8Value) |
virtual LSBOOL LSE_CALL | WriteFloat (LSFLOAT _fValue) |
virtual LSBOOL LSE_CALL | WriteDouble (const LSDOUBLE &_dValue) |
LSUINT32 LSE_CALL | GetLengthInBytes () const |
const LSUINT8 *LSE_CALL | GetRawBytes () const |
LSUINT64 LSE_CALL | SetPos (LSUINT64 _ui64Pos) const |
LSUINT64 LSE_CALL | GetPos () const |
LSBOOL LSE_CALL | PreAlloc (LSUINT64 _ui64NewSize) |
LSVOID LSE_CALL | Borrow (const LSUINT8 *_pui8Buffer, LSUINTPTR _uiptrSize) |
LSBOOL LSE_CALL | Alloc (LSUINT32 _ui32Total) |
virtual LSVOID *LSE_CALL | ReAlloc (LSVOID *_pvOriginal, LSUINT32 _ui32Total) const |
virtual LSVOID LSE_CALL | Free (LSVOID *_pvOriginal) const |
Variables | |
F | __pad0__ |
F LSUINTPTR | _uiptrLen |
LSUINT32 * | m_pui32Indices |
LSUINT32 | m_ui32TotalIndices |
LSUINT32 | m_ui32AllocIndices |
LSUINT64 | m_ui64TotalBits |
LSUINT32 * | m_pui32Buffer |
LSUINT32 | m_ui32Total |
LSUINT32 | m_ui32Alloc |
LSBOOL | m_bBorrowed |
LSUINT64 | m_ui64Pos |
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: A standard 32-bit cyclic redundancy check calculator.
Copyright L. Spiro 2012 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: A 128-bit integer class. This is a high-performance 128-bit signed integer class. Use this when you do not need larger values than 128 bits can hold and require performance.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: A large-integer template class. Represents a number containing at most _uMaxDigits digits in radix 10. Provides standard operators synthesized in software mode. This class is not intended for use in any high-performance situation. Use this class when precision is more important than speed.
Multiple instances of this class can cause a heavy hit to the stack unless allocated to the heap.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: Sorts data by index references. Instead of moving the actual data around, it creates an index table for that data and sorts the indices. This is often faster than trying to sort data composed of many-byte elements. Uses a quick sort. The data being sorted must provide < and == operators.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: Standard search-and-sort routines.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: Provides a generic bit stream.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: Allows treating an external array of bytes as a stream. Allows modifying the array but not beyond the actual length of the array. This is useful for situations when you have a file image loaded to memory and you wish to read from it in the fashion of a byte stream.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: This interface serves as the base class for all streams. File streams, bit streams, network streams, etc., are built on top of this.
Copyright L. Spiro 2011 All rights reserved.
Written by: Shawn (L. Spiro) Wilcoxen
This code may not be sold or traded for any personal gain without express written consent. You may use this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact. You may not take credit for having written this code.
Description: Cross-platform time-management. Tracks time in microseconds (1,000,000 per second). Also provides frame count and virtual time/frame values for pausing. When paused, virtual values re not updated, causing any objects/systems using the virtual time values to stop (effectively pausing them). Use the regular time values for systems that cannot be paused, such as the menus, which should flash and animate regardless of the pause status.
typedef LSINT32 lsstd::LSBOOL |
Boolean type.
typedef LSUINT8 lsstd::LSUTF8 |
UTF types.
typedef wchar_t lsstd::LSUTFX |
wchar_t is 16 bits on Windows and 32 bits on everything else. This means L"" string literals are of variable size. The X here indicates the variable number of bits, and should remind you not to send data of this format to files or over networks.
enum lsstd::LSSTD_ERRORS |
Error codes.
Exceptions that can be thrown by this class.
LSBOOL LSE_CALL lsstd::Alloc | ( | LSUINT32 | _ui32Total | ) | [protected] |
Allocate the given number of LSUINT32's and store the result in m_pui32Buffer. Note that this function should not be overloaded when adding memory-manager functionality to this class.
_ui32Total | Total number of LSUINT32's to allocate. |
LSVOID LSE_CALL lsstd::Borrow | ( | const LSUINT8 * | _pui8Buffer, |
LSUINTPTR | _uiptrSize | ||
) |
Point the stream to an existing buffer. The buffer cannot be resized from within this instance. This can be a very dangerous function and must be used with caution. This causes its existing buffer to be freed.
_pui8Buffer | The buffer to be used by this stream directly. |
_uiptrSize | The size of the buffer to which _pui8Buffer points. |
virtual LSVOID LSE_CALL lsstd::Free | ( | LSVOID * | _pvOriginal | ) | const [protected, virtual] |
Free bytes. Override this to add functionality such as use of memory managers etc.
_pvOriginal | Pointer to the data, allocated with ReAlloc() to free. |
const LSUINT32* LSE_CALL lsstd::GetIndices | ( | ) | const |
Get a pointer to the (sorted) index data.
LSUINT32 LSE_CALL lsstd::GetLengthInBytes | ( | ) | const |
Get the length of the stream in bytes.
LSUINT64 LSE_CALL lsstd::GetPos | ( | ) | const |
Get the stream position in bits.
const LSUINT8* LSE_CALL lsstd::GetRawBytes | ( | ) | const |
Get a pointer to the beginning of the actual bytes in the stream.
CIndexSorter<_tType>& LSE_CALL lsstd::InsertionSort | ( | const _tType * | _ptData, |
LSUINT32 | _ui32Total | ||
) |
Sort the given data using an insertion sort.
_ptData | The data to sort. |
_ui32Total | Total objects to sort. |
CIndexSorter<_tType>& LSE_CALL lsstd::operator= | ( | const CIndexSorter< _tType > & | _isOther | ) |
Assignment operator.
_isOther | The object to copy. |
LSBOOL LSE_CALL lsstd::PreAlloc | ( | LSUINT64 | _ui64NewSize | ) |
Pre-allocate a given amount in bits. If the amount is less than or equal to the currently allocated amount, true is returned with no action taking place.
_ui64NewSize | The new size to allocate. |
LSVOID LSE_CALL lsstd::PrepareFor | ( | LSUINT32 | _ui32Total | ) |
Prepares to sort the given number of elements, but does not sort them.
PARM | The number of elements to prepare to sort. |
CIndexSorter<_tType>& LSE_CALL lsstd::QuickSort | ( | const _tType * | _ptData, |
LSUINT32 | _ui32Total, | ||
LSBOOL | _bCheckIfSorted = false |
||
) |
Sort the given data using a quick sort.
_ptData | The data to sort. |
_ui32Total | Total objects to sort. |
_bCheckIfSorted | If true, the sort first checks to see if items need sorting. |
LSBOOL LSE_CALL lsstd::ReadBits | ( | LSUINT8 * | _pui8Buffer, |
LSUINT32 | _ui32BitsToRead | ||
) | const |
Read bits from the stream. Stream position is advanced by the amount read.
_pui8Buffer | Buffer to be filled with the bits read from the stream. |
_ui32BitsToRead | Number of bits to read. |
virtual LSUINT32 LSE_CALL lsstd::ReadBytes | ( | LSUINT8 * | _pui8Buffer, |
LSUINT32 | _ui32BytesToRead | ||
) | const [virtual] |
Read bytes from the stream. Stream position is advanced by the amount read.
_pui8Buffer | Buffer to hold the bytes read from the stream. |
_ui32BytesToRead | Number of bytes to read. |
virtual LSDOUBLE LSE_CALL lsstd::ReadDouble | ( | ) | const [virtual] |
Reads a 64-bit double from the stream and advances the stream position.
virtual LSFLOAT LSE_CALL lsstd::ReadFloat | ( | ) | const [virtual] |
Reads a 32-bit float from the stream and advances the stream position.
virtual LSUINT16 LSE_CALL lsstd::ReadUInt16 | ( | ) | const [virtual] |
Reads a 16-bit unsigned integer from the stream and advances the stream position.
virtual LSUINT32 LSE_CALL lsstd::ReadUInt32 | ( | ) | const [virtual] |
Reads a 32-bit unsigned integer from the stream and advances the stream position.
virtual LSUINT64 LSE_CALL lsstd::ReadUInt64 | ( | ) | const [virtual] |
Reads a 64-bit unsigned integer from the stream and advances the stream position.
virtual LSUINT8 LSE_CALL lsstd::ReadUInt8 | ( | ) | const [virtual] |
Reads an 8-bit unsigned integer from the stream and advances the stream position.
virtual LSVOID* LSE_CALL lsstd::ReAlloc | ( | LSVOID * | _pvOriginal, |
LSUINT32 | _ui32Total | ||
) | const [protected, virtual] |
Re-allocate bytes. Override this to add functionality such as use of memory managers etc.
_pvOriginal | Address to re-alloate. Pass NULL to allocate new data. |
_ui32Total | Total number of bytes to allocate. |
LSVOID LSE_CALL lsstd::Reset | ( | ) |
Reset the stream completely. Frees all resources it was using.
Reset everything. Clears all resources created by this instance.
Reset all contents.
LSUINT64 LSE_CALL lsstd::SetPos | ( | LSUINT64 | _ui64Pos | ) | const |
Set the stream position in bits. If the position is set past the end of the stream length, it is clamped to the end of the string.
_ui64Pos | The new position of the stream in bits. |
CIndexSorter<_tType>& LSE_CALL lsstd::Sort | ( | const _tType * | _ptData, |
LSUINT32 | _ui32Total, | ||
LSBOOL | _bCheckIfSorted = true |
||
) |
Sort the given data.
_ptData | The data to sort. |
_ui32Total | Total objects to sort. |
_bCheckIfSorted | If true, the sort first checks to see if items need sorting. |
LSBOOL LSE_CALL lsstd::WriteBits | ( | const LSUINT8 * | _pui8Buffer, |
LSUINT32 | _ui32BitsToWrite | ||
) |
Write bits to the current position in the stream. Stream position is advanced by the amount written.
_pui8Buffer | Buffer containing the bits to write to the stream. |
_ui32BitsToWrite | Number of bits to write from _pui8Buffer. |
virtual LSUINT32 LSE_CALL lsstd::WriteBytes | ( | const LSUINT8 * | _pui8Buffer, |
LSUINT32 | _ui32BytesToWrite | ||
) | [virtual] |
Write bytes to the stream. Stream position is advanced by the amount written.
_pui8Buffer | Buffer containing the bytes to write to the stream. |
_ui32BytesToWrite | Number of bytes to write. |
virtual LSBOOL LSE_CALL lsstd::WriteDouble | ( | const LSDOUBLE & | _dValue | ) | [virtual] |
Writes a 64-bit double from the stream and advances the stream position.
virtual LSBOOL LSE_CALL lsstd::WriteFloat | ( | LSFLOAT | _fValue | ) | [virtual] |
Writes a 32-bit float from the stream and advances the stream position.
virtual LSBOOL LSE_CALL lsstd::WriteUInt16 | ( | LSUINT16 | _ui16Value | ) | [virtual] |
Writes a 16-bit unsigned integer to the stream and advances the stream position.
virtual LSBOOL LSE_CALL lsstd::WriteUInt32 | ( | LSUINT32 | _ui32Value | ) | [virtual] |
Writes a 32-bit unsigned integer to the stream and advances the stream position.
virtual LSBOOL LSE_CALL lsstd::WriteUInt64 | ( | const LSUINT64 & | _ui64Value | ) | [virtual] |
Writes a 64-bit unsigned integer to the stream and advances the stream position.
virtual LSBOOL LSE_CALL lsstd::WriteUInt8 | ( | LSUINT8 | _ui8Value | ) | [virtual] |
Writes an 8-bit unsigned integer from the stream and advances the stream position.
Is the buffer borrowed?
LSUINT32* lsstd::m_pui32Buffer |
We buffer 32 bits worth at a time.
LSUINT32* lsstd::m_pui32Indices |
Sorted indices.
LSUINT32 lsstd::m_ui32Alloc |
Allocated length of the list in bytes.
LSUINT32 lsstd::m_ui32AllocIndices |
Total indices allocated.
LSUINT32 lsstd::m_ui32Total |
Total length of the allocated list in bytes.
LSUINT32 lsstd::m_ui32TotalIndices |
Total indices.
LSUINT64 lsstd::m_ui64Pos |
Stream position in bits. Why mutable? Because reading from a stream requires const functions! This makes sense in terms of logical const-correctness. If this stream were to be compared against another stream, m_ui64Pos would not be a factor in determining if they were equal, thus modifying m_ui64Pos has no influence on the logical const-ness of this object. Mutable it is.
LSUINT64 lsstd::m_ui64TotalBits |
Length of the stream in bits.