Download Source Code

CMultiStore Class Reference

Provides index data storage. More...

#include <MultiStore.h>

Collaboration diagram for CMultiStore:

Collaboration graph
[legend]
List of all members.

Public Member Functions

LPSMultiStoreInfo GetPrevIndexPtr (DWORD dwIndex)
 Returns pointer to previous index pointer.
LPSMultiStoreInfo GetPrevIndexPtr (DWORD dwIndex, LPVOID *pvIndex, DWORD dwDepth=0)
 Returns pointer to previous index pointer.
LPSMultiStoreInfo GetNextIndexPtr (DWORD dwIndex)
 Returns pointer to next index pointer.
LPSMultiStoreInfo GetNextIndexPtr (DWORD dwIndex, LPVOID *pvIndex, DWORD dwDepth=0)
 Returns pointer to next index pointer.
LPSMultiStoreInfo GetIndexPtr (DWORD dwIndex, BOOL bCreate=TRUE)
 Gets structure at specified index.
LPSMultiStoreInfo GetIndexPtr (DWORD dwIndex, LPVOID *pvIndex, BOOL bCreate=TRUE, DWORD dwDepth=0)
 Returns the structure at the specified index.
void DestroyIndex (LPVOID *pvIndex, DWORD dwDepth=0)
 Destroys the specified index.
void Destroy ()
 Releases the index and all resources.
BOOL Open (LPCTSTR pFile, DWORD dwMaxMem, DWORD dwMaxDisk, DWORD dwBits=4)
 Initializes the index for use.
BOOL Read (DWORD dwIndex, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk)
 Reads data from the specified index.
BOOL ReadNext (DWORD dwIndex, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk)
 Reads the next record after specified index.
BOOL ReadPrev (DWORD dwIndex, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk)
 Reads the record before the specified index.
BOOL Write (DWORD dwIndex, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk, BOOL bOverwrite=TRUE)
 Writes data to the specified index.
BOOL Read (LPSMultiStoreInfo pMsi, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk)
 Reads data from the specified memory structure.
BOOL Write (LPSMultiStoreInfo pMsi, void *pMem, DWORD dwMem, void *pDisk, DWORD dwDisk, BOOL bOverwrite=TRUE)
 Writes data to the specified memory structure.
 CMultiStore ()
 Default constructor.
virtual ~CMultiStore ()
 Destructor.
LPVOID MemPtr (LPSMultiStoreInfo pMsi)
 Returns a pointer to the user memory space.

Detailed Description

Provides index data storage.

This class provides a fast way to index a large amount of data. You can specify a portion of data that is stored in memory, and another that is stored on disk. The design is so that data can be accessed quickly using a linear style key.


Member Function Documentation

void CMultiStore::DestroyIndex LPVOID *  pvIndex,
DWORD  dwDepth = 0
 

Destroys the specified index.

Parameters:
[in] pvIndex - Index pointer
[in] dwDepth - Current search depth

LPSMultiStoreInfo CMultiStore::GetIndexPtr DWORD  dwIndex,
LPVOID *  pvIndex,
BOOL  bCreate = TRUE,
DWORD  dwDepth = 0
 

Returns the structure at the specified index.

Parameters:
[in] dwIndex - Index
[in] pvIndex - Index buffer pointer
[in] bCreate - Non-zero to create if not found
[in] dwDepth - Current search depth
Returns:
Pointer to data structure or NULL if not error
See also:

LPSMultiStoreInfo CMultiStore::GetIndexPtr DWORD  dwIndex,
BOOL  bCreate = TRUE
[inline]
 

Gets structure at specified index.

Parameters:
[in] dwIndex - Index
[in] bCreate - Non-zero to create if not found.
Returns:
Pointer to data structure or NULL if not error
See also:

LPSMultiStoreInfo CMultiStore::GetNextIndexPtr DWORD  dwIndex,
LPVOID *  pvIndex,
DWORD  dwDepth = 0
 

Returns pointer to next index pointer.

Parameters:
[in] dwIndex - Index
[in] pvIndex - Root node structure
[in] dwDepth - Current search depth
Returns:
Pointer to data structure or NULL if not found
See also:

LPSMultiStoreInfo CMultiStore::GetNextIndexPtr DWORD  dwIndex  )  [inline]
 

Returns pointer to next index pointer.

Parameters:
[in] dwIndex - Index
Returns:
Pointer to data structure or NULL if not found
See also:

LPSMultiStoreInfo CMultiStore::GetPrevIndexPtr DWORD  dwIndex,
LPVOID *  pvIndex,
DWORD  dwDepth = 0
 

Returns pointer to previous index pointer.

Parameters:
[in] dwIndex - Index
[in] pvIndex - Root node structure
[in] dwDepth - Current search depth
Returns:
Pointer to data structure or NULL if not found
See also:

LPSMultiStoreInfo CMultiStore::GetPrevIndexPtr DWORD  dwIndex  )  [inline]
 

Returns pointer to previous index pointer.

Parameters:
[in] dwIndex - Index
Returns:
Pointer to data structure or NULL if not found
See also:

LPVOID CMultiStore::MemPtr LPSMultiStoreInfo  pMsi  )  [inline]
 

Returns a pointer to the user memory space.

Parameters:
[in] pMsi - Pointer to data structure
Returns:
Pointer to user memory space associated with this structure
See also:

BOOL CMultiStore::Open LPCTSTR  pFile,
DWORD  dwMaxMem,
DWORD  dwMaxDisk,
DWORD  dwBits = 4
 

Initializes the index for use.

Parameters:
[in] pFile - Disk file
[in] dwMaxMem - Memory required per item
[in] dwMaxDisk - Disk space required per item
[in] dwBits - Number of bits to unroll with the index table
Returns:
Non-zero if success
See also:

BOOL CMultiStore::Read LPSMultiStoreInfo  pMsi,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk
 

Reads data from the specified memory structure.

Parameters:
[in] pMsi - Pointer to data structure
[out] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[out] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] dwDisk - Size of the buffer in pDisk;
Returns:
Non-zero if success
See also:

BOOL CMultiStore::Read DWORD  dwIndex,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk
[inline]
 

Reads data from the specified index.

Parameters:
[in] dwIndex - Index offset
[out] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[out] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] dwDisk - Size of the buffer in pDisk;
Returns:
Non-zero if success
See also:

BOOL CMultiStore::ReadNext DWORD  dwIndex,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk
[inline]
 

Reads the next record after specified index.

Parameters:
[in] dwIndex - Index offset
[out] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[out] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] dwDisk - Size of the buffer in pDisk;
Returns:
Non-zero if success
See also:

BOOL CMultiStore::ReadPrev DWORD  dwIndex,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk
[inline]
 

Reads the record before the specified index.

Parameters:
[in] dwIndex - Index offset
[out] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[out] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] dwDisk - Size of the buffer in pDisk;
Returns:
Non-zero if success
See also:

BOOL CMultiStore::Write LPSMultiStoreInfo  pMsi,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk,
BOOL  bOverwrite = TRUE
 

Writes data to the specified memory structure.

Parameters:
[in] pMsi - Pointer to data structure
[out] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[out] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] bOverwrite - Non-zero to overwrite record.
[in] dwDisk - Size of the buffer in pDisk;
Returns:
Non-zero if success
See also:

BOOL CMultiStore::Write DWORD  dwIndex,
void *  pMem,
DWORD  dwMem,
void *  pDisk,
DWORD  dwDisk,
BOOL  bOverwrite = TRUE
[inline]
 

Writes data to the specified index.

Parameters:
[in] dwIndex - Index offset
[in] pMem - Receives memory structure. Can be NULL if not required.
[in] dwMem - Size of buffer in pMem
[in] pDisk - Receives disk structure. Can be NULL if not required. Leaving this structure NULL avoids the disk access.
[in] dwDisk - Size of the buffer in pDisk.
[in] bOverwrite - Non-zero to overwrite record.
Returns:
Non-zero if success
See also:


The documentation for this class was generated from the following files:
  • inc/MultiStore.h
  • MultiStore.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL