ddc
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CIndexSetForLoadingStage Class Referenceabstract

CIndexSetForLoadingStage is a part of DDC which is used only on the loading stage. More...

#include <IndexSetForLoadingStage.h>

Inheritance diagram for CIndexSetForLoadingStage:
Inheritance graph
[legend]
Collaboration diagram for CIndexSetForLoadingStage:
Collaboration graph
[legend]

Public Member Functions

 CIndexSetForLoadingStage ()
 
virtual ~CIndexSetForLoadingStage ()
 
bool CreateTempFiles (string Path)
 creates temporary files for indexing More...
 
bool DeleteTempFiles ()
 deletes temporary files after indexing More...
 
size_t GetMemoryLoadIndexItemsCount () const
 gets the number of items in memory load index More...
 
bool SaveMemoryLoadIndex ()
 saves memory index More...
 
bool AddInputLoadIndexToMemoryLoadIndex ()
 add the input load index to the memory load index and clear the input load index More...
 
void SortInputAndMemoryIndices ()
 sort the input and the memory load indices More...
 
bool AddMemoryLoadIndexToMainLoadIndex ()
 add the memory load index to the main load index and clear the memory load index More...
 
void InsertToInputLoadIndex (const char *Str, size_t StrLen, const vector< CTokenNo > &occurrences)
 updates input or memory load index with one string More...
 
void RollbackLoadIndex (CTokenNo startTrimTokenNo)
 rolls back buffered index data starting at startTrimTokenNo More...
 
void PrintLoadIndexStats (FILE *f=stderr) const
 debug: print input/memory load index stats More...
 

Public Attributes

bool m_bUseItemStorage
 if true, then the program creates and uses a storage for this index More...
 
ddcVecFile< char > m_StringBuffer
 a buffer for storing index strings (compile-time) More...
 

Protected Member Functions

size_t AddItemStrToBuffer (const char *Str, size_t StrLen)
 add a string to m_StringBuffer More...
 

Protected Attributes

FILE * m_TempStorageFile
 a temporal file for index storage More...
 
string m_TempStorageFileName
 a temporary file, where the index storage is stored More...
 
string m_MainOccurTempFileName
 a temporary file, where the main index is stored More...
 

Private Member Functions

virtual string GetName () const =0
 return the name of the index (CStringIndexSet::m_Name) More...
 
bool FindIndexItemInVector (const char *Item, vector< CItemIndexForLoading >::iterator &it, vector< CItemIndexForLoading > &V)
 find a string in vector "V", returning iterator "it", using m_LoadLess1 More...
 
bool FindIndexItem (const char *Item, vector< CItemIndexForLoading >::iterator &it)
 finds an item in the swap index set, if it is not found, finds the item in the file index set More...
 
bool AddToMemoryLoadIndexAndClear (vector< CItemIndexForLoading > &Body, vector< CItemIndexForLoading > &FileIndexSet)
 
int GetHashNo (const char *Str) const
 

Private Attributes

LessIndexString2< CItemIndexForLoadingm_LoadLess2
 a less operator for two buffer pointers More...
 
LessIndexString1< CItemIndexForLoadingm_LoadLess1
 a less operator for a buffer pointer and a const char* More...
 
string m_CurrOccurTempFileName
 a temporary file, where the memory index set is stored More...
 
vector< CItemIndexForLoadingm_MemoryLoadIndexHash [256]
 memory index set (hashed by ASCII) More...
 
vector< CItemIndexForLoadingm_InputLoadIndexHash [256]
 input memory index set (hashed by ASCII) More...
 

Detailed Description

CIndexSetForLoadingStage is a part of DDC which is used only on the loading stage.

CIndexSetForLoadingStage contains temporary file names and all load indices for one index set. While indexing three indices are used:

Constructor & Destructor Documentation

◆ CIndexSetForLoadingStage()

CIndexSetForLoadingStage::CIndexSetForLoadingStage ( )

◆ ~CIndexSetForLoadingStage()

CIndexSetForLoadingStage::~CIndexSetForLoadingStage ( )
virtual

References DeleteTempFiles().

Here is the call graph for this function:

Member Function Documentation

◆ GetName()

virtual string CIndexSetForLoadingStage::GetName ( ) const
privatepure virtual

◆ FindIndexItemInVector()

bool CIndexSetForLoadingStage::FindIndexItemInVector ( const char *  Item,
vector< CItemIndexForLoading >::iterator &  it,
vector< CItemIndexForLoading > &  V 
)
private

find a string in vector "V", returning iterator "it", using m_LoadLess1

References LessIndexString1< IndexType, VectorType >::are_equal(), and m_LoadLess1.

Referenced by FindIndexItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindIndexItem()

bool CIndexSetForLoadingStage::FindIndexItem ( const char *  Item,
vector< CItemIndexForLoading >::iterator &  it 
)
private

finds an item in the swap index set, if it is not found, finds the item in the file index set

References FindIndexItemInVector(), GetHashNo(), m_InputLoadIndexHash, and m_MemoryLoadIndexHash.

Referenced by InsertToInputLoadIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddToMemoryLoadIndexAndClear()

bool CIndexSetForLoadingStage::AddToMemoryLoadIndexAndClear ( vector< CItemIndexForLoading > &  Body,
vector< CItemIndexForLoading > &  FileIndexSet 
)
private

References GetName(), and m_LoadLess2.

Referenced by AddInputLoadIndexToMemoryLoadIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHashNo()

int CIndexSetForLoadingStage::GetHashNo ( const char *  Str) const
private

Referenced by FindIndexItem(), and InsertToInputLoadIndex().

Here is the caller graph for this function:

◆ AddItemStrToBuffer()

size_t CIndexSetForLoadingStage::AddItemStrToBuffer ( const char *  Str,
size_t  StrLen 
)
protected

add a string to m_StringBuffer

References GetName(), m_StringBuffer, MAX_STRINGBUFFER_SIZE, ddcVecFile< T >::push_back(), and ddcVecFile< T >::size().

Referenced by InsertToInputLoadIndex(), and CStringIndexSet::UnionIndexSets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateTempFiles()

bool CIndexSetForLoadingStage::CreateTempFiles ( string  Path)

creates temporary files for indexing

References GetName(), m_bUseItemStorage, m_CurrOccurTempFileName, m_MainOccurTempFileName, m_TempStorageFile, m_TempStorageFileName, and MakeFName().

Referenced by CreateMorphIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeleteTempFiles()

bool CIndexSetForLoadingStage::DeleteTempFiles ( )

deletes temporary files after indexing

References m_bUseItemStorage, m_CurrOccurTempFileName, m_MainOccurTempFileName, m_MemoryLoadIndexHash, m_TempStorageFile, m_TempStorageFileName, and RemoveWithPrint().

Referenced by CStringIndexSet::WriteToFile(), and ~CIndexSetForLoadingStage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMemoryLoadIndexItemsCount()

size_t CIndexSetForLoadingStage::GetMemoryLoadIndexItemsCount ( ) const

gets the number of items in memory load index

References m_MemoryLoadIndexHash.

◆ SaveMemoryLoadIndex()

bool CIndexSetForLoadingStage::SaveMemoryLoadIndex ( )

saves memory index

References GetName(), m_CurrOccurTempFileName, m_MemoryLoadIndexHash, CExpc::m_strCause, and WriteLoadIndexToTempFileAndClear().

Referenced by CreateMorphIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddInputLoadIndexToMemoryLoadIndex()

bool CIndexSetForLoadingStage::AddInputLoadIndexToMemoryLoadIndex ( )

add the input load index to the memory load index and clear the input load index

References AddToMemoryLoadIndexAndClear(), GetName(), m_InputLoadIndexHash, and m_MemoryLoadIndexHash.

Referenced by CreateMorphIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SortInputAndMemoryIndices()

void CIndexSetForLoadingStage::SortInputAndMemoryIndices ( )

sort the input and the memory load indices

References CItemIndexForLoading::GetOccurs(), m_InputLoadIndexHash, and m_MemoryLoadIndexHash.

Referenced by CreateMorphIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddMemoryLoadIndexToMainLoadIndex()

bool CIndexSetForLoadingStage::AddMemoryLoadIndexToMainLoadIndex ( )

◆ InsertToInputLoadIndex()

void CIndexSetForLoadingStage::InsertToInputLoadIndex ( const char *  Str,
size_t  StrLen,
const vector< CTokenNo > &  occurrences 
)

◆ RollbackLoadIndex()

void CIndexSetForLoadingStage::RollbackLoadIndex ( CTokenNo  startTrimTokenNo)

rolls back buffered index data starting at startTrimTokenNo

References Format(), FSeek(), m_bUseItemStorage, m_InputLoadIndexHash, m_TempStorageFile, m_TempStorageFileName, and RollbackLoadIndexHash().

Here is the call graph for this function:

◆ PrintLoadIndexStats()

void CIndexSetForLoadingStage::PrintLoadIndexStats ( FILE *  f = stderr) const

debug: print input/memory load index stats

References m_InputLoadIndexHash, m_MemoryLoadIndexHash, and PrintLoadIndexHashStats().

Here is the call graph for this function:

Member Data Documentation

◆ m_LoadLess2

LessIndexString2<CItemIndexForLoading> CIndexSetForLoadingStage::m_LoadLess2
private

a less operator for two buffer pointers

Referenced by AddMemoryLoadIndexToMainLoadIndex(), and AddToMemoryLoadIndexAndClear().

◆ m_LoadLess1

LessIndexString1<CItemIndexForLoading> CIndexSetForLoadingStage::m_LoadLess1
private

a less operator for a buffer pointer and a const char*

Referenced by FindIndexItemInVector().

◆ m_CurrOccurTempFileName

string CIndexSetForLoadingStage::m_CurrOccurTempFileName
private

a temporary file, where the memory index set is stored

Referenced by AddMemoryLoadIndexToMainLoadIndex(), CreateTempFiles(), DeleteTempFiles(), and SaveMemoryLoadIndex().

◆ m_MemoryLoadIndexHash

vector<CItemIndexForLoading > CIndexSetForLoadingStage::m_MemoryLoadIndexHash[256]
private

◆ m_InputLoadIndexHash

vector<CItemIndexForLoading > CIndexSetForLoadingStage::m_InputLoadIndexHash[256]
private

◆ m_TempStorageFile

FILE* CIndexSetForLoadingStage::m_TempStorageFile
protected

◆ m_TempStorageFileName

string CIndexSetForLoadingStage::m_TempStorageFileName
protected

◆ m_MainOccurTempFileName

string CIndexSetForLoadingStage::m_MainOccurTempFileName
protected

◆ m_bUseItemStorage

bool CIndexSetForLoadingStage::m_bUseItemStorage

◆ m_StringBuffer

ddcVecFile<char> CIndexSetForLoadingStage::m_StringBuffer

The documentation for this class was generated from the following files: