void MainWindow::setSettings() { newEntry("Ki:",&gs->ki); newEntry("Kp:",&gs->kp); newEntry("Td:",&gs->td); }
/***************************************************************************** Note that it is assumed that a "value" of zero means an undefined keyword and clients of this function should observe this. Also, all keywords added should be added in lower case. If we encounter a case-sensitive language whose keywords are in upper case, we will need to redesign this. *****************************************************************************/ void Keywords::addKeyword (const char *const string, Language language, int value) { const unsigned long hashedValue = hashValue (string); hashEntry *entry = getHashTableEntry (hashedValue); if (entry == NULL) { table [hashedValue] = newEntry (string, language, value); } else { hashEntry *prev = NULL; while (entry != NULL) { if (language == entry->language && strcmp (string, entry->string) == 0) { Assert (("Already in table" == NULL)); } prev = entry; entry = entry->next; } if (entry == NULL) { Assert (prev != NULL); prev->next = newEntry (string, language, value); } } }
//---------------------------------------------------------------- // TBenchmark::Private::Private // TBenchmark::Private::Private(const char * description) { boost::lock_guard<boost::mutex> lock(mutex_); // lookup the timesheet for the current thread: boost::thread::id threadId = boost::this_thread::get_id(); Timesheet & ts = tss_[threadId]; // shortcut to timesheet entries: std::map<std::string, Timesheet::Entry> & entries = ts.entries_; std::string entryPath = ts.path_; ts.path_ += '/'; ts.path_ += description; key_ = ts.path_; std::map<std::string, Timesheet::Entry>::iterator lower_bound = entries.lower_bound(key_); if (lower_bound == entries.end() || entries.key_comp()(key_, lower_bound->first)) { // initialize a new measurement Timesheet::Entry newEntry(ts.depth_, entryPath, description); entries.insert(lower_bound, std::make_pair(key_, newEntry)); } ts.depth_++; // save timestamp last, so that the benchmark would // not be older than the timesheet that keeps its entry: t0_ = boost::chrono::steady_clock::now(); }
void JabberBotSession::Subscribe(const std::string *from, MessageStanza::MessageTypes type, const std::string *id) { std::string account_id, resource; split_identifier(from, account_id, resource); char keyValue[account_id.size()+1]; account_id.copy(keyValue, std::string::npos); keyValue[account_id.size()] = '\0'; time_t last = 0; Dbt key(keyValue, account_id.size()+1); Dbt data(&last, sizeof(time_t)); m_subscriptionDb.put(NULL, &key, &data, 0); m_subscriptionDb.sync(0); time_t now = time(NULL); time_t t1 = random() % ((m_eod - now)/2); time_t t2 = random() % ((m_eod - now)/2); Upcoming newEntry(account_id, now + t1 + t2); m_upcomingQueue.push(newEntry); MessageStanza message; message.Type(type); message.To(from); message.Thread(id); message.Body("You have been subscribed"); m_session->SendMessage(message, false); }
int IFaceposerModels::LoadModel( char const *filename ) { int idx = FindModelByFilename( filename ); if ( idx == -1 && Count() < MAX_FP_MODELS ) { StudioModel *model = new StudioModel(); StudioModel *save = g_pStudioModel; g_pStudioModel = model; if ( !model->LoadModel( filename ) ) { delete model; g_pStudioModel = save; return 0; // ?? ERROR } g_pStudioModel = save; SetupModelFlexcontrollerLinks( model ); CFacePoserModel newEntry( filename, model ); idx = m_Models.AddToTail( newEntry ); g_MDLViewer->InitModelTab(); g_MDLViewer->SetActiveModelTab( idx ); g_pControlPanel->CenterOnFace(); } return idx; }
/** * FUNCTION NAME: addEntryToMemberList * * DESCRIPTION: Add a new entry to the membership list */ vector<MemberListEntry>::iterator MP1Node::addEntryToMemberList(int id, short port, long heartbeat) { vector<MemberListEntry>::iterator it; if( id > par->MAX_NNB ) { cout<<"Unknown id " <<id<<endl; #ifdef DEBUGLOG static char s[1024]; char *s1 = s; s1 += sprintf(s1, "Unknown ID"); #endif return it; } MemberListEntry newEntry(id, port, heartbeat, par->getcurrtime()); memberNode->memberList.emplace_back(newEntry); memberNode->nnb++; if ( memberNode->nnb > par->MAX_NNB ) { cout <<memberNode->nnb<<" exceeds the capacity"<<endl; #ifdef DEBUGLOG static char s[1024]; char *s1 = s; s1 += sprintf(s1, "Exceeds membership capacity"); #endif } Address addr; decodeToAddress(&addr, id, port); log->logNodeAdd(&memberNode->addr, &addr); it = memberNode->memberList.end(); return --it; }
void CSVWriter::add(vector<string> scientist) { std::ofstream newEntry(fileName, std::ios_base::app);//appending a new entry to the document for(unsigned i = 0; i < scientist.size(); i++)//go over all the strings in the scientist vector { if(i == 1)//if "i = 1" then it is the sex and we make sure the new entry has the right output { if(scientist[i] == "70")//then the output is 70 is female or F { newEntry << "F"; } else { newEntry << "M";//and as we stand we havn't gotten to more of the sexes, so only other choise is male or M } newEntry << ","; } else { newEntry << scientist[i];//input the entry into the file at the end if(i < scientist.size()-1)//this is to make sure we don't put a comma at the end of the line { newEntry << ","; } } } newEntry << endl; //add a new line to the end of the doc }
static UA_StatusCode UA_NodeMap_getNodeCopy(void *context, const UA_NodeId *nodeid, UA_Node **outNode) { UA_NodeMap *ns = (UA_NodeMap*)context; BEGIN_CRITSECT(ns); UA_NodeMapEntry **slot = findOccupiedSlot(ns, nodeid); if(!slot) { END_CRITSECT(ns); return UA_STATUSCODE_BADNODEIDUNKNOWN; } UA_NodeMapEntry *entry = *slot; UA_NodeMapEntry *newItem = newEntry(entry->node.nodeClass); if(!newItem) { END_CRITSECT(ns); return UA_STATUSCODE_BADOUTOFMEMORY; } UA_StatusCode retval = UA_Node_copy(&entry->node, &newItem->node); if(retval == UA_STATUSCODE_GOOD) { newItem->orig = entry; // store the pointer to the original *outNode = &newItem->node; } else { deleteEntry(newItem); } END_CRITSECT(ns); return retval; }
static UA_Node * UA_NodeMap_newNode(void *context, UA_NodeClass nodeClass) { UA_NodeMapEntry *entry = newEntry(nodeClass); if(!entry) return NULL; return &entry->node; }
MLSymbolTable::MLSymbolTable() { mNullString = "[]"; MLSymbolMapT::iterator newEntryIter; std::pair<MLSymbolMapT::iterator, bool> newEntryRet; // make null symbol // insert key/ID pair into map, with ID=0 MLSymbolKey symKey("", 0); std::pair<MLSymbolKey, SymbolIDT> newEntry(symKey, 0); newEntryRet = mMap.insert(newEntry); newEntryIter = newEntryRet.first; // make key data local in map MLSymbolKey& newKey = const_cast<MLSymbolKey&>(newEntryIter->first); // make null string newKey.mpString = new std::string(); newKey.mpData = newKey.mpString->data(); // make new index list entry mIndexesByID[0] = 0; mStringsByID[0] = newKey.mpString; }
void QScriptStaticScopeObject::addSymbolTableProperty(const JSC::Identifier& name, JSC::JSValue value, unsigned attributes) { int index = growRegisterArray(1); JSC::SymbolTableEntry newEntry(index, attributes | JSC::DontDelete); symbolTable().add(name.ustring().rep(), newEntry); registerAt(index) = value; }
void QmlProfilerRangeModel::findBindingLoops() { typedef QPair<int, int> CallStackEntry; QStack<CallStackEntry> callStack; for (int i = 0; i < count(); ++i) { int potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; while (potentialParent != -1 && !(endTime(potentialParent) > startTime(i))) { callStack.pop(); potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; } // check whether event is already in stack for (int ii = 0; ii < callStack.size(); ++ii) { if (callStack.at(ii).first == typeId(i)) { m_data[i].bindingLoopHead = callStack.at(ii).second; break; } } CallStackEntry newEntry(typeId(i), i); callStack.push(newEntry); } }
void Cluster::addInst(DInst *dinst) { rdRegPool.add(2, dinst->getStatsFlag()); // 2 reads #ifdef ESESC_FUZE if (dinst->getInst()->hasDstRegister()) { #else if (dinst->getInst()->hasDstRegister()) { #endif wrRegPool.inc(dinst->getStatsFlag()); regPool--; } window.addInst(dinst); newEntry(); } //************ Executing Cluster void ExecutingCluster::executing(DInst *dinst) { window.wakeUpDeps(dinst); delEntry(); }
inline DirectoryEntry LocalServiceLocatorDataStore::MakeAccount( const std::string& name, const std::string& password, const DirectoryEntry& parent, const boost::posix_time::ptime& registrationTime) { bool accountExists; try { DirectoryEntry existingAccount = LoadAccount(name); accountExists = true; } catch(const ServiceLocatorDataStoreException&) { accountExists = false; } if(accountExists) { BOOST_THROW_EXCEPTION(ServiceLocatorDataStoreException( "An account with the specified name exists.")); } DirectoryEntry newEntry(DirectoryEntry::Type::ACCOUNT, m_nextId, name); ++m_nextId; m_accounts.push_back(newEntry); m_passwords.insert(std::make_pair(newEntry, HashPassword(newEntry, password))); m_registrationTimes.insert(std::make_pair(newEntry, registrationTime)); m_lastLoginTimes.insert(std::make_pair(newEntry, boost::posix_time::neg_infin)); Associate(newEntry, parent); return newEntry; }
void PstnPhoneBook::add( const QPhoneBookEntry& entry, const QString& store, bool flush ) { if ( store != "SM" ) { if ( flush ) getEntries( store ); return; } int index; for ( index = 0; index < ents.size(); ++index ) { if ( ents[index].number().isEmpty() ) break; } QPhoneBookEntry newEntry( entry ); newEntry.setIndex( (uint)index ); if ( index < ents.size() ) { ents[index] = newEntry; } else { ents += newEntry; } if ( flush ) getEntries( store ); }
void add(hash_t hash, uint32_t key) { uint32_t index = getBucketIndex(hash); auto* new_bucket = newEntry(); new_bucket->key = key; new_bucket->code = code_count++; new_bucket->next = hash_table[index]; hash_table[index] = new_bucket; }
void ReservationView::loadData(QList<QStringList> data) { resTable->setRowCount(data.size()); for(int i=0; i<data.size(); i++) for(int j=0; j<resTable->columnCount(); j++) resTable->setItem(i, j, newEntry(data[i][j])); }
bool EntryModel::insertRows(int row, int count, const QModelIndex &parent) { Q_UNUSED(count); beginInsertRows(parent, row, row); entryList.insert(row, newEntry()); endInsertRows(); return true; }
void ReservationView::loadData(QMap<quint32, Reservation> data) { resTable->setRowCount(data.size()); quint32 row = 0; QMap<quint32, Reservation>::const_iterator i = data.constBegin(); while (i != data.constEnd()) { resTable->setItem(row, 0, newEntry(QString::number(i.value().getID()))); resTable->setItem(row, 1, newEntry(QString::number(i.value().getItemID()))); resTable->setItem(row, 2, newEntry(QString::number(i.value().getCustomerID()))); resTable->setItem(row, 3, newEntry(i.value().getTimePeriod().getStartTime().toString(Qt::SystemLocaleShortDate))); resTable->setItem(row, 4, newEntry(i.value().getTimePeriod().getEndTime().toString(Qt::SystemLocaleShortDate))); ++row; ++i; } }
void ItemView::loadData(QMap<quint32, Item> data) { itemTable->setRowCount(data.size()); quint32 row = 0; QMap<quint32, Item>::const_iterator i = data.constBegin(); while (i != data.constEnd()) { itemTable->setItem(row, 0, newEntry(i.value().getName())); itemTable->setItem(row, 1, newEntry(QString::number(i.value().getID()))); itemTable->setItem(row, 2, newEntry(i.value().availableText())); itemTable->setItem(row, 3, newEntry(i.value().getDateAdded().toString(Qt::SystemLocaleShortDate))); ++row; ++i; } // itemTable->resizeColumnsToContents(); }
Status Heap1DatabaseCatalogEntry::Entry::prepareForIndexBuild( OperationContext* txn, const IndexDescriptor* spec ) { auto_ptr<IndexEntry> newEntry( new IndexEntry() ); newEntry->name = spec->indexName(); newEntry->spec = spec->infoObj(); newEntry->ready = false; newEntry->isMultikey = false; indexes[spec->indexName()] = newEntry.release(); return Status::OK(); }
// static SkPDFGraphicState* SkPDFGraphicState::GetGraphicStateForPaint(const SkPaint& paint) { SkAutoMutexAcquire lock(CanonicalPaintsMutex()); int index = Find(paint); if (index >= 0) { CanonicalPaints()[index].fGraphicState->ref(); return CanonicalPaints()[index].fGraphicState; } GSCanonicalEntry newEntry(new SkPDFGraphicState(paint)); CanonicalPaints().push(newEntry); return newEntry.fGraphicState; }
// Not thread-save, call from engine thread only void ReadAheadManager::addReadLogEntry(double virtualPlaypositionStart, double virtualPlaypositionEndNonInclusive) { ReadLogEntry newEntry(virtualPlaypositionStart, virtualPlaypositionEndNonInclusive); if (m_readAheadLog.size() > 0) { ReadLogEntry& last = m_readAheadLog.last(); if (last.merge(newEntry)) { return; } } m_readAheadLog.append(newEntry); }
/*! \reimp */ void QModemPhoneBook::update ( const QPhoneBookEntry& entry, const QString& store, bool flush ) { QModemPhoneBookCache *cache = findCache( store ); QPhoneBookEntry newEntry( entry ); newEntry.setNumber( fixPhoneBookNumber( entry.number() ) ); cache->opers = new QModemPhoneBookOperation ( QModemPhoneBookOperation::Update, newEntry, cache->opers ); if ( cache->fullyLoaded && flush ) { flushOperations( cache ); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->actionNewEntry, SIGNAL(triggered()), this, SLOT(newEntry())); connect(ui->actionChange_Password, SIGNAL(triggered()),this, SLOT(changePassword())); connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(tableViewClicked(QModelIndex))); db = init_db(); }
// --------------------------------------------------------------------------- // CMMCScBkupStateValidateDiskSpace::ConstructL() // // // --------------------------------------------------------------------------- void CMMCScBkupStateValidateDiskSpace::ConstructL( ) { for( TInt i = EDriveA; i<=EDriveZ; i++ ) { const TDriveNumber drive = static_cast< TDriveNumber >( i ); // Zero-initialize max. file sizing info arrays TMMCScBkupDriveAndSize newEntry( drive, 0 ); iDriveSizes.AppendL( newEntry ); TMMCScBkupDriveAndSize maxEntry( drive, 0 ); iDriveMaxFileSizes.AppendL( maxEntry ); } }
void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) { addRegisters(count); for (int i = 0; i < count; ++i) { GlobalPropertyInfo& global = globals[i]; ASSERT(global.attributes & DontDelete); int index = symbolTable()->size(); SymbolTableEntry newEntry(index, global.attributes); symbolTable()->add(global.identifier.impl(), newEntry); registerAt(index).set(vm(), this, global.value); } }
bool add(const StringVector& keyArray, const StringVector& valueArray) { bool bOk = true; if(keyArray.size() != valueArray.size()) return false; for(size_t i=0; i<keyArray.size(); i++) { const std::string& key = keyArray[i]; const std::string& value = valueArray[i]; bOk &= newEntry(key, value); } return bOk; }
/* * Function: * readEntryFile2LinkedList * * Description: * Reads the entries from a file and creates a linked list with * these entries in the inverse order. * * Arguments: * Pointer to the file stream: * FILE * fp * * Return value: * Pointer to the first node of the linked list. */ LinkedList * readEntryFile2LinkedList(FILE * fp, int parametro, int sentido) /*falta receber o ascendente e o tipo de ordenacao*/ { int id; int age; int height; int weight; LinkedList * lp; Entry * entry; /* Initialize linked list */ lp = initLinkedList(); /* Cycle through file rows */ while(fscanf(fp, "%d %d %d %d", &id, &age, &height, &weight) == 4) { /* Create new entry */ entry = newEntry(id, age, height, weight); /* Store entry in the linked list */ if( parametro == ID ){ if( sentido == ASCENDENTE ) lp = insertSortedLinkedList(lp,(Item) entry, &comparisonIdAsc); else lp = insertSortedLinkedList(lp,(Item) entry, &comparisonIdDesc); } else if( parametro == AGE ){ if( sentido == ASCENDENTE ) lp = insertSortedLinkedList(lp,(Item) entry, &comparisonAgeAsc); else lp = insertSortedLinkedList(lp,(Item) entry, &comparisonAgeDesc); } else if( parametro == HEIGHT ){ if( sentido == ASCENDENTE ) lp = insertSortedLinkedList(lp,(Item) entry, &comparisonHeightAsc); else lp = insertSortedLinkedList(lp,(Item) entry, &comparisonHeightDesc); } else { if( sentido == ASCENDENTE ) lp = insertSortedLinkedList(lp,(Item) entry, &comparisonWeightAsc); else lp = insertSortedLinkedList(lp,(Item) entry, &comparisonWeightDesc); } } return lp; }
int ProgramExecutable::addGlobalVar(JSGlobalObject* globalObject, const Identifier& ident, ConstantMode constantMode, FunctionMode functionMode) { // Try to share the symbolTable if possible SharedSymbolTable* symbolTable = globalObject->symbolTable(); UNUSED_PARAM(functionMode); int index = symbolTable->size(); SymbolTableEntry newEntry(index, (constantMode == IsConstant) ? ReadOnly : 0); if (functionMode == IsFunctionToSpecialize) newEntry.attemptToWatch(); SymbolTable::AddResult result = symbolTable->add(ident.impl(), newEntry); if (!result.isNewEntry) { result.iterator->value.notifyWrite(); index = result.iterator->value.getIndex(); } return index; }