当前位置: 首页>>代码示例>>C++>>正文


C++ VRefParam::asTypedValue方法代码示例

本文整理汇总了C++中VRefParam::asTypedValue方法的典型用法代码示例。如果您正苦于以下问题:C++ VRefParam::asTypedValue方法的具体用法?C++ VRefParam::asTypedValue怎么用?C++ VRefParam::asTypedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VRefParam的用法示例。


在下文中一共展示了VRefParam::asTypedValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: walk_func

static void walk_func(VRefParam value, CVarRef key, CVarRef userdata,
                      const void *data) {
  CallCtx* ctx = (CallCtx*)data;
  Variant sink;
  TypedValue args[3];
  tvDup(*value->asTypedValue(), args[0]);
  tvDup(*key.asTypedValue(), args[1]);
  tvDup(*userdata.asTypedValue(), args[2]);
  g_vmContext->invokeFuncFew(sink.asTypedValue(), *ctx, 3, args);
}
开发者ID:vincentbdb,项目名称:hiphop-php,代码行数:10,代码来源:ext_array.cpp

示例2: ti_create

Object c_SetResultToRefWaitHandle::ti_create(CObjRef wait_handle, VRefParam ref) {
  TypedValue* var_or_cell = ref->asTypedValue();
  if (wait_handle.isNull()) {
    tvSetNull(*var_or_cell);
    return wait_handle;
  }

  if (!wait_handle.get()->getAttribute(ObjectData::IsWaitHandle)) {
    Object e(SystemLib::AllocInvalidArgumentExceptionObject(
        "Expected wait_handle to be an instance of WaitHandle or null"));
    throw e;
  }

  auto wh = static_cast<c_WaitHandle*>(wait_handle.get());

  // succeeded? set result to ref and give back succeeded wait handle
  if (wh->isSucceeded()) {
    tvSet(wh->getResult(), *var_or_cell);
    return wh;
  }

  // failed? reset ref and give back failed wait handle
  if (wh->isFailed()) {
    tvSetNull(*var_or_cell);
    return wh;
  }

  // it's still running so it must be WaitableWaitHandle
  auto child = static_cast<c_WaitableWaitHandle*>(wh);

  // import child into the current context, detect cross-context cycles
  auto session = AsioSession::Get();
  if (session->isInContext()) {
    child->enterContext(session->getCurrentContextIdx());
  }

  // make sure the reference is properly boxed so that we can store cell pointer
  if (UNLIKELY(var_or_cell->m_type != KindOfRef)) {
    tvBox(var_or_cell);
  }

  p_SetResultToRefWaitHandle my_wh = NEWOBJ(c_SetResultToRefWaitHandle)();
  my_wh->initialize(child, var_or_cell->m_data.pref);

  if (UNLIKELY(session->hasOnSetResultToRefCreateCallback())) {
    session->onSetResultToRefCreate(my_wh.get(), child);
  }

  return my_wh;
}
开发者ID:Bluarggag,项目名称:hhvm,代码行数:50,代码来源:set_result_to_ref_wait_handle.cpp

示例3: ti_create

Object c_SetResultToRefWaitHandle::ti_create(CObjRef wait_handle, VRefParam ref) {
  TypedValue* var_or_cell = ref->asTypedValue();
  if (wait_handle.isNull()) {
    tvSet(make_tv<KindOfNull>(), *var_or_cell);
    return wait_handle;
  }

  if (!wait_handle.get()->instanceof(c_WaitHandle::classof())) {
    Object e(SystemLib::AllocInvalidArgumentExceptionObject(
        "Expected wait_handle to be an instance of WaitHandle or null"));
    throw e;
  }

  c_WaitHandle* wh = static_cast<c_WaitHandle*>(wait_handle.get());

  // succeeded? set result to ref and give back succeeded wait handle
  if (wh->isSucceeded()) {
    tvSet(wh->getResult(), *var_or_cell);
    return wh;
  }

  // failed? reset ref and give back failed wait handle
  if (wh->isFailed()) {
    tvSet(make_tv<KindOfNull>(), *var_or_cell);
    return wh;
  }

  // it's still running so it must be WaitableWaitHandle
  c_WaitableWaitHandle* child_wh = static_cast<c_WaitableWaitHandle*>(wh);

  // make sure the reference is properly boxed so that we can store cell pointer
  if (UNLIKELY(var_or_cell->m_type != KindOfRef)) {
    tvBox(var_or_cell);
  }

  p_SetResultToRefWaitHandle my_wh = NEWOBJ(c_SetResultToRefWaitHandle)();
  my_wh->initialize(child_wh, var_or_cell->m_data.pref);

  AsioSession* session = AsioSession::Get();
  if (UNLIKELY(session->hasOnSetResultToRefCreateCallback())) {
    session->onSetResultToRefCreate(my_wh.get(), child_wh);
  }

  return my_wh;
}
开发者ID:Diego-Brocanelli,项目名称:hhvm,代码行数:45,代码来源:set_result_to_ref_wait_handle.cpp


注:本文中的VRefParam::asTypedValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。