本文整理汇总了C++中MpResource::maxInputs方法的典型用法代码示例。如果您正苦于以下问题:C++ MpResource::maxInputs方法的具体用法?C++ MpResource::maxInputs怎么用?C++ MpResource::maxInputs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MpResource
的用法示例。
在下文中一共展示了MpResource::maxInputs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addVirtualInputs
int MpTopologyGraph::addVirtualInputs(MpResourceTopology& resourceTopology,
UtlHashBag& newResources,
UtlBoolean replaceNumInName,
int resourceNum)
{
int portsAdded = 0;
MpResourceTopology::VirtualPortIterator portIter;
UtlString realResourceName;
int realPortIdx;
UtlString virtualResourceName;
int virtualPortIdx;
resourceTopology.initVirtualInputIterator(portIter);
while (resourceTopology.getNextVirtualInput(portIter,
realResourceName, realPortIdx,
virtualResourceName, virtualPortIdx)
== OS_SUCCESS)
{
if(replaceNumInName)
{
MpResourceTopology::replaceNumInName(realResourceName, resourceNum);
MpResourceTopology::replaceNumInName(virtualResourceName, resourceNum);
}
// Lookup real resource.
MpResource *pResource = (MpResource*)newResources.find(&realResourceName);
assert(pResource);
if (!pResource)
{
continue;
}
// Check port index correctness. Note, that this check gracefully
// handles case with realPortIdx equal -1.
if (realPortIdx >= pResource->maxInputs())
{
assert(!"Trying to map virtual port to non existing real port!");
continue;
}
// Add entry to virtual ports map.
// We need to create UtlVoidPtr wrapper for pResource, or it will be
// destroyed on pair deletion.
UtlContainablePair *pRealPort = new UtlContainablePair(new UtlVoidPtr(pResource),
new UtlInt(realPortIdx));
UtlContainablePair *pVirtPort = new UtlContainablePair(new UtlString(virtualResourceName),
new UtlInt(virtualPortIdx));
mVirtualInputs.insertKeyAndValue(pVirtPort, pRealPort);
portsAdded++;
}
resourceTopology.freeVirtualInputIterator(portIter);
return portsAdded;
}
示例2: addLink
// Creates a link between the "outPortIdx" port of the "rFrom" resource
// to the "inPortIdx" port of the "rTo" resource.
// If the flow graph is not "started", this call takes effect immediately.
// Otherwise, the call takes effect at the start of the next frame processing
// interval.
// Returns OS_SUCCESS if the link was successfully added. Returns
// OS_INVALID_ARGUMENT if the caller specified an invalid port index.
// Returns OS_UNSPECIFIED if the addLink attempt failed for some other
// reason.
OsStatus MpFlowGraphBase::addLink(MpResource& rFrom, int outPortIdx,
MpResource& rTo, int inPortIdx)
{
OsWriteLock lock(mRWMutex);
UtlBoolean handled;
MpFlowGraphMsg msg(MpFlowGraphMsg::FLOWGRAPH_ADD_LINK, NULL,
&rFrom, &rTo, outPortIdx, inPortIdx);
if (outPortIdx < 0 || outPortIdx >= rFrom.maxOutputs() ||
inPortIdx < 0 || inPortIdx >= rTo.maxInputs())
return OS_INVALID_ARGUMENT;
if (mCurState == STARTED)
return postMessage(msg);
handled = handleMessage(msg);
if (handled)
return OS_SUCCESS;
else
return OS_UNSPECIFIED;
}