void CSuffixTrie::CloneTrie(CSuffixTrie& rTarget)const
{
    //First delete the other trie
    rTarget.Clear();

    //Do a clone
    Node* pClone;
    pClone=CloneNode(&m_aRoot);

    //Save it
    rTarget.m_aRoot=*pClone;

    //Renormalize it
    rTarget.BuildTreeIndex();

    //And delete that node
    delete pClone;
}
Exemple #2
0
int main(int argc, char* argv[])
{
	CSuffixTrie aTree;
	aTree.AddString(L"barak");
	aTree.AddString(L"arakoo");
	aTree.AddString(L"barakoo");
	aTree.AddString(L"barako565");
	
	aTree.BuildTreeIndex();
	CSuffixTrie::_DataFound aData;
	CSuffixTrie::DataFoundVector aDataFound;
	aDataFound=aTree.SearchAhoCorasikMultiple(L"1236h6h6barakoo6arakoo123");

	for (int iCount=0;
		 iCount<aDataFound.size();
		 ++iCount)
		printf("%S %i\n",aDataFound[iCount].sDataFound.c_str(),aDataFound[iCount].iFoundPosition);

	return 0;
}
CSuffixTrie::CSuffixTrie(const CSuffixTrie& rTrie)
{
    //Clone to here
    rTrie.CloneTrie(*this);
}