本文整理汇总了C++中OsclMemAllocator::ALLOCATE方法的典型用法代码示例。如果您正苦于以下问题:C++ OsclMemAllocator::ALLOCATE方法的具体用法?C++ OsclMemAllocator::ALLOCATE怎么用?C++ OsclMemAllocator::ALLOCATE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsclMemAllocator
的用法示例。
在下文中一共展示了OsclMemAllocator::ALLOCATE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CPVInterfaceProxy
OSCL_EXPORT_REF CPVInterfaceProxy * CPVInterfaceProxy::NewL(
PVProxiedEngine& app
, Oscl_DefAlloc *alloc
, int32 stacksize
, uint32 nreserve1
, uint32 nreserve2
, int32 handlerPri
, int32 notifierPri)
//called under app thread context
{
OsclMemAllocator defallocL;
OsclAny *ptr = NULL;
if (alloc)
{
ptr = alloc->ALLOCATE(sizeof(CPVInterfaceProxy));
OsclError::LeaveIfNull(ptr);
}
else
{
ptr = defallocL.ALLOCATE(sizeof(CPVInterfaceProxy));
}
CPVInterfaceProxy *self = OSCL_PLACEMENT_NEW(ptr, CPVInterfaceProxy(app, alloc, stacksize));
int32 err;
err = self->CPVIConstructL(nreserve1, nreserve2, handlerPri, notifierPri);
if (err != OSCL_ERR_NONE)
{
self->Delete();
return NULL;
}
return self;
}
示例2:
bool
PVMFOMXEncPort::pvmiSetPortFormatSpecificInfoSync(OsclRefCounterMemFrag& aMemFrag)
{
if ((iConnectedPort) &&
(iTag == PVMF_OMX_ENC_NODE_PORT_TYPE_OUTPUT))
{
OsclAny* temp = NULL;
iConnectedPort->QueryInterface(PVMI_CAPABILITY_AND_CONFIG_PVUUID, temp);
PvmiCapabilityAndConfig *config = (PvmiCapabilityAndConfig*) temp;
/*
* Create PvmiKvp for capability settings
*/
if ((config) && (aMemFrag.getMemFragSize() > 0))
{
OsclMemAllocator alloc;
PvmiKvp kvp;
kvp.key = NULL;
kvp.length = oscl_strlen(PVMF_FORMAT_SPECIFIC_INFO_KEY) + 1; // +1 for \0
kvp.key = (PvmiKeyType)alloc.ALLOCATE(kvp.length);
if (kvp.key == NULL)
{
return false;
}
oscl_strncpy(kvp.key, PVMF_FORMAT_SPECIFIC_INFO_KEY, kvp.length);
kvp.value.key_specific_value = (OsclAny*)(aMemFrag.getMemFragPtr());
kvp.capacity = aMemFrag.getMemFragSize();
kvp.length = aMemFrag.getMemFragSize();
PvmiKvp* retKvp = NULL; // for return value
int32 err;
OSCL_TRY(err, config->setParametersSync(NULL, &kvp, 1, retKvp););