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


C++ Indexer类代码示例

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


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

示例1: main

int main(int argc, char **argv)
{
    cout << "Test begins." << endl;
    cout << "-------------------------------------------------------" << endl;

    string index_dir = getenv("index_dir");
    string init_data_file = index_dir + "/init_data";
    string update_data_file = index_dir + "/update_data";

    cout << "Read init data from " << init_data_file << endl;
    cout << "Save index to " << index_dir << endl;
    cout << "Read update data from " << update_data_file << endl;

    buildIndex(init_data_file, index_dir);

    IndexMetaData *indexMetaData = new IndexMetaData( new CacheManager(),
    		mergeEveryNSeconds, mergeEveryMWrites,
    		updateHistogramEveryPMerges, updateHistogramEveryQWrites,
    		index_dir);
    Indexer *index = Indexer::load(indexMetaData);
    index->createAndStartMergeThreadLoop();
    cout << "Index loaded." << endl;

    updateIndexAndLookupRecord(update_data_file, index);
    
    delete index;
    delete indexMetaData;

    return 0;
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:30,代码来源:Lookup_Test.cpp

示例2: addMobilePhaseTimeDerivativeToJacobianParticleBlock

/**
 * @brief Adds Jacobian @f$ \frac{\partial F}{\partial \dot{y}} @f$ to bead mobile phase rows of system Jacobian
 * @details Actually adds @f$ \alpha \frac{\partial F}{\partial \dot{y}} @f$, which is useful
 *          for constructing the linear system in BDF time discretization.
 * @param [in,out] jac On entry, RowIterator of the particle block pointing to the beginning of a bead shell;
 *                     on exit, the iterator points to the end of the mobile phase
 * @param [in] idxr Indexer
 * @param [in] alpha Value of \f$ \alpha \f$ (arises from BDF time discretization)
 * @param [in] timeFactor Factor which is premultiplied to the time derivatives originating from time transformation
 */
void GeneralRateModel::addMobilePhaseTimeDerivativeToJacobianParticleBlock(linalg::FactorizableBandMatrix::RowIterator& jac, const Indexer& idxr, double alpha, double timeFactor)
{
	// Compute total factor
	alpha *= timeFactor;

	// Mobile phase
	for (int comp = 0; comp < static_cast<int>(_disc.nComp); ++comp, ++jac)
	{
		// Add derivative with respect to dc_p / dt to Jacobian
		jac[0] += alpha;

		const double invBetaP = (1.0 - static_cast<double>(_parPorosity)) / (static_cast<double>(_poreAccessFactor[comp]) * static_cast<double>(_parPorosity));

		// Add derivative with respect to dq / dt to Jacobian
		for (int i = 0; i < static_cast<int>(_disc.nBound[comp]); ++i)
		{
			// Index explanation:
			//   -comp -> go back to beginning of liquid phase
			//   + strideParLiquid() skip to solid phase
			//   + offsetBoundComp() jump to component (skips all bound states of previous components)
			//   + i go to current bound state
			jac[idxr.strideParLiquid() - comp + idxr.offsetBoundComp(comp) + i] += alpha * invBetaP;
		}
	}
}
开发者ID:modsim,项目名称:CADET,代码行数:35,代码来源:GeneralRateModel-LinearSolver.cpp

示例3: BMessage

BMessage* Copy::Do(PDocument *doc, BMessage *settings)
{
	BMessage 	*clip				= NULL;
	BMessage	*node				= NULL;
	BMessage	*from				= NULL;
	BMessage	*to					= NULL;
	bool		fselect				= false;
	bool		tselect				= false;
	BMessage	*copyMessage		= new BMessage();
	BList		*selected			= doc->GetSelected();
	BList		*allConnections		= doc->GetAllConnections();

	int32		i					= 0;
	Indexer		*indexer			= new Indexer(doc);
	if (doc->Lock())
	{
		for (i=0;i<selected->CountItems();i++)
		{
			if (node=(BMessage *)selected->ItemAt(i))
			{
				if (node->what != P_C_CONNECTION_TYPE)
					copyMessage->AddMessage("node",indexer->IndexNode(node));
			}

		}
		for (i=0;i<allConnections->CountItems();i++ )
		{

			node = (BMessage *)allConnections->ItemAt(i);
			if ( (node->FindPointer("From",(void **)&from) == B_OK) &&
				 (node->FindPointer("To",(void **)&to) == B_OK) )
			{
				if ((from->FindBool("selected",&fselect)==B_OK) && (to->FindBool("selected",&tselect) == B_OK) )
				{
					if (fselect && tselect)
						copyMessage->AddMessage("node",indexer->IndexConnection(node,true));
					else if (fselect || tselect)
						copyMessage->AddMessage("node",indexer->IndexConnection(node));
				}
			}

		}	
		doc->Unlock();
	}
	if (be_clipboard->Lock()) 
	{
		be_clipboard->Clear();
		if (clip = be_clipboard->Data()) 
		{
			clip->AddData("application/x-vnd.projectconceptor-document", B_MIME_TYPE, copyMessage, sizeof(copyMessage));
			clip->AddMessage("test",copyMessage);
			PRINT_OBJECT(*clip);
			be_clipboard->Commit();
		}
		be_clipboard->Unlock();
	} 
	settings = PCommand::Do(doc,settings);
	return settings;
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:59,代码来源:Copy.cpp

示例4: TRACE

status_t PDocument::Archive(BMessage* archive, bool deep) const
{
	TRACE();
	BLooper::Archive(archive, deep);
	Indexer		*indexer				= new Indexer((PDocument *)this);
	int32		i						= 0;
	BMessage	*commandManage			= new BMessage();
	BMessage	*tmpNode				= NULL;
	BMessage	*allNodesMessage		= new BMessage();
	BMessage	*allConnectionsMessage	= new BMessage();
	BMessage	*selectedMessage		= new BMessage();

	archive->AddMessage("PDocument::documentSetting",documentSetting);
	//save all Nodes
	for (i=0; i<allNodes->CountItems();i++)
	{
		tmpNode=(BMessage *)allNodes->ItemAt(i);
		allNodesMessage->AddMessage("node",indexer->IndexNode(tmpNode));
	}
	archive->AddMessage("PDocument::allNodes",allNodesMessage);
	//save all Connections
	for (i=0; i<allConnections->CountItems();i++)
	{
		tmpNode=(BMessage *)allConnections->ItemAt(i);
		allConnectionsMessage->AddMessage("node",indexer->IndexConnection(tmpNode));
	}
	archive->AddMessage("PDocument::allConnections",allConnectionsMessage);
	//save the selected List
	for (i=0; i<selected->CountItems();i++)
	{
		selectedMessage->AddPointer("node",selected->ItemAt(i));
	}
	archive->AddMessage("PDocument::selected",selectedMessage);
	//save all Command related Stuff like Undo/Makor
//	commandManager->Archive(commandManage);
	for (i=0;i<(commandManager->GetUndoList())->CountItems();i++)
	{
		commandManage->AddMessage("undo",indexer->IndexMacroCommand((BMessage *)(commandManager->GetUndoList())->ItemAt(i)));

	}
	for (i=0;i<(commandManager->GetMacroList())->CountItems();i++)
	{
		commandManage->AddMessage("macro",(BMessage *)(commandManager->GetMacroList())->ItemAt(i));

	}
	commandManage->AddInt32("undoStatus",commandManager->GetUndoIndex());
	archive->AddMessage("PDocument::commandManager", commandManage);

	delete	indexer;
	delete	commandManage;
	//delete	tmpNode;
	delete	allNodesMessage;
	delete	allConnectionsMessage;
	delete	selectedMessage;

	return B_OK;
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:57,代码来源:PDocument.cpp

示例5: BMessage

BMessage* Paste::Do(PDocument *doc, BMessage *settings)
{
	BMessage 	*clip				= NULL;
	BMessage	*node				= new BMessage();
	BMessage	*deIndexedNode		= NULL;
	BMessage	*connect			= NULL;
	bool		connectselect		= false;
	BMessage	*copyMessage		= new BMessage;
	int32		messagelen			= 0;
	int32		i					= 0;
	Indexer		*indexer			= new Indexer(doc);
	if (be_clipboard->Lock())
	{
		if (clip = be_clipboard->Data())
		{
//			clip->FindData("application/x-vnd.projectconceptor-document", B_MIME_TYPE, (const void **)&copyMessage, &messagelen);
			clip->FindMessage("test",copyMessage);
			copyMessage->PrintToStream();
		}
		be_clipboard->Unlock();
	}

	if (copyMessage)
	{
		BMessage	*inserter	= new BMessage(P_C_EXECUTE_COMMAND);
		BMessage	*select		= new BMessage(P_C_EXECUTE_COMMAND);
		inserter->AddString("Command::Name","Insert");
		select->AddString("Command::Name","Select");
		while (copyMessage->FindMessage("node",i,node) == B_OK)
		{
			if (node->what == P_C_CONNECTION_TYPE)
				deIndexedNode		= indexer->DeIndexConnection(node);
			else
			{
				deIndexedNode		= indexer->RegisterDeIndexNode(node);
				//only select nodes.. because es the copy and paste funktion with selected nodes dosent work proper
				select->AddPointer("node",deIndexedNode);
			}
			inserter->AddPointer("node",deIndexedNode);

			i++;
			node = new BMessage();
		}
		i=0;
		while (inserter->FindPointer("node",i,(void **)&node) == B_OK)
		{
			if (node->what != P_C_CONNECTION_TYPE)
				indexer->DeIndexNode(node);
			i++;
		}
		inserter->AddMessage("PCommand::subPCommand",select);
		PRINT_OBJECT(*inserter);
		(new BMessenger(NULL,doc))->SendMessage(inserter);
	}
	return settings;
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:56,代码来源:Paste.cpp

示例6: test3

void test3()
{
    addRecords();
    
    /// Test the Trie

    SynonymContainer *syn = SynonymContainer::getInstance("", SYNONYM_DONOT_KEEP_ORIGIN);
    syn->init();

    Analyzer *analyzer = new Analyzer(NULL, NULL, NULL, syn, "");

    unsigned mergeEveryNSeconds = 3;
    unsigned mergeEveryMWrites = 5;
    unsigned updateHistogramEveryPMerges = 1;
    unsigned updateHistogramEveryQWrites = 5;
    string INDEX_DIR = ".";
    IndexMetaData *indexMetaData = new IndexMetaData( GlobalCache::create(1000,1000),
    		mergeEveryNSeconds, mergeEveryMWrites,
    		updateHistogramEveryPMerges, updateHistogramEveryQWrites,
    		INDEX_DIR);
    
    Indexer *indexer = Indexer::load(indexMetaData);

    //index->print_Index();

    Record *record = new Record(indexer->getSchema());
    record->setPrimaryKey(1999);
    record->setSearchableAttributeValue(0, "steve jobs");
    record->setSearchableAttributeValue(1, "stanford speech");
    record->setRecordBoost(90);
    indexer->addRecord(record, analyzer);
    indexer->merge_ForTesting();

/*    // create an index searcher
    IndexSearcher *indexSearcher = IndexSearcher::create(indexer);
    Analyzer *analyzer = indexer->getAnalyzer();

    indexer->print_Index();

    ASSERT ( ping(analyzer, indexSearcher, "tom" , 1 , 1001) == true);
    ASSERT ( ping(analyzer, indexSearcher, "jimi" , 1 , 1008) == true);
    ASSERT ( ping(analyzer, indexSearcher, "smith" , 1 , 1001) == true);
    ASSERT ( ping(analyzer, indexSearcher, "jobs" , 1 , 1999) == true);

    (void)analyzer;
    delete indexSearcher;*/

    delete indexer;
    delete analyzer;
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:50,代码来源:IndexerInternal_Test.cpp

示例7: BMessage

void PCommandManager::PlayMacro(BMessage *makro)
{
	int32 		i				= 0;
	BMessage	*message		= new BMessage();
	Indexer		*playDeIndexer	= new Indexer(doc);
	status_t	err				= B_OK;
	while ( (makro->FindMessage("Macro::Commmand", i,message) == B_OK) && (err==B_OK) )
	{
		err = Execute(playDeIndexer->DeIndexCommand(message));
		snooze(100000);
		i++;
	}

}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:14,代码来源:PCommandManager.cpp

示例8: main

int main()
{
	Parser *parser = new Parser("base/");
	parser->Process();
	vector<Document *>* collection = parser->GetCollection();
	
	Indexer *indexer = new Indexer(collection);
	indexer->Initialize();
	indexer->Process();
	indexer->Print();
	indexer->WriteIndexFile();

	delete indexer;
	delete parser;
}
开发者ID:andbrain,项目名称:cfc,代码行数:15,代码来源:indexation.cpp

示例9: createIndex

Indexer* Indexer::createIndex(QString path, int ordinal)
{
	Indexer* indexer;
	QList<QStringList> indices = listIndices(path);
	QStringList info = indices[ordinal];
	
	ImageFeatures* alg = ImageFeatures::factory(info[3]);
	alg->setParams(info[4]);
	indexer = factory(info[1], alg, path);
	indexer->setParams(info[2]);
	
	indexer->loadIndex(info[0]);
	
	return indexer;
}
开发者ID:etf-sarajevo,项目名称:etfimagesearch,代码行数:15,代码来源:indexer.cpp

示例10: OnDropIndex

void AccessTreeViewListener::OnDropIndex(DesktopDragObject* drag_object, index_gid_t source, index_gid_t dest)
{
	AccessModel* model = static_cast<AccessModel*>(m_treeview.GetTreeModel());
	Indexer* indexer = g_m2_engine->GetIndexer();

	if (dest == 0)
		dest = model->GetCategoryID();
	else if (drag_object->GetInsertType() == DesktopDragObject::INSERT_BEFORE || drag_object->GetInsertType() == DesktopDragObject::INSERT_AFTER)
		dest = indexer->GetIndexById(dest)->GetParentId();

	if (!CanDropIndex(source, dest))
		return;

	// corner case, changing the order of two folders
	OpINT32Vector children;
	indexer->GetChildren(source, children, FALSE);
	if (children.Find(dest) != -1)
	{
		Index* index = indexer->GetIndexById(dest);
			
		while (index->GetParentId() != source)
		{
			index = indexer->GetIndexById(index->GetParentId());
		}

		index->SetParentId(indexer->GetIndexById(source)->GetParentId());
	}

	indexer->GetIndexById(source)->SetParentId(dest);
}
开发者ID:prestocore,项目名称:browser,代码行数:30,代码来源:accesstreeviewlistener.cpp

示例11: Indexer

void PDocument::PushToStream(BPositionIO *pushTo)
{
	Indexer		*indexer			= new Indexer((PDocument *)this);
	BMessage	*tmpNode			= NULL;
	BMessage	*commandManage		= new BMessage();
	BMessage	*selectedMessage	= new BMessage();
	int			i					= 0;
	//**security check if the passed BPositionIO ok is
	documentSetting->Flatten(pushTo);
	for (i=0; i<allNodes->CountItems();i++)
	{
		tmpNode=(BMessage *)allNodes->ItemAt(i);
		BMessage *indexed = indexer->IndexNode(tmpNode);
		indexed->Flatten(pushTo);
	}
	for (i=0; i<allConnections->CountItems();i++)
	{
		tmpNode=(BMessage *)allConnections->ItemAt(i);
		BMessage *indexed = indexer->IndexConnection(tmpNode);
		indexed->Flatten(pushTo);
	}
	for (i=0; i<selected->CountItems();i++)
	{
		selectedMessage->AddPointer("node",selected->ItemAt(i));
	}
	selectedMessage->Flatten(pushTo);
	for (i=0;i<(commandManager->GetMacroList())->CountItems();i++)
	{
			BMessage *macro =(BMessage *)(commandManager->GetMacroList()->ItemAt(i));
			macro->Flatten(pushTo);
	}
	for (i=0;i<(commandManager->GetUndoList())->CountItems();i++)
	{
		BMessage *indexed = indexer->IndexMacroCommand((BMessage *)(commandManager->GetUndoList()->ItemAt(i)));
		indexed->Flatten(pushTo);
	}
	//**add the UndoIndex
	commandManage->AddInt32("undoStatus",commandManager->GetUndoIndex());
	//add the commandManage
	commandManage->Flatten(pushTo);
	delete	indexer;
	delete	commandManage;
	delete	selectedMessage;
}
开发者ID:BackupTheBerlios,项目名称:projectconcepto-svn,代码行数:44,代码来源:PDocument.cpp

示例12: indexOf

template <typename T> void
GenericFactor<T>::absorveEvidence (const T& arg, unsigned obsIdx)
{
  size_t idx = indexOf (arg);
  assert (idx != args_.size());
  assert (obsIdx < ranges_[idx]);
  Params newps;
  newps.reserve (params_.size() / ranges_[idx]);
  Indexer indexer (ranges_);
  for (unsigned i = 0; i < obsIdx; ++i) {
    indexer.incrementDimension (idx);
  }
  while (indexer.valid()) {
    newps.push_back (params_[indexer]);
    indexer.incrementExceptDimension (idx);
  }
  params_ = newps;
  args_.erase (args_.begin() + idx);
  ranges_.erase (ranges_.begin() + idx);
}
开发者ID:gokhansolak,项目名称:yap-6.3,代码行数:20,代码来源:GenericFactor.cpp

示例13: TEST

TEST(IndexerTest, testGetUserPostIdsMultipleUsers) {
    Indexer i;
    const string username1 = "val";
    const string username2 = "kim";
    const uint64_t postId1 = 666;
    const uint64_t postId2 = 777;
    {
        const TTopics topics = {"find", "secret", "on", "valbok.com"};
        EXPECT_TRUE(i.index(topics, username1, postId1));

        auto item = i.getTopicItem("secret");
        auto postIds = item.userPostIds;
        EXPECT_EQ(1, postIds.size());
        auto it = postIds.begin();
        EXPECT_EQ(username1, it->first);
        EXPECT_EQ(1, it->second.size());
        auto sit = it->second.begin();
        EXPECT_EQ(postId1, *sit);
    }
    {
        const TTopics topics = {"open", "secret", "page"};
        EXPECT_TRUE(i.index(topics, username2, postId2));

        auto item = i.getTopicItem("secret");
        auto postIds = item.userPostIds;
        EXPECT_EQ(2, postIds.size());
        auto it = postIds.begin();
        EXPECT_EQ(username2, it->first);
        EXPECT_EQ(1, it->second.size());
        auto sit = it->second.begin();
        EXPECT_EQ(postId2, *sit);
        ++it;
        EXPECT_EQ(username1, it->first);
        EXPECT_EQ(1, it->second.size());
        sit = it->second.begin();
        EXPECT_EQ(postId1, *sit);
    }
}
开发者ID:valbok,项目名称:twitcher.exmpl,代码行数:38,代码来源:IndexerTest.cpp

示例14: testLELASplicerVsIndexer

void testLELASplicerVsIndexer(const char *file_name)
{
	typedef uint16 modulus_type;
	typedef Modular<modulus_type> Ring;

	modulus_type modulus = MatrixUtil::loadF4Modulus(file_name);
	Ring R (modulus);
	Context<Ring> ctx (R);
	Indexer<uint32> indexer;

	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);

	commentator.start("Loading matrix");
		SparseMatrix<Ring::Element> A = MatrixUtil::loadF4Matrix(R, file_name);
        MatrixUtil::invertMatrixRows(A);	//accomodate format to LELA's splicer
	commentator.stop(MSG_DONE);
        
        commentator.start("Constructing submatrices using Splicer", "USING LELA SPLICER");
                LELA_GF_UTIL::spliceMatrix(R, A);
        commentator.stop(MSG_DONE, "USING LELA SPLICER");
        
        report << endl;
        commentator.start("Constructing submatrices using Indexer", "USING INDEXER");
                commentator.start("Constructing indexes");
                        indexer.processMatrix(A);
                commentator.stop(MSG_DONE);

                SparseMatrix<Ring::Element>    sub_A (indexer.Npiv, indexer.Npiv),
                                                        sub_B (indexer.Npiv, A.coldim () - indexer.Npiv),
                                                        sub_C (A.rowdim () - indexer.Npiv, indexer.Npiv),
                                                        sub_D (A.rowdim () - indexer.Npiv, A.coldim () - indexer.Npiv);

                commentator.start("Constructing sub matrices");
                        indexer.constructSubMatrices(A, sub_A, sub_B, sub_C, sub_D, true);
                commentator.stop(MSG_DONE);
        
        commentator.stop(MSG_DONE, "USING INDEXER");
}
开发者ID:ederc,项目名称:LELA,代码行数:38,代码来源:test-splicer-indexer.C

示例15: Serialize

void Serialize(string directoryName)
{
	// Create a schema
	Schema *schema = Schema::create(LocationIndex);
	schema->setPrimaryKey("list_id"); // integer, by default not searchable
	schema->setSearchableAttribute("title", 2); // searchable text
	schema->setSearchableAttribute("address", 7); // searchable text

    // Create an analyzer
    Analyzer *analyzer = new Analyzer(NULL, NULL, NULL, NULL, "");

    unsigned mergeEveryNSeconds = 3;
    unsigned mergeEveryMWrites = 5;
    unsigned updateHistogramEveryPMerges = 1;
    unsigned updateHistogramEveryQWrites = 5;
	CacheManager *cache = new CacheManager(134217728);
    IndexMetaData *indexMetaData = new IndexMetaData(cache,
    		mergeEveryNSeconds, mergeEveryMWrites,
    		updateHistogramEveryPMerges, updateHistogramEveryQWrites,
    		directoryName);

	Indexer *indexer = Indexer::create(indexMetaData, analyzer, schema);

	readRecordsFromFile(indexer, schema, analyzer, directoryName+"/quadtree/1K");

    boost::shared_ptr<QuadTreeRootNodeAndFreeLists> quadtree_ReadView;
    quadtree_ReadView = dynamic_cast<IndexReaderWriter *>(indexer)->getQuadTree_ReadView();
    QuadTreeNode *qt = quadtree_ReadView->root;

	// serialize the index
	indexer->commit();
	indexer->save(directoryName);

	delete indexer;
    delete indexMetaData;
	delete analyzer;
	delete schema;
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:38,代码来源:Geo_Test.cpp


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