void DQueue::DumpAvailPending() { for (TIdx i = iNextAvailToSync; i != iAvail->iIdx; ++i ) { DumpAvail( Slot(i) ); } }
FeatureTable::FeatureTable(FeatureClass* pFeatureClass, GraphicLayer* pFeatureLayer, QWidget* pParent) : QTableView(pParent), mpFeatureLayer(pFeatureLayer) { setContextMenuPolicy(Qt::CustomContextMenu); // Allow multiple uncontiguous selections. setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); // Alphanumerically sort string types. setSortingEnabled(true); QSortFilterProxyModel* pProxyModel = new AlphaNumericSortFilterProxyModel(); pProxyModel->setSourceModel(pFeatureClass); pProxyModel->setDynamicSortFilter(true); setModel(pProxyModel); // Want to select rows in the table, when features are selected from the view's layer. mpFeatureLayer.addSignal(SIGNAL_NAME(GraphicLayer, ObjectsSelected), Slot(this, &FeatureTable::selectRows)); // Want to select graphic objects in the view, when rows are selected in the table. // However do not want the above connection to be utilized when the graphic objects are selected, so instead of // overriding the selectionChanged method, a new slot is introduced which will prevent any duplicate graphic object // selection/deselection. if (selectionModel() != NULL) { VERIFYNR(connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectGraphicObjects(const QItemSelection&, const QItemSelection&)))); }
void DQueue::DumpUsedPending() { for (TIdx i = iNextUsedToRead; i != iUsed->iIdx; ++i ) { DumpUsed( Slot(i) ); } }
Token DQueue::GetBuf( TUint& aLen ) { TIdx usedIdx = iUsed->iIdx; ASSERT( ((TIdx)iNextUsedToRead) <= usedIdx ); if (usedIdx == ((TIdx)iNextUsedToRead)) { return 0; } TUint nextUsedSlot = Slot(iNextUsedToRead); TUint len = iUsed->iRing[nextUsedSlot].iLen; TUint descId = iUsed->iRing[nextUsedSlot].iId; ASSERT(descId<iCount); Token token = iToken[descId].iToken; SYBORG_VIRTIO_DEBUG( "GetBuf Q%x %x ..%x t%x D%x L%x OL%x", iId, iNextUsedToRead, usedIdx, token, descId, len, iToken[descId].iTotalLen ); ++iNextUsedToRead; FreeDescs( descId ); #ifdef ENABLE_QEMU_AUDIO_MODEL_BUG_WORKAROUND aLen = len?len:iToken[descId].iTotalLen; // @TODO kind of a hack to solve virtio-audio's failure to report len by syborg on the side of qemu #else aLen = len; #endif return token; }
void cSlotAreaAnvil::ShiftClicked(cPlayer & a_Player, int a_SlotNum, const cItem & a_ClickedItem) { if (a_SlotNum != 2) { super::ShiftClicked(a_Player, a_SlotNum, a_ClickedItem); UpdateResult(a_Player); return; } // Make a copy of the slot, distribute it among the other areas, then update the slot to contain the leftover: cItem Slot(*GetSlot(a_SlotNum, a_Player)); if (Slot.IsEmpty() || !CanTakeResultItem(a_Player)) { return; } m_ParentWindow.DistributeStack(Slot, a_Player, this, true); if (Slot.IsEmpty()) { Slot.Empty(); OnTakeResult(a_Player); } SetSlot(a_SlotNum, a_Player, Slot); // Some clients try to guess our actions and not always right (armor slots in 1.2.5), so we fix them: m_ParentWindow.BroadcastWholeWindow(); }
BOOL PEXPORT KppDDEPostAdvise(ATOMID idObjName, ATOMID idSlot) { OBJECTID idLink = FindLink(LinkName(idObjName, idSlot)); if (idLink) { ATOMID idTopic = Kpp_Get_SlotValue(OBJECT, idLink, Slot(idTopic)); HSZ hszTopic = AtomToHsz(idTopic); WORD wLen = KppGetAtomName(idObjName, return_buffer, RET_BUFFER_LEN); BOOL bRes = FALSE; HSZ hszItem; return_buffer[wLen++] = ':'; KppGetAtomName(idSlot, return_buffer + wLen, RET_BUFFER_LEN - wLen); hszItem = DdeCreateStringHandle(dwDDEInst, return_buffer, CP_WINANSI); if (hszTopic && hszItem) bRes = DdePostAdvise(dwDDEInst, hszTopic, hszItem); DdeFreeStringHandle(dwDDEInst, hszTopic); DdeFreeStringHandle(dwDDEInst, hszItem); return bRes; } return FALSE; }
void XYDataStore::StoreAdd(double x, double y, double weight) { // Update maximum/minimum values if (IsEmpty() || y > y_max) y_max = y; if (IsEmpty() || y < y_min) y_min = y; if (IsEmpty() || x > x_max) x_max = x; if (IsEmpty() || x < x_min) x_min = x; // Add point // TODO code: really should have a circular buffer here if (!slots.full()) slots.append() = Slot(x, y, weight); ++sum_n; // Add weighted point sum_weights += weight; sum_xw += x * weight; sum_yw += y * weight; }
static T get_something(cl_platform_id platform, cl_device_id device, T Slot::*member, thread_scoped_lock &slot_locker) { assert(platform != NULL); OpenCLCache &self = global_instance(); thread_scoped_lock cache_lock(self.cache_lock); pair<CacheMap::iterator,bool> ins = self.cache.insert( CacheMap::value_type(PlatformDevicePair(platform, device), Slot())); Slot &slot = ins.first->second; /* create slot lock only while holding cache lock */ if(!slot.mutex) slot.mutex = new thread_mutex; /* need to unlock cache before locking slot, to allow store to complete */ cache_lock.unlock(); /* lock the slot */ slot_locker = thread_scoped_lock(*slot.mutex); /* If the thing isn't cached */ if(slot.*member == NULL) { /* return with the caller's lock holder holding the slot lock */ return NULL; } /* the item was already cached, release the slot lock */ slot_locker.unlock(); return slot.*member; }
XERCES_CPP_NAMESPACE_USE ScriptingWidget::ScriptingWidget(const QString& strPlugInName, QWidget* parent) : QTextEdit(parent), mDropOccurring(false), mDisplayedOnce(false), mPrompt(strPlugInName + "> "), mCommandIndex(0), mMaxParagraphs(512), mInterpreterName(strPlugInName), mInterpreter(), mCommandStartPos(0), mExecutingCommand(false), mInteractive(false), mpPims(Service<PlugInManagerServices>().get(), SIGNAL_NAME(PlugInManagerServices, PlugInDestroyed), Slot(this, &ScriptingWidget::plugInDestroyed)) { // Initialization setFrameStyle(QFrame::NoFrame); setMinimumWidth(150); setUndoRedoEnabled(false); setFocus(); mpClearAction = new QAction("Clear", this); VERIFYNR(connect(mpClearAction, SIGNAL(triggered(bool)), this, SLOT(clearOutput()))); mpGlobalOutputAction = new QAction("Global Output Shown", this); mpGlobalOutputAction->setCheckable(true); VERIFYNR(connect(mpGlobalOutputAction, SIGNAL(triggered(bool)), this, SLOT(globalOutputChanged(bool)))); }
void LeastSquares::Add(double x, double y, double weight) { // Update maximum/minimum values if (IsEmpty() || y > y_max) y_max = y; if (IsEmpty() || y < y_min) y_min = y; if (IsEmpty() || x > x_max) x_max = x; if (IsEmpty() || x < x_min) x_min = x; // Add point // TODO code: really should have a circular buffer here if (!slots.full()) slots.append() = Slot(x, y, weight); ++sum_n; // Add weighted point sum_weights += weight; auto xw = x * weight; auto yw = y * weight; sum_xi += xw; sum_yi += yw; sum_xi_2 += Square(xw); sum_xi_yi += xw * yw; }
// // Implementation here is that descs are allocated from the one starting with lowest index, TInt DQueue::AddBuf( const TAddrLen aScatterList[], TUint32 aOutNum, TUint32 aInNum, Token aToken) { SYBORG_VIRTIO_DEBUG("AddBuf Q%x %x l%x %x,%x %x", iId, aScatterList[0].iAddr, aScatterList[0].iLen, aOutNum, aInNum, aToken ); TUint outLeft = aOutNum; TUint inLeft = aInNum; TInt first = -1; TInt last = -1; TUint totalLen = 0; // @TODO maintain freedescs counter to know if the below is going to success from the outset. // alloc and initialise descs for ( TUint i = 0, j = 0; (i < iCount) && (outLeft+inLeft); ++i ) { if (iDesc[i].iFlags == KFreeDescriptorMarker) { if (first<0) { first = i; } iDesc[i].iFlags = ((outLeft)? 0 : TRingDesc::EFlagWrite); iDesc[i].iNext = KFreeDescriptorMarker; iDesc[i].iAddr = aScatterList[j].iAddr; iDesc[i].iLen = aScatterList[j].iLen; totalLen += aScatterList[j].iLen; iToken[i].iToken = aToken; iToken[i].iTotalLen = 0; if ( last >=0 ) { iDesc[last].iNext = i; iDesc[last].iFlags |= TRingDesc::EFlagNext; } last = i; if (outLeft) { --outLeft; } else { --inLeft; } j++; } } if (outLeft+inLeft) // rollback descs if not all could have been claimed { if (first>=0) { FreeDescs(first); } SYBORG_VIRTIO_DEBUG("AddBuf Q%x - not ready", iId ); return KErrNotReady; } iToken[first].iTotalLen = totalLen; // fill a slot in avail ring iAvail->iRing[Slot(iAvail->iIdx)] = first; ++iAvail->iIdx; return KErrNone; }
BackgroundSuppressionShell::BackgroundSuppressionShell() : mCurrentFrame(0), mCurrentProgress(0.0), mProgressStep(1.0), mpRaster(NULL), mSingleForegroundMask(false), mpTemporaryBuffer(NULL) { setSubtype("Background Estimation"); setAbortSupported(true); setWizardSupported(true); mpAnimation.addSignal(SIGNAL_NAME(Animation, FrameChanged), Slot(this, &BackgroundSuppressionShell::processNextStreamingFrame)); }
Controller::Controller(void) { this->game = new Game(); this->board = new CheckerBoard(); this->previousSlotSelected = Slot(NO_SLOT, NO_SLOT); this->slotsToHighLight = new std::list<Slot>(); }
//________________________________________________________________ void CheckPort0Connection () { if (!Port0Connected ()) { SlotRefNum ref = ChooseDefaultSlot (); if (Slot(ref)) MidiConnectSlot (0, ref, TRUE); } }
void ScriptingWidget::showEvent(QShowEvent* pEvent) { if ((mInterpreter.get() == NULL) && (mInterpreterName.isEmpty() == false)) { Interpreter* pInterpreter = NULL; setReadOnly(true); std::vector<PlugIn*> plugIns = mpPims->getPlugInInstances(mInterpreterName.toStdString()); if (plugIns.empty() == false && dynamic_cast<InterpreterManager*>(plugIns.front()) != NULL) { mInterpreter = PlugInResource(plugIns.front()); } else { mInterpreter = PlugInResource(mInterpreterName.toStdString()); } InterpreterManager* pInterMgr = dynamic_cast<InterpreterManager*>(mInterpreter.get()); if (pInterMgr != NULL) { mInteractive = pInterMgr->isInteractiveEnabled(); pInterMgr->start(); QString startupMsg = QString::fromStdString(pInterMgr->getStartupMessage()); addOutputText(startupMsg, false, false); pInterMgr->attach(SIGNAL_NAME(InterpreterManager, InterpreterStarted), Slot(this, &ScriptingWidget::interpreterStarted)); pInterpreter = pInterMgr->getInterpreter(); } if (pInterpreter != NULL) { pInterpreter->attach(SIGNAL_NAME(Interpreter, OutputText), Slot(this, &ScriptingWidget::receiveOutput)); pInterpreter->attach(SIGNAL_NAME(Interpreter, ErrorText), Slot(this, &ScriptingWidget::receiveOutput)); setReadOnly(!mInteractive); } } // Append a prompt if the widget is shown for the first time if (mDisplayedOnce == false) { appendPrompt(); mDisplayedOnce = true; } // Show the widget QTextEdit::showEvent(pEvent); }
static int CloseDDELink(ATOMID idfName, WORD wType, OBJECTID idLink, LPVOID lpData) { HCONV hConv = *(HCONV *) lpData; ATOMID idConv = Kpp_Get_SlotValue(OBJECT, idLink, Slot(idConversation)); if (idConv && idConv != lpIDs->idNull) { Kpp_Set_SlotValue(wType, idLink, Slot(idConversation), NULLID, EXPATOM); Kpp_Set_SlotValue(wType, idLink, Slot(idDDEObject), NULLID, EXPATOM); Kpp_DeleteCO(wType, idLink); return 1; } else { LISTID idLinks = Kpp_Get_SlotListValue(wType, idLink, Slot(idLinks)); if (idLinks && idLinks != lpIDs->idNull) { WORD wLen = KppListLen(idLinks); int pos; idConv = KppAddAtomLong(hConv); pos = wLen > 0 ? KppGetElemPos(idLinks, idConv) : 0; if (pos) { KppRemoveNthElem(idLinks, pos); if (wLen == 1) Kpp_DeleteCO(wType, idLink); else Kpp_Set_SlotValue(wType, idLink, Slot(idLinks), idLinks, EXPLIST); return 1; } } } return -1; }
//_________________________________________________________ static SlotPtr FindSlot (SlotPtr list, short port) { while (list) { if (Slot(list->refNum) == port) return list; list = list->next; } return 0; }
void ScriptingWidget::interpreterStarted(Subject& subject, const std::string& signal, const boost::any& data) { Interpreter* pInterpreter = NULL; InterpreterManager* pInterMgr = dynamic_cast<InterpreterManager*>(mInterpreter.get()); if (pInterMgr != NULL) { pInterpreter = pInterMgr->getInterpreter(); QString startupMsg = QString::fromStdString(pInterMgr->getStartupMessage()); addOutputText(startupMsg, false, true); } if (pInterpreter != NULL) { pInterpreter->attach(SIGNAL_NAME(Interpreter, OutputText), Slot(this, &ScriptingWidget::receiveOutput)); pInterpreter->attach(SIGNAL_NAME(Interpreter, ErrorText), Slot(this, &ScriptingWidget::receiveOutput)); setReadOnly(!mInteractive); appendPrompt(); } }
void StreamBuffer::AllocMemory(u32 size) { // insert waiting slots for used memory for (int i = Slot(m_used_iterator); i < Slot(m_iterator); i++) { if (!m_fences[i]) { m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } } m_used_iterator = m_iterator; u32 start_fence = Slot(m_free_iterator) + 1; // if buffer is full if (m_iterator + size >= m_size) { // insert waiting slots in unused space at the end of the buffer for (int i = Slot(m_used_iterator); i < SYNC_POINTS; i++) { if (!m_fences[i]) { glDeleteSync(m_fences[i]); } m_fences[i] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } // move to the start m_used_iterator = m_iterator = 0; // offset 0 is always aligned // wait for space at the start start_fence = 0; } u32 end_fence = std::min(Slot(m_iterator + size), SYNC_POINTS - 1); for (u32 i = start_fence; i <= end_fence; i++) { if (m_fences[i]) { glClientWaitSync(m_fences[i], GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); glDeleteSync(m_fences[i]); m_fences[i] = 0; } } m_free_iterator = m_iterator + size; }
VoteProcessorUsingHash::Slot& VoteProcessorUsingHash::findSlotFromBucketOrChain(Bucket& bucket, const std::string& name) { for (auto& slot : bucket) { if (slot.first == name) { return slot; } } bucket.push_back(Slot(name, 0)); return bucket[bucket.size() - 1]; }
IdlProxy::IdlProxy() : mIdlRunning(false), mIdlExecuting(false), mpAppServices(Service<ApplicationServices>().get(), SIGNAL_NAME(ApplicationServices, ApplicationClosed), Slot(this, &IdlProxy::applicationClosed)), mGlobalOutputShown(false), mRunningScopedCommand(false) { spProxyHandle = this; }
void Controller::onSlotSelected(int x, int y) { this->slotsToHighLight->clear(); if(this->previousSlotSelected.x != NO_SLOT && this->previousSlotSelected.y != NO_SLOT) { game->movePiece(previousSlotSelected.x, previousSlotSelected.y, x, y); this->previousSlotSelected = Slot(NO_SLOT, NO_SLOT); } else { list<Slot> moves = game->getAvailableMovesForPiece(x, y); if (moves.size() > 0) { this->slotsToHighLight->insert(this->slotsToHighLight->end(), moves.begin(), moves.end()); this->previousSlotSelected = Slot(x, y); } } }
bool Hull::LoadSlot(const TiXmlNode * node, MessageSink &messageSink) { deque<Slot>::iterator iter; iter = Slots.insert(Slots.end(), Slot(node, Slots.size(), messageSink)); if (iter->IsAllowed(~CT_NONE) && iter->GetCount() > 0) return true; else { Slots.erase(iter); return false; } }
static int DeleteDDETask(ATOMID idfName, WORD wType, OBJECTID idTask, LPVOID lpData) { HCONV hConv = *(HCONV *) lpData; ATOMID idConv = Kpp_Get_SlotValue(OBJECT, idTask, Slot(idConversation)); HCONV hTaskConv; if (KppGetAtomLong(idConv, (long *) &hTaskConv) && hTaskConv == hConv) { Kpp_Set_SlotValue(wType, idTask, Slot(idTransaction), NULLID, EXPATOM); Kpp_Set_SlotValue(wType, idTask, Slot(idConversation), NULLID, EXPATOM); Kpp_DeleteCO(wType, idTask); return 1; } return -1; }
void SpectralLibraryManager::clearLibrary() { // detach from signatures and raster elements and destroy resampled raster elements (libraries) invalidateLibraries(); for (std::vector<Signature*>::iterator it = mSignatures.begin(); it != mSignatures.end(); ++it) { (*it)->detach(SIGNAL_NAME(Subject, Deleted), Slot(this, &SpectralLibraryManager::signatureDeleted)); } mSignatures.clear(); notify(SIGNAL_NAME(Subject, Modified)); }
void cSlotArea::MiddleClicked(cPlayer & a_Player, int a_SlotNum) { cItem Slot(*GetSlot(a_SlotNum, a_Player)); cItem & DraggingItem = a_Player.GetDraggingItem(); if (!a_Player.IsGameModeCreative() || Slot.IsEmpty() || !DraggingItem.IsEmpty()) { return; } DraggingItem = Slot; DraggingItem.m_ItemCount = DraggingItem.GetMaxStackSize(); }
LibraryEditDlg::~LibraryEditDlg() { int numSigs = mpTree->topLevelItemCount(); for (int index = 0; index < numSigs; ++index) { QVariant variant = mpTree->topLevelItem(index)->data(0, Qt::UserRole); if (variant.isValid()) { VERIFYNR(variant.value<Signature*>()->detach(SIGNAL_NAME(Subject, Deleted), Slot(this, &LibraryEditDlg::signatureDeleted))); } } }
void LibraryEditDlg::addSignatures(const std::vector<Signature*>& signatures) { for (std::vector<Signature*>::const_iterator it = signatures.begin(); it != signatures.end(); ++it) { // if not in list, add if (mpTree->findItems(QString::fromStdString((*it)->getName()), Qt::MatchExactly).isEmpty()) { QTreeWidgetItem* pItem = new QTreeWidgetItem(mpTree); pItem->setText(0, QString::fromStdString((*it)->getName())); pItem->setData(0, Qt::UserRole, QVariant::fromValue(*it)); VERIFYNR((*it)->attach(SIGNAL_NAME(Subject, Deleted), Slot(this, &LibraryEditDlg::signatureDeleted))); } } }
//_________________________________________________________ static void LMM2MS (SlotPtr slot, MIDIPacket *packet) { MidiEvPtr e; long n = packet->length; unsigned char *ptr = packet->data; while (n--) { e = MidiParseByte (&slot->in, *ptr++); if (e) { Port(e) = (Byte)Slot(slot->refNum); MidiSendIm (gRefNum, e); } } }
SpectralLibraryMatchResults::SpectralLibraryMatchResults() : mpExplorer(SIGNAL_NAME(SessionExplorer, AboutToShowSessionItemContextMenu), Slot(this, &SpectralLibraryMatchResults::updateContextMenu)) { DockWindowShell::setName(SpectralLibraryMatch::getNameLibraryMatchResultsPlugIn()); setSubtype("Results"); setVersion(SPECTRAL_VERSION_NUMBER); setCreator("Ball Aerospace & Technologies Corp."); setCopyright(SPECTRAL_COPYRIGHT); setShortDescription("Display results from matching in-scene spectra with a spectral library."); setDescription("Display results from matching in-scene spectra with signatures in a spectral library."); setDescriptorId("{0BD9C61F-1D1D-406f-B4F1-90AD1BB1BAA2}"); setProductionStatus(SPECTRAL_IS_PRODUCTION_RELEASE); }