示例#1
0
/* EXPORT->GetLabId: return id of given name */
LabId GetLabId(char *name, Boolean insert)
{
   int h;
   NameCell *p;

   ++numAccesses; ++numTests;
   if ((trace&T_HASH) && numAccesses%100 == 0) 
      PrintNameTabStats();
   h = Hash(name); p = hashtab[h];
   if (p==NULL) {  /* special case - this slot empty */
      if (insert)
         p=hashtab[h]=NewCell(name);
      return p;
   }
   do{             /* general case - look for name */
      if (strcmp(name,p->name) == 0)
         return p; /* found it */
      ++numTests;
      p = p->next;
   } while (p != NULL);
   if (insert){    /* name not stored */
      p = NewCell(name);
      p->next = hashtab[h];
      hashtab[h] = p; 
   }
   return p;
}
示例#2
0
void CContainer::SetCellStyleNr(const cell& inLoc, int inStyle)
{	CHECKLOCK
	cellmap::iterator i;
	
	if ((i = fCellData.find(inLoc)) == fCellData.end())
	{
		if (inStyle != fDefaultCellStyle)
		{
			Value v;
			NewCell(inLoc, v, NULL);
			fCellData[inLoc].mStyle = inStyle;
		}
		else
			return;
	}	
	else
		(*i).second.mStyle = inStyle;
} /* SetCellStyleNr */
示例#3
0
Cell* OCME::GetCellC(const CellKey & key,bool ifnot_create){
		stat.n_getcell++;
		CellsIterator ci = cells.find(key);
	//	Cell *  c = cells.find(key);
		Cell *  c = (ci==cells.end())?0:(*ci).second;
		if(c) { assert(key==c->key);return c;}

		if(ifnot_create) {
				Cell * newc =  NewCell(key);;
				newc->face				= AddElement<OFace>			("f",newc);
				newc->vert				= AddElement<OVertex>		("v",newc);
				newc->border			= AddElement<BorderIndex>	("b",newc);
				newc->impostor->InitDataCumulate(key.BBox3f());
				if(this->record_cells_set_modification) {
						this->added_cells.push_back(key);
						this->touched_cells.push_back(key);
				}
				return newc;
		}

		return NULL;
	}