本文整理汇总了C++中Queue函数的典型用法代码示例。如果您正苦于以下问题:C++ Queue函数的具体用法?C++ Queue怎么用?C++ Queue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Queue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Flush
HRESULT CStreamParser::Parse(const GUID &gSubtype, Packet *pPacket)
{
if (gSubtype != m_gSubtype) {
m_gSubtype = gSubtype;
Flush();
}
if (!pPacket || (pPacket->dwFlags & LAV_PACKET_PARSED)) {
Queue(pPacket);
} else if (m_gSubtype == MEDIASUBTYPE_AVC1 && (m_strContainer == "mpegts" || pPacket->dwFlags & LAV_PACKET_H264_ANNEXB)) {
ParseH264AnnexB(pPacket);
} else if (m_gSubtype == MEDIASUBTYPE_HDMVSUB) {
ParsePGS(pPacket);
} else if (m_gSubtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
pPacket->RemoveHead(4);
Queue(pPacket);
} else if (pPacket->dwFlags & LAV_PACKET_MOV_TEXT) {
ParseMOVText(pPacket);
} else if (m_strContainer == "avi" && m_gSubtype == MEDIASUBTYPE_ASS) {
ParseRawSSA(pPacket);
} else if (m_gSubtype == MEDIASUBTYPE_AAC && (m_strContainer != "matroska" && m_strContainer != "mp4")) {
ParseAAC(pPacket);
} else if (m_gSubtype == MEDIASUBTYPE_UTF8 && (pPacket->dwFlags & LAV_PACKET_SRT)) {
ParseSRT(pPacket);
} else {
Queue(pPacket);
}
return S_OK;
}
示例2: Queue
bool FCircularQueueTest::RunTest( const FString& Parameters )
{
const uint32 QueueSize = 8;
// empty queue
{
TCircularQueue<int32> Queue(QueueSize);
TestTrue(TEXT("Newly created queues must be empty"), Queue.IsEmpty());
TestFalse(TEXT("Newly created queues must not be full"), Queue.IsFull());
}
// partially filled
{
TCircularQueue<int32> Queue(QueueSize);
int32 Value;
TestTrue(TEXT("Adding to an empty queue must succeed"), Queue.Enqueue(666));
TestFalse(TEXT("Partially filled queues must not be empty"), Queue.IsEmpty());
TestFalse(TEXT("Partially filled queues must not be full"), Queue.IsFull());
TestTrue(TEXT("Peeking at a partially filled queue must succeed"), Queue.Peek(Value));
}
// full queue
{
TCircularQueue<int32> Queue(QueueSize);
for (int32 Index = 0; Index < QueueSize - 1; ++Index)
{
TestTrue(TEXT("Adding to non-full queue must succeed"), Queue.Enqueue(Index));
}
TestFalse(TEXT("Full queues must not be empty"), Queue.IsEmpty());
TestTrue(TEXT("Full queues must be full"), Queue.IsFull());
TestFalse(TEXT("Adding to full queue must fail"), Queue.Enqueue(666));
int32 Value;
for (int32 Index = 0; Index < QueueSize - 1; ++Index)
{
TestTrue(TEXT("Peeking at a none-empty queue must succeed"), Queue.Peek(Value));
TestEqual(TEXT("The peeked at value must be correct"), Value, Index);
TestTrue(TEXT("Removing from a non-empty queue must succeed"), Queue.Dequeue(Value));
TestEqual(TEXT("The removed value must be correct"), Value, Index);
}
TestTrue(TEXT("A queue that had all items removed must be empty"), Queue.IsEmpty());
TestFalse(TEXT("A queue that had all items removed must not be full"), Queue.IsFull());
}
return true;
}
示例3: Queue
u64 RuntimeQueue::Queue(
ThreadId const& targetThread, RuntimeTask&& task, rqe& ec)
{
if(!VerifyTask(task, ec))
return 0;
if(task.flags & RuntimeTask::Periodic)
{
task.time = RuntimeTask::clock::now() + task.interval;
}
if(!context->globalMod.try_lock())
{
ec = RQE::ShuttingDown;
return 0;
}
auto thread_id = targetThread.hash();
auto q_it = context->queues.find(thread_id);
if(q_it == context->queues.end())
{
context->globalMod.unlock();
ec = RQE::InvalidQueue;
return 0;
} else
{
context->globalMod.unlock();
return Queue(&q_it->second, std::move(task), ec);
}
}
示例4: Queue
OsclReturnCode FillBufferDoneThreadSafeCallbackAOEnc::ReceiveEvent(OMX_OUT OMX_HANDLETYPE aComponent,
OMX_OUT OMX_PTR aAppData,
OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
{
// Note: this method executes in the context of remote thread trying to make the callback
OsclReturnCode status;
OsclProcStatus::eOsclProcError sema_status;
// Wait on the remote thread control semaphore. If the queue is full, must block and wait
// for the AO to dequeue some previous event. If the queue is not full, proceed
sema_status = RemoteThreadCtrlSema.Wait();
if (sema_status != OsclProcStatus::SUCCESS_ERROR)
return OsclFailure;
// NOTE: the semaphore will prevent the mempool allocate to be used if the queue is full
// allocate the memory for the callback event specific data
FillBufferDoneSpecificData* ED = (FillBufferDoneSpecificData*) iMemoryPool->allocate(sizeof(FillBufferDoneSpecificData));
// pack the relevant data into the structure
ED->hComponent = aComponent;
ED->pAppData = aAppData;
ED->pBuffer = aBuffer;
// convert the pointer into OsclAny ptr
OsclAny* P = (OsclAny*) ED;
// now , queue the event pointer
status = Queue(P);
return status;
}
示例5: LOG_COMMANDS
// Delete all in folder, then folder itself
void CImImap4Compound::DeleteFolderL(TRequestStatus& aStatus, const TMsvId aSource)
{
LOG_COMMANDS((iSession->LogText(_L8("COMPOUND DeleteFolder(%x)"),aSource)));
Queue(aStatus);
// Save parameters
iSourceFolder=aSource;
iSequence=SeqDeleteFolder;
// The folder might be a mailbox (in which case it needs selecting, messages
// deleting, closing, then deletion of the folder) or it might be a \Noselect
// folder, which we just delete.
User::LeaveIfError(iEntry->SetEntry(aSource));
TMsvEmailEntry folder=iEntry->Entry();
if (!folder.Mailbox())
{
DBG((iSession->LogText(_L8("Folder is marked \\NoSelect: just delete it"))));
// Skip the first few steps
iStep=2;
}
else
{
DBG((iSession->LogText(_L8("Folder is a mailbox: deleting messages and folder"))));
// Start from folder selection
iStep=0;
}
DoRunL();
}
示例6: DBG
void CImImap4Compound::GenericCopyL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel, const TMsvId aDestination, TInt* aSequence)
{
DBG((iSession->LogText(_L8("CImImap4Compound::GenericCopyL()"))));
Queue(aStatus);
// Save parameters
iSource=aSourceSel[0];
delete iSourceSel;
iSourceSel = NULL;
iSourceSel=aSourceSel.CopyL();
iDestinationFolder=aDestination;
iMessageSelection=iSelectionStillToCopy=iSelectionStillToDelete=aSourceSel.Count();
// Check that selection elements are contiguous. Just call Copy on contiguous selections.
iSourceFolder=FindFolderL((*iSourceSel)[iSelectionStillToCopy-1]);
// Find the offending source folder
if (iSourceFolder == NULL &&
aSequence != SeqMoveFromLocal && aSequence != SeqCopyFromLocal)
{
Complete(KErrNotFound);
return;
}
// Select it
iStep=0;
iSequence=aSequence;
DoRunL();
}
示例7: Queue
void CCmdUndertaker::RunL()
{
TInt handle = iDeadThreadHandle;
Queue(); // Queue early, to try and avoid missing notifications
// We don't use the RunL if we're in paranoid mode - the undertaker notifications are serviced directly in DoWork() without an active scheduler
ProcessHandle(handle);
}
示例8: __LOG_TEXT
/**
Resumes the operation following a migration.
*/
void CImapCompoundDeleteFolder::ResumeOperationL(TRequestStatus& aStatus, CImapSession& aSession)
{
iSession = &aSession;
__LOG_TEXT(iSession->LogId(), "CImapCompoundDeleteFolder::Resuming");
__ASSERT_DEBUG(iCurrentStep==ESuspendedForMigrate, TImapServerPanic::ImapPanic(TImapServerPanic::EDeleteCompoundUnexpectedState));
iStopForMigrate = EFalse;
// Switch on next step - some "next steps" require a SELEECT first...
switch (iNextStep)
{
case ESelectSourceMailboxRW:
case EDeleteFolder:
{
// just return to the main state machine
CompleteSelf();
break;
}
case EDeleteAllMessages:
case ECloseFolder:
case EDeleteLocalFolder:
case EFinished:
// not expected
default:
{
__ASSERT_DEBUG(EFalse, TImapServerPanic::ImapPanic(TImapServerPanic::EDeleteCompoundUnexpectedState));
// abandon the compound operation
iNextStep=EFinished;
CompleteSelf();
break;
}
}
Queue(aStatus);
}
示例9: OstTraceDef0
void CSmsMessageSend::Start(CSmsMessage& aSmsMessage, TInt aOptions,
const TSmsAddr& aSmsAddr, TRequestStatus& aStatus)
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGESEND_START_1, "CSmsMessageSend::Start()");
__ASSERT_DEBUG(iState == ESmsMessageSendIdle,SmspPanic(KSmspPanicUnexpectedState));
//
// Store the request status that we will complete when finished...
//
Queue(aStatus);
//
// Initialise member data...
//
iSmsMessage=&aSmsMessage;
iSmsMessage->ParsedToFromAddress(iToFromTelNumber);
iOptions = aOptions;
iSmsAddr = aSmsAddr;
iSmsPDUData.iType = aSmsMessage.Type();
iSmsPDUData.iTotal = 0;
iSmsPDUData.iSent = 0;
iSmsPDUData.iDelivered = 0;
iSendError = KErrNone;
iSmsEventLogger->Event().SetId(KLogNullId);
//
// Begin by setting the bearer...
//
iState = ESmsMessageSendSetBearer;
iSmspSetBearer.NotifyBearerSet(iStatus);
SetActive();
} // CSmsMessageSend::Start
示例10: while
Queue<T>& Queue<T>::operator=(const Queue<T>& other)
{
Node * nodePointer = head;
Node * tempPointer = 0;
while (nodePointer)
{
tempPointer = nodePointer;
nodePointer = nodePointer->next;
delete tempPointer;
}
head = 0;
if (!other.head)
{
Queue();
return *this;
}
else
{
Node * otherPointer = other.head;
while (otherPointer)
{
enqueue(otherPointer->element);
otherPointer = otherPointer->next;
}
}
return *this;
}
示例11: QuitSession
/**
Deletes a session.
@param aSession The session to delete. This routine takes immediate ownsership
of the session.
@param aClientStatus Signals completion of the request
*/
void CPopSessionManager::DeleteSession(CImPop3Session& aSession,
TRequestStatus& aClientStatus)
{
iSession = &aSession;
QuitSession();
Queue(aClientStatus);
}
示例12: __LOG_TEXT
void CImapCompoundDelete::StartOperation(TRequestStatus& aStatus, CImapSession& aSession)
{
iSession = &aSession;
__LOG_TEXT(iSession->LogId(), "CImapCompoundDelete::StartOperation()");
iNextStep = ESelectSourceMailboxRW;
Queue(aStatus);
CompleteSelf();
}
示例13: Queue
void CSvgtRasterizerOOMPropertyMonitor::ConstructL()
{
if (CActiveScheduler::Current())
{
User::LeaveIfError(iOomWatcher.Attach(KSvgtPropertyCategory, ESvgtPropertyBool));
Queue();
}
}
示例14: msg
void Lurker::ShowYesNo(const std::string& q, const Colour& fgCol, const Colour& bgCol,
CommandFunc no, CommandFunc yes)
{
LurkMsg msg(q, fgCol, bgCol,AMJU_CENTRE, 0);
msg.SetNoCommand(no);
msg.SetYesCommand(yes);
Queue(msg);
}
示例15: Queue
void CImapOpSyncSubs::SynchroniseSubscriptionsL(TRequestStatus& aStatus)
{
// Do we need to know what folders are subscribed remotely?
if (iImapSettings.Synchronise() == EUseLocal &&
(iImapSettings.Subscribe() == EUpdateNeither || iImapSettings.Subscribe() == EUpdateLocal))
{
// Just update any remote subscriptions
iNextSyncAction = CImapSyncManager::EUpdateRemoteSubscription;
Queue(aStatus);
CompleteSelf();
SetActive();
}
else
{
// Update our list of remotely subscribed folders
// First, we need to go through the entire service, resetting all
// the 'remote subscribed' flags.
ResetSubscriptionFlagsL(iServiceId);
// Build a buffer to quote the folder path (it may be necessary)
HBufC16* path=HBufC16::NewLC(iImapSettings.FolderPath().Length()+2);
path->Des().Copy(iImapSettings.FolderPath());
if (iImapSettings.FolderPath().Length())
{
path->Des().Append(iImapSettings.PathSeparator());
}
path->Des().Append(KStarChar);
// Quote it
CImapFolder::DoQuoteL(path);
// List this tree
iNextSyncAction = CImapSyncManager::EProcessRemoteSubscription;
iServerEntry.SetEntry(iServiceId);
TMsvEmailEntry entry = iServerEntry.Entry();
iSession.LsubL(iStatus, KNullDesC, path->Des(), iImapListFolderInfo);
Queue(aStatus);
SetActive();
CleanupStack::PopAndDestroy(path);
}
}