当前位置: 首页>>代码示例>>C++>>正文


C++ MyMap::getNext方法代码示例

本文整理汇总了C++中MyMap::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMap::getNext方法的具体用法?C++ MyMap::getNext怎么用?C++ MyMap::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyMap的用法示例。


在下文中一共展示了MyMap::getNext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getNextWord

bool WordBagImpl::getNextWord(string& word, int& count)
{
    string key;
    int* c = m_token->getNext(key);
    if (c == NULL)
        return false;
    else
    {
        word = key;
        count = *c;
        return true;
    }
}
开发者ID:mohkii,项目名称:MiniSearchEngine-Oogle,代码行数:13,代码来源:WordBag.cpp

示例2: getNextWord

bool WordBagImpl::getNextWord(string& word, int& count)
{
	int *getNextVal = m_map.getNext(word);

	if (getNextVal == nullptr)
		return false;

	else
	{
		count = *getNextVal;
		return true;
	}
}
开发者ID:dnieh,项目名称:Web-Crawler-and-Indexer-2013CS32Project4,代码行数:13,代码来源:WordBag.cpp

示例3: save

bool IndexerImpl::save(string filenameBase)
{
    ofstream outfile(filenameBase+".txt");
    if ( ! outfile )		 
	{
	    cerr << "Error: Cannot create data.txt!" << endl;
	    return false;
	}
    //Map to store locations to grab from array
    MyMap<int, int>* h2pull = new MyMap<int, int>;
    //Save size of urlToCount to outfile
    outfile << urlToCount->size() << endl;
    string word;
    vector<point>* value = urlToCount->getFirst(word);
    while (value!=NULL)
    {
        //save word and size of vector
        outfile << word << " " << value->size() << endl;
        vector<point>::iterator it = value->begin();
        while (it!=value->end())
        {
            int hash = it->m_hash;
            outfile << hash << " " << it->m_count << endl;
            h2pull->associate(hash%MAX_MAP_SIZE, hash%MAX_MAP_SIZE);
            it++;
        }
        value = urlToCount->getNext(word);
    }
    //Save size of h2pull (number of elements in array to visit)
    outfile << h2pull->size() << endl;
    int temp;
    int* location = h2pull->getFirst(temp);
    while (location!=NULL)
    {
        int size = idToUrl[temp]->size();
        outfile << temp << " " << size <<endl;
        int hash;
        string* url = idToUrl[temp]->getFirst(hash);
        while(url!=NULL)
        {
            outfile << hash << " "<< *url << endl;
            url = idToUrl[temp]->getNext(hash);
        }
        location = h2pull->getNext(temp);
    }
    
    delete h2pull;
    return true;
}
开发者ID:thecalvinchan,项目名称:oogle,代码行数:49,代码来源:Indexer.cpp

示例4: saveMyMap

bool saveMyMap(string filename, MyMap<KeyType, ValueType>& m)
{
    // save contents of m to a file
    ofstream stream("filename");    // Create an ofstream object to create the file
    if (! stream) return false;     // Return false if we can't create the file
    writeItem(stream, m.size());    // Save the number of associations in m to stream
    KeyType x;
    ValueType* y = m.getFirst(x);
    for (int i = 0; i < m.size(); i++) {
        writeItem(stream, x);
        writeItem(stream, *y);
        y = m.getNext(x);
    }
    return true;
}
开发者ID:jeffreytai,项目名称:Basic-Search-Engine,代码行数:15,代码来源:Indexer.cpp


注:本文中的MyMap::getNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。