本文整理汇总了C++中MpResource::handleMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ MpResource::handleMessage方法的具体用法?C++ MpResource::handleMessage怎么用?C++ MpResource::handleMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MpResource
的用法示例。
在下文中一共展示了MpResource::handleMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEnable
// Handle the FLOWGRAPH_ENABLE message.
// Returns TRUE if the message was handled, otherwise FALSE.
UtlBoolean MpFlowGraphBase::handleEnable(void)
{
int i;
MpFlowGraphMsg msg(MpFlowGraphMsg::RESOURCE_ENABLE);
MpResource* pResource;
// iterate over all resources
// invoke the enable() method for each resource in the flow graph
for (i=0; i < mResourceCnt; i++)
{
// iterate through the resources
pResource = mUnsorted[i];
// make each resource handle a RESOURCE_ENABLE message
msg.setMsgDest(pResource);
if (!pResource->handleMessage(msg))
{
assert(FALSE);
return FALSE;
}
}
return TRUE;
}
示例2: handleSetSamplesPerSec
// Handle the FLOWGRAPH_SET_SAMPLES_PER_SEC message.
// Returns TRUE if the message was handled, otherwise FALSE.
UtlBoolean MpFlowGraphBase::handleSetSamplesPerSec(int samplesPerSec)
{
int i;
MpFlowGraphMsg msg(MpFlowGraphMsg::RESOURCE_SET_SAMPLES_PER_SEC,
NULL, NULL, NULL, samplesPerSec);
MpResource* pResource;
// iterate over all resources
for (i=0; i < mResourceCnt; i++)
{
pResource = mUnsorted[i];
// make each resource handle a SET_SAMPLES_PER_SEC message
msg.setMsgDest(pResource);
if (!pResource->handleMessage(msg))
{
assert(FALSE);
return FALSE;
}
}
mSamplesPerSec = samplesPerSec;
return TRUE;
}
示例3: processMessages
// Processes all of the messages currently queued for this flow graph.
// For now, this method always returns OS_SUCCESS.
OsStatus MpFlowGraphBase::processMessages(void)
{
OsWriteLock lock(mRWMutex);
UtlBoolean done;
UtlBoolean handled;
static MpFlowGraphMsg* pStopMsg = NULL;
MpResource* pMsgDest;
OsStatus res;
// First, we send ourselves a FLOWGRAPH_PROCESS_FRAME message.
// This message serves as a "stopper" in the message queue. When we
// handle that message, we know that we have processed all of the messages
// for the flowgraph (and its resources) that had arrived prior to the
// start of this frame processing interval.
if (NULL == pStopMsg) {
pStopMsg = new MpFlowGraphMsg(MpFlowGraphMsg::FLOWGRAPH_PROCESS_FRAME);
pStopMsg->setReusable(TRUE);
}
res = postMessage(*pStopMsg);
assert(res == OS_SUCCESS);
done = FALSE;
while (!done)
{
// get the next message
OsMsg* pMsg ;
res = mMessages.receive(pMsg, OsTime::NO_WAIT);
assert(res == OS_SUCCESS);
if (pMsg->getMsgType() == OsMsg::MP_FLOWGRAPH_MSG)
{
MpFlowGraphMsg* pRcvdMsg = (MpFlowGraphMsg*) pMsg ;
// determine if this message is intended for a resource in the
// flow graph (as opposed to a message for the flow graph itself)
pMsgDest = pRcvdMsg->getMsgDest();
if (pMsgDest != NULL)
{
// deliver the message if the resource is still part of this graph
if (pMsgDest->getFlowGraph() == this)
{
handled = pMsgDest->handleMessage(*pRcvdMsg);
assert(handled);
}
}
else
{
// since pMsgDest is NULL, this msg is intended for the flow graph
switch (pRcvdMsg->getMsg())
{
case MpFlowGraphMsg::FLOWGRAPH_PROCESS_FRAME:
done = TRUE; // "stopper" message encountered -- we are done
break; // processing messages for this frame interval
default:
handled = handleMessage(*pRcvdMsg);
assert(handled);
break;
}
}
pRcvdMsg->releaseMsg(); // free the msg
}
else
{
handled = handleMessage(*pMsg);
assert(handled);
pMsg->releaseMsg() ;
}
}
return OS_SUCCESS;
}