Пример #1
0
    void
    rebuild_index(void)
    {
        typename vector<value_type>::iterator iter;
        size_t start = 0, stop = 0, i;

        iter = store.end();
        --iter;
        index.resize(indexer(iter->first) + 1);

        for (iter = store.begin();
                iter != store.end();
                ++iter)
        {
            stop = indexer(iter->first) + 1;

            for (i = start; i != stop; ++i)
                index[i] = iter;

            start = stop;
        }

        for (i = start; i != index.size(); ++i)
            index[i] = iter;
    }
Пример #2
0
void main(int argc,char *argv[])
{

	FILE *hdd_load;
	buildSW();
	if(argc < 3)
		printf("No input specified / Invalid Command\n");
	
	else if(argv[1][0] =='-' && argv[1][1]=='i')
	{
		hdd_load = fopen("../bin/tree","rb");
		
		if(hdd_load)
		{
			fclose(hdd_load);
			load2mm();
			//buildSW();
		
			printf("Tree Built sucessfully\n");
			printf("retrieved vlaue:%ld",doc_count);
			indexer(argc,argv);	
		}
		else
			indexer(argc,argv);	
	}

	else if(argv[1][0] =='-' && argv[1][1]=='s')
	{
		hdd_load = fopen("../bin/tree","rb");
		if(hdd_load)
		{
			fclose(hdd_load);
			load2mm();
		
			//printf("Tree Built sucessfully\n");
			//printf("retrieved vlaue:%ld\n",doc_count);
			
		}

		if(argv[2][0] =='-' && argv[2][1]=='b')
			process_query_bm25(argc,argv);
		else
			process_query(argc,argv);							

	
	}// -s

}
Пример #3
0
bool DungeonGenerator::EraserFunc(std::vector<int> &Pos, std::map<std::vector<int>, std::unordered_set<int>> &connectorRegions,
	std::map<int, int> &merged)
{
	Vec2i tmp(Pos[0], Pos[1]);

	std::unordered_set<int> regionss;

	for (std::unordered_set<int>::iterator it = connectorRegions[Pos].begin(); it != connectorRegions[Pos].end(); ++it)
	{
		regionss.insert(merged[*it]);
	}

	if (regionss.size() > 1)
	{
		return false;
	}

	if (Random(0, 101) < ExtraConnectorChance)
	{
		for (int i = 0; i < m_Cardinal.size(); i++)
		{
			Vec2i indexer(tmp + m_Cardinal[i]);
			if (m_Dungeon[indexer.x()][indexer.y()] == Door)
			{
				return true;
			}
		}

		AddJunction(tmp);
	}

	return true;
}
Пример #4
0
 Status createIndexFromSpec(OperationContext* txn, const StringData& ns, const BSONObj& spec) {
     AutoGetOrCreateDb autoDb(txn, nsToDatabaseSubstring(ns), MODE_X);
     Collection* coll;
     {
         WriteUnitOfWork wunit(txn);
         coll = autoDb.getDb()->getOrCreateCollection(txn, ns);
         invariant(coll);
         wunit.commit();
     }
     MultiIndexBlock indexer(txn, coll);
     Status status = indexer.init(spec);
     if (status == ErrorCodes::IndexAlreadyExists) {
         return Status::OK();
     }
     if (!status.isOK()) {
         return status;
     }
     status = indexer.insertAllDocumentsInCollection();
     if (!status.isOK()) {
         return status;
     }
     WriteUnitOfWork wunit(txn);
     indexer.commit();
     wunit.commit();
     return Status::OK();
 }
Пример #5
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ RemoveSubElements										/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// This routine takes a list of hierarchical elements and removes from that list any elements which are already implicity
// in the list by way of one of their super elements being in the list.
void CHierarchicalTable::RemoveSubElements(
	CLinkedListT<CHierarchicalElement>	&ioSelection)
{
	CListIndexerT<CHierarchicalElement>		indexer(&ioSelection);
	
	// For each element in the list, see if one of it's super element is already in the list
	while (CHierarchicalElement *selectedElement=indexer.GetNextData())
	{
		CHierarchicalElement	*superEle=selectedElement->GetSuperGroup();
		
		// Index though all of this element's super elements
		for (; superEle; superEle=superEle->GetSuperGroup())
		{
			CListIndexerT<CHierarchicalElement>		indexer2(&ioSelection);
			
			// Search list for super element
			while (CHierarchicalElement *searchElement=indexer2.GetNextData())
			{
				if (searchElement==superEle)
				{
					selectedElement->mPublicLink.DeleteAliasInList(&ioSelection);
					break;
				}
			}
		}
	}	
}
Пример #6
0
int main(int argc, char *argv[]) {
    ArgumentParser ap;
    ap.parse_args(argc, argv);

    initialize_dash_dirs();

    if (ap.index) {
        if (ap.genome == "" || ap.seed_len <= 0 || ap.threads <= 0) {
            parse_error(ap);
        } else {
            indexer(ap.genome, ap.seed_len, ap.threads);
        }
    }
    else if (ap.align) {
        if (ap.out == "" || ap.in == "" || ap.threads <= 0 || ap.edit_dist < 0 \
                || ap.conf <= 0 ) {
            parse_error(ap);
        } else {
            aligner(ap.in, ap.out, ap.threads, ap.edit_dist, ap.conf);
        }
    }
    else {
        parse_error(ap);
    }
    return 0;
}
        void run() {
            // Create a new collection.
            Database* db = _ctx.ctx().db();
            db->dropCollection( &_txn, _ns );
            Collection* coll = db->createCollection( &_txn, _ns );

            coll->insertDocument( &_txn, BSON( "_id" << 1 << "a" << "dup" ), true );
            coll->insertDocument( &_txn, BSON( "_id" << 2 << "a" << "dup" ), true );

            MultiIndexBlock indexer(&_txn, coll);
            indexer.allowBackgroundBuilding();
            indexer.ignoreUniqueConstraint();

            const BSONObj spec = BSON("name" << "a"
                                   << "ns" << coll->ns().ns()
                                   << "key" << BSON("a" << 1)
                                   << "unique" << true
                                   << "background" << background);

            ASSERT_OK(indexer.init(spec));
            ASSERT_OK(indexer.insertAllDocumentsInCollection());

            WriteUnitOfWork wunit(&_txn);
            indexer.commit();
            wunit.commit();
        }
Пример #8
0
    /**
     * Perform a single index insert into a collection.  Requires the index descriptor be
     * preprocessed and the collection already has been created.
     *
     * Might fault or error, otherwise populates the result.
     */
    static void singleCreateIndex( OperationContext* txn,
                                   const BSONObj& indexDesc,
                                   Collection* collection,
                                   WriteOpResult* result ) {

        const string indexNS = collection->ns().getSystemIndexesCollection();

        txn->lockState()->assertWriteLocked( indexNS );

        MultiIndexBlock indexer(txn, collection);
        indexer.allowBackgroundBuilding();
        indexer.allowInterruption();

        Status status = indexer.init(indexDesc);
        if ( status.code() == ErrorCodes::IndexAlreadyExists ) {
            result->getStats().n = 0;
            return; // inserting an existing index is a no-op.
        }
        if (!status.isOK()) {
            result->setError(toWriteError(status));
            return;
        }

        status = indexer.insertAllDocumentsInCollection();
        if (!status.isOK()) {
            result->setError(toWriteError(status));
            return;
        }

        WriteUnitOfWork wunit(txn);
        indexer.commit();
        repl::logOp( txn, "i", indexNS.c_str(), indexDesc );
        result->getStats().n = 1;
        wunit.commit();
    }
Пример #9
0
/* Apply the indices for the recset */
int bdb_index_recrun(
	Operation *op,
	struct bdb_info *bdb,
	IndexRec *ir0,
	ID id,
	int base )
{
	IndexRec *ir;
	AttrList *al;
	int i, rc = 0;

	/* Never index ID 0 */
	if ( id == 0 )
		return 0;

	for (i=base; i<bdb->bi_nattrs; i+=slap_tool_thread_max-1) {
		ir = ir0 + i;
		if ( !ir->ai ) continue;
		while (( al = ir->attrs )) {
			ir->attrs = al->next;
			rc = indexer( op, NULL, ir->ai->ai_desc,
				&ir->ai->ai_desc->ad_type->sat_cname,
				al->attr->a_nvals, id, SLAP_INDEX_ADD_OP,
				ir->ai->ai_indexmask );
			free( al );
			if ( rc ) break;
		}
	}
	return rc;
}
Пример #10
0
/**
 * Append @param genotype to @param covariate in the right order
 * @param phenotypeNameInOrder is the row names for @param covariate
 * @param rowLabel is the row names for @param geno
 * return 0 if succeed
 */
int appendGenotype(Matrix* covariate,
                   const std::vector<std::string>& phenotypeNameInOrder,
                   Matrix& geno, const std::vector<std::string>& rowLabel) {
  if (!covariate) {
    return -1;
  }
  Matrix& m = *covariate;
  int baseCols = m.cols;
  m.Dimension(phenotypeNameInOrder.size(), m.cols + geno.cols);

  Indexer indexer(rowLabel);
  if (indexer.hasDuplication()) {
    return -1;
  }
  for (size_t i = 0; i < phenotypeNameInOrder.size(); ++i) {
    for (int j = 0; j < m.cols; ++j) {
      int index = indexer[phenotypeNameInOrder[i]];
      if (index < 0) {  // did not find a person
        return -1;
      }
      m[i][baseCols + j] = geno[index][j];

      if (i == 0) {
        m.SetColumnLabel(baseCols + j, geno.GetColumnLabel(j));
      }
    }
  }
  return 0;
}
Пример #11
0
void CMapPolygon::SaveContent(CDataStoreStream &inStream)
{
	inStream << components;
	
	TListIndexer	indexer(&componentsList);
	while (CMapPolygonComponent *component=(CMapPolygonComponent*)indexer.GetNextData())
		component->SaveContent(inStream);
}
Пример #12
0
int main()
{
	Indexer indexer("Sat_Aug_24_15_48_12_2013_crawled"); //Create a indexer to index the pages in given directory.

	index.start_index();     //Start indexing.
	index.query("boost");    //Perform a query.
	index.save_index("./");  //Save the index related structs into disk files.
}
Пример #13
0
// fileManager::loadMaskImage(): loads the full tractogram mask in memory
void fileManager::loadMaskImage( std::string maskFilename) {

    std::vector<std::vector<std::vector<float> > > maskMatrix;

    ValueType maskValueType = readImage( maskFilename, &maskMatrix );
    loadHeader(maskFilename);

    const size_t dimx = maskMatrix.size();
    const size_t dimy = maskMatrix[0].size();
    const size_t dimz = maskMatrix[0][0].size();

    m_maskMatrix.clear();

    {
        std::vector<bool> zvect(dimz,false);
        std::vector<std::vector<bool> >yzmatrix(dimy,zvect);
        m_maskMatrix.resize(dimx,yzmatrix);
    }

    size_t maskSum=0;
    for (int i=0 ; i<dimx ; ++i)
    {
        for (int j=0 ; j<dimy ; ++j)
        {
            for (int k=0 ; k<dimz ; ++k)
            {
                m_maskMatrix[i][j][k] = maskMatrix[i][j][k];
                if(m_maskMatrix[i][j][k])
                    ++maskSum;
            }
        }
    }

    m_flipVector.clear();
    m_flipVector.resize(maskSum,0);
    for (size_t i=0; i<maskSum; ++i)
    {
        m_flipVector[i]=i;
    }
    size_t indexer(0);
    for (int k=0 ; k<dimz ; ++k)
    {
        for (int j=0 ; j<dimy ; ++j)
        {
            size_t valuesPerRow(0);
            for (int i=0 ; i<dimx ; ++i)
            {
                if(m_maskMatrix[i][j][k])
                {
                    ++valuesPerRow;
                }
            }
            std::reverse(m_flipVector.begin()+indexer,m_flipVector.begin()+indexer+valuesPerRow);
            indexer+=valuesPerRow;
        }
    }
    return;
}// end fileManager::loadMaskImage() -----------------------------------------------------------------
Пример #14
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ InsertElementIntoTable								/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Inserts the passed element into the table. This should be called when the element has been made visible and needs putting
// in the table. The element should already be in the hierarchy.
void CHierarchicalTable::InsertElementIntoTable(
	CHierarchicalElement							*inElement,
	CHierarchicalGroup::TVisibilityOperation		inOp)
{
	TableIndexT			subRowsToAdd;
	bool				addHeaderRow=!inElement->IsInTable();
	CHierarchicalGroup	*group=dynamic_cast<CHierarchicalGroup*>(inElement);
	
	switch (inOp)
	{
		case CHierarchicalGroup::kShowHeaderAndSubGroup:
			subRowsToAdd=group->CountVisibleSubElements();
			break;
		
		case CHierarchicalGroup::kShowSubGroupOnly:
			subRowsToAdd=group->CountVisibleSubElements();
			addHeaderRow=false;
			break;
			
		case CHierarchicalGroup::kShowHeaderElementOnly:
			subRowsToAdd=0;
			break;
			
		default:
			Throw_(paramErr);
			break;
	}
	
	// Work out where in the table it should go and insert it
	STableCell			cellPos;

	CalcInsertPosition(inElement,cellPos);
	
	if (inElement->IsInTable())
		cellPos.row++;

	// Insert a row(s) and set the cell(s)
	InsertRows(subRowsToAdd+addHeaderRow,cellPos.row-1,0L,0L,true);

	if (addHeaderRow)
	{		
		PutInTable(inElement,cellPos);
		cellPos.row++;		
	}

	// group == 0L if the element is not a group leader
	if (group)
	{
		CVisibleElementsIndexer						indexer(group->GetSubList());
		CHierarchicalElement						*element;
		
		while ((element=indexer.GetNextData()) && subRowsToAdd--)
		{
			PutInTable(element,cellPos);
			cellPos.row++;
		}
	}
}
Пример #15
0
    /*
     * The reason for the existence of this class: find the first item with a
     * key not less than k. It does this with one computed subscript.
     */
    const_iterator lower_bound(const key_type & k) const
    {
        size_t idx = indexer(k);

        if (idx + 1 > index.size())
            return store.end();
        else
            return index[idx];
    }
Пример #16
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ RunMoanSlice
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Steps a program blocked by a move or animate one step
void CProgMoanChannel::RunMoanSlice()
{
    // process the move
    TTBInteger	x,y,i;
    float		xScale,yScale,rot;
    StepMoan(x,y,i,xScale,yScale,rot);

    // for each sprite, affect the x,y, and i changes
    if (x || y || i!=-1 || xScale || yScale || rot)
    {
        {
            CListIndexerT<CTBSprite>		indexer(&mSprites);
            CSpriteManager					*spriteMan=&mProgram->CheckGraphicsMode()->mSpriteManager;

            while (CTBSprite *s=indexer.GetNextData())
            {
                if (x || y)
                    s->RelPos(x,y);

                if (i!=-1)
                    s->SetSpriteImage(spriteMan->GetImage(i,s->GetBank()));

                if (xScale)
                    s->SetXScale(s->GetXScale()+xScale);
                if (yScale)
                    s->SetYScale(s->GetYScale()+yScale);

                if (rot)
                    s->SetAngle(s->GetAngle()-rot);
            }
        }

        // for each viewport affect the x and y changes
        {
            CListIndexerT<CViewport>		indexer(&mViewports);

            while (CViewport *v=indexer.GetNextData())
            {
                if (x || y)
                    v->ViewportOffset(v->GetXOffset()+x,v->GetYOffset()+y);
            }
        }
    }
}
// [[Rcpp::export]]
List make_index_parallel( DataFrame data, CharacterVector by ){
    
    int n = data.nrows() ;
    
    Visitors visitors(data, by) ;
    IndexMaker indexer(visitors) ;
    
    parallelReduce(0, n, indexer) ;
    
    return indexer.get() ;
}
Пример #18
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ RemoveElementFromTable							/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Removes an element from the table. It must be in the hierarchy and in the table.
void CHierarchicalTable::RemoveElementFromTable(
	CHierarchicalElement							*inElement,
	CHierarchicalGroup::TVisibilityOperation		inOp)
{
	STableCell			cellPos;
	
	CalcInsertPosition(inElement,cellPos);
	
	ArrayIndexT				numRowsToRemove=0;
	
	switch (inOp)
	{
		case CHierarchicalGroup::kHideHeaderElementOnly:
		case CHierarchicalGroup::kHideHeaderAndSubGroup:
			if (inElement->IsInTable())
			{
				numRowsToRemove=1;
				RemoveFromTable(inElement);
			}
			if (inOp==CHierarchicalGroup::kHideHeaderElementOnly)
				break;
			else
				;// Fall through...

		case CHierarchicalGroup::kHideSubGroupOnly:
			CHierarchicalGroup		*group=dynamic_cast<CHierarchicalGroup*>(inElement);
			
			if (group && group->GetSubList())
			{
				CHierListIndexerT<CHierarchicalElement>		indexer(group->GetSubList());
				CHierarchicalElement						*element;

				while (element=indexer.GetNextData())
				{
					if (element->IsInTable())
					{
						numRowsToRemove++;
						RemoveFromTable(element);
					}
				}
			}
			break;			
	}
	
	if (numRowsToRemove)
	{
		// If only removing the sub group then start an element lower
		if (inOp==CHierarchicalGroup::kHideSubGroupOnly && inElement->IsInTable())
			cellPos.row++;
		
		RemoveRows(numRowsToRemove,cellPos.row,true);
	}
}
Пример #19
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ DataStatmentCreated
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Same as above but for data statements
void CLabelTable::DataStatementCreated(
	CGeneralExpression			*inStatement)
{
	CListIndexerT<CLabelEntry>		indexer(&mLineSortedLabels);
	
	while (CLabelEntry *entry=indexer.GetNextData())
	{
		if (entry->GetNextDataStatement())
			break;
		else
			entry->SetNextDataStatement(inStatement);
	}
}
Пример #20
0
/* Static */
TPersistorCreator UPersistanceMgr::LookupCreator(
    TPersistorId	inId)
{
    CListIndexerT<SPersistorCreatorEntry>	indexer(&sCreators);
    
    while (SPersistorCreatorEntry *pe=indexer.GetNextData())
    {
		if (pe->id==inId)
		    return pe->creator;
    }
    
    return 0;
}
// [[Rcpp::export]]
List detail_make_index_parallel( DataFrame data, CharacterVector by ){
    int n = data.nrows() ;
    Timers timers(n);
    
    Visitors visitors(data, by) ;  
    
    IndexMaker indexer(visitors) ;
    TimedReducer<IndexMaker, Timer, tbb::mutex, tbb::mutex::scoped_lock> timed_indexer(indexer, timers) ;
    
    parallelReduce(0, n, timed_indexer, 100) ;
    return timed_indexer.get() ;
    
}
Пример #22
0
/*e*/
void CPersistor::FlattenToStream(
    LStream &outStream)
{
//    outStream << mPersistorId;
  	outStream.WriteBlock(&mPersistorId,sizeof(mPersistorId));
   
    CListIndexerT<CPersistor>	indexer(&mSubPersists);
    
    while (CPersistor *per=indexer.GetNextData())
	per->FlattenToStream(outStream);

    FlattenToStreamSelf(outStream);
}
Пример #23
0
/*e*/
void CPersistor::AssignFromStream(
    LStream	&inStream)
{
//    inStream >> mPersistorId;
	inStream.ReadBlock(&mPersistorId,sizeof(mPersistorId));

    CListIndexerT<CPersistor> indexer(&mSubPersists);

    while (CPersistor *p=indexer.GetNextData())
	p->AssignFromStream(inStream);

    AssignFromStreamSelf(inStream);
}
Пример #24
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ ExecStatmentCreated
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// When an executable statment is created it registers itself with the label table. The most recently created labels will
// not have a statement ptr and so they adopt this one.
void CLabelTable::ExecStatementCreated(
	CStatement				*inStatement)
{
	CListIndexerT<CLabelEntry>		indexer(&mLineSortedLabels);
	
	while (CLabelEntry *entry=indexer.GetNextData())
	{
		if (entry->GetNextExecStatement())
			break;
		else
			entry->SetNextExecStatement(inStatement);
	}
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ GetCreatorForFile
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// returns the res file creator, if any, for the file specified
CResourceContainerCreator *CResourceContainerCreator::GetCreatorForFile(
	FSSpec		*inFile)
{
	CListIndexerT<CResourceContainerCreator>	indexer(&CResourceContainerCreator::GetCreatorsList());
	CResourceContainerCreator 					*result=NULL;
	while (result=indexer.GetNextData())
	{
		if (result->CanOpenFile(inFile))
		{
			break;
		}
	}
	return result;
}
Пример #26
0
void CObjectPicker::jumpObjectsBy(int amount) {
	auto picker = m_pickers[m_tabs->currentIndex()];
	auto indexer = picker->indexer();

	int currentPickableIndex = indexer->pickableIndexForShapeNum(picker->selectedShape());
	int newPickableIndex = currentPickableIndex + amount;

	if (newPickableIndex < 0)
		newPickableIndex = 0;
	if (newPickableIndex >= indexer->pickableIndexCount())
		newPickableIndex = indexer->pickableIndexCount() - 1;

	picker->setSelectedShape(indexer->shapeNumForPickableIndex(newPickableIndex));
}
Пример #27
0
bool XmlCatalogue::Construct()
{
	if (!IsEmpty())
	{
		Destroy();
	}

	XmlMarkupConstructor constructor;
	XmlMarkupIndexer indexer(Index,&constructor);

	XmlReaderFast reader(this,&indexer);

	return XmlDocument::Construct(&reader);	
}
Пример #28
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ RestoreWindowPosition
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
void CWindow::RestoreWindowPosition(
	Rect		&inScreenSize)
{
	CListIndexerT<CSavedPosition>		indexer(&mSavedPositions);
	
	while (CSavedPosition *pos=indexer.GetNextData())
	{
		if (SameRect(pos->mScreenRes,inScreenSize))
		{
			::SetWindowBounds(windowPtr,kWindowStructureRgn,&pos->mSavedPosition);
			return;
		}
	}	
}
Пример #29
0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//		¥ CalcInsertPosition								/*e*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// Calculates the first cell which should be occupied by this element.
// Throws under very low memory conditions.
void CHierarchicalTable::CalcInsertPosition(CHierarchicalElement *inElement,STableCell &outPosition)
{
	CHierListIndexerT<CHierarchicalElement>		indexer(GetSubList());
	CHierarchicalElement						*element;
	
	outPosition.row=outPosition.col=1;

	while (element=indexer.GetNextData())
	{
		if (element==inElement)
			break;
		else if (element->IsInTable())
			outPosition.row++;
	}
}
// [[Rcpp::export]]
List make_index_concurrent_hash_map( DataFrame data, CharacterVector by ){
    
    int n = data.nrows() ;
    
    Visitors visitors(data, by) ;
    VisitorSetHasher<Visitors> hasher(visitors) ; 
    VisitorSetEqualPredicate<Visitors> equal(visitors) ;
    ConcurrentMap map(1024, hasher, equal) ;
    
    IndexMaker2 indexer(map) ;
    
    parallelFor(0, n, indexer) ;
    
    return indexer.get() ;
}