本文整理汇总了C++中CArrRef::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrRef::copy方法的具体用法?C++ CArrRef::copy怎么用?C++ CArrRef::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrRef
的用法示例。
在下文中一共展示了CArrRef::copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ti_create
Object c_GenArrayWaitHandle::ti_create(const char* cls, CArrRef dependencies) {
Array deps = dependencies->copy();
for (ssize_t iter_pos = deps->iter_begin();
iter_pos != ArrayData::invalid_index;
iter_pos = deps->iter_advance(iter_pos)) {
TypedValue* current = deps->nvGetValueRef(iter_pos);
if (UNLIKELY(current->m_type == KindOfRef)) {
tvUnbox(current);
}
if (!c_WaitHandle::fromTypedValue(current) &&
!IS_NULL_TYPE(current->m_type)) {
Object e(SystemLib::AllocInvalidArgumentExceptionObject(
"Expected dependencies to be an array of WaitHandle instances"));
throw e;
}
}
Object exception;
for (ssize_t iter_pos = deps->iter_begin();
iter_pos != ArrayData::invalid_index;
iter_pos = deps->iter_advance(iter_pos)) {
TypedValue* current = deps->nvGetValueRef(iter_pos);
if (IS_NULL_TYPE(current->m_type)) {
// {uninit,null} yields null
tvWriteNull(current);
continue;
}
assert(current->m_type == KindOfObject);
assert(dynamic_cast<c_WaitHandle*>(current->m_data.pobj));
auto child = static_cast<c_WaitHandle*>(current->m_data.pobj);
if (child->isSucceeded()) {
tvSetIgnoreRef(child->getResult(), current);
} else if (child->isFailed()) {
putException(exception, child->getException());
} else {
assert(dynamic_cast<c_WaitableWaitHandle*>(child));
auto child_wh = static_cast<c_WaitableWaitHandle*>(child);
c_GenArrayWaitHandle* my_wh = NEWOBJ(c_GenArrayWaitHandle)();
my_wh->initialize(exception, deps, iter_pos, child_wh);
return my_wh;
}
}
if (exception.isNull()) {
TypedValue tv;
tv.m_type = KindOfArray;
tv.m_data.parr = deps.get();
return c_StaticResultWaitHandle::Create(&tv);
} else {
return c_StaticExceptionWaitHandle::Create(exception.get());
}
}