AttrList new_AttrList(void){ AttrList newList = INVALID_ATTRLIST; int i; if(!poolInitialized) initPool(); if(poolUsed == (poolSize - 1)) growPool(); newList = getNewID(); if(newList != INVALID_ATTRLIST){ for(i = 0; i < poolSize; ++i){ if(attrListPool[i].id == INVALID_ATTRLIST){ break; } } attrListPool[i].id = newList; if(attrListPool[i].data != NULL){ gcFree(attrListPool[i].data); } if(attrListPool[i].keys != NULL){ gcFree(attrListPool[i].keys); } attrListPool[i].size = 0; attrListPool[i].keys = NULL; attrListPool[i].data = NULL; poolUsed++; } return newList; }
int BookingDatabase::Passengers::add(std::string pName) { Passenger passenger; passenger.mName = pName; passenger.mPID = getNewID(); Row<Passenger>* row = new Row<Passenger>(this, passenger); addRow(row); //if (mDataConsoleOutput) std::cout << "Passenger " << row->getData().mPID << " " << pName << std::endl; return row->getData().mPID; }
bool ReBar::addBand(REBARBANDINFO * rBand, bool useID) { if (rBand->fMask & RBBIM_STYLE) rBand->fStyle |= RBBS_GRIPPERALWAYS; else rBand->fStyle = RBBS_GRIPPERALWAYS; rBand->fMask |= RBBIM_ID | RBBIM_STYLE; if (useID) { if (isIDTaken(rBand->wID)) return false; } else { rBand->wID = getNewID(); } ::SendMessage(_hSelf, RB_INSERTBAND, (WPARAM)-1, (LPARAM)rBand); //add to end of list return true; }
int Logger::registerProcess( const QString& identifier ) { LoggerItem *item = new LoggerItem( getNewID(), identifier ); if( writeLogFiles ) { // TODO error handling item->file.open( QIODevice::WriteOnly ); item->textStream.setDevice( &(item->file) ); } processes.insert( item->id, item ); log( item->id, i18n("Identifier") + ": " + item->identifier ); log( item->id, i18n("Log ID") + ": " + QString::number(item->id) ); emit updateProcess( item->id ); return item->id; }
drawableElement::drawableElement() { isInitialized=false; getNewID(); }
Transition::Transition(string name, ProcessingType type) : Node(name, type) { Node::setProcessingType(type); int value = getNewID(); Node::setID(value); Node::dispatchCreateEvent(); }