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


C++ empty_array函数代码示例

本文整理汇总了C++中empty_array函数的典型用法代码示例。如果您正苦于以下问题:C++ empty_array函数的具体用法?C++ empty_array怎么用?C++ empty_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: trie_tree_create_end

trie_tree* trie_tree_create_end()
{
  assert(be_creating);
  assert(!be_inserting);
  trie_tree* tree = (trie_tree*)malloc(sizeof(trie_tree));
  init_array(&tree->node_array, sizeof(trie_node));
  init_array(&successor_array, sizeof(trie_successor));
  append_array(&tree->node_array, 2);
  memset(get_array_elem(&tree->node_array, 0), 0, sizeof(trie_node)*2);
  trie_node* head_node = (trie_node*)get_array_elem(&tree->node_array, HEAD_INDEX);
  head_node->check = HEAD_CHECK;
  head_node->base = HEAD_INDEX;
  for(int input_index = 0; input_index<input_cache.len; input_index++)
  {
    int prefix_index, node_index, base_index;
    trie_input* input_node = (trie_input*)get_array_elem(&input_cache, input_index);
    while( find_prefix(tree, input_node->str, &prefix_index, &node_index) )
    {
      get_all_successors(input_node->str, prefix_index, input_index);
      base_index = find_base_index_by_successors(tree, node_index);
      insert_successors(tree, base_index, node_index);
    }
    mark_word_node(tree, node_index);
  }
  empty_array(&input_cache);
  empty_array(&successor_array);
  be_creating = false;
  return tree;
}
开发者ID:xiaozhewei,项目名称:trie,代码行数:29,代码来源:Trie.cpp

示例2: trie_tree_insert_end

void trie_tree_insert_end(trie_tree* tree)
{
  assert(!be_creating);
  assert(be_inserting);
  init_array(&successor_array, sizeof(trie_successor));
  for(int input_index = 0; input_index<input_cache.len; input_index++)
  {
    int prefix_index, node_index;
    trie_input* input_node = (trie_input*)get_array_elem(&input_cache, input_index);
    while( find_prefix(tree, input_node->str, &prefix_index, &node_index) )
    {
      int base_index = abs(((trie_node*)get_array_elem(&tree->node_array, node_index))->base);
      get_all_successors(input_node->str, prefix_index, input_index);
      delete_existing_successors(tree, node_index);
      if(base_index == node_index || !check_insert_successors(tree, node_index) )
      {
        reset_successors(tree, node_index);
        base_index = find_base_index_by_successors(tree, node_index);
      }
      insert_successors(tree, base_index, node_index);
    }
    mark_word_node(tree, node_index);
  }
  print_node(tree, 1, 0);
  empty_array(&input_cache);
  empty_array(&successor_array);
  be_inserting = false;
}
开发者ID:xiaozhewei,项目名称:trie,代码行数:28,代码来源:Trie.cpp

示例3: HHVM_FUNCTION

Array HHVM_FUNCTION(heapgraph_node_in_edges,
  const Resource& resource,
  int64_t index
) {
  auto hgptr = get_valid_heapgraph_context_resource(resource, __FUNCTION__);
  if (!hgptr) return empty_array();
  if (index < 0 || index >= (hgptr->hg.nodes.size())) return empty_array();
  Array result;
  hgptr->hg.eachPredPtr(index, [&](int ptr) {
    result.append(createPhpEdge(hgptr, ptr));
  });
  return result;
}
开发者ID:neuroidss,项目名称:hhvm,代码行数:13,代码来源:ext_heapgraph.cpp

示例4: runCallback

void AsioSession::onIOWaitExit() {
  runCallback(
    m_onIOWaitExitCallback,
    empty_array(),
    "WaitHandle::onIOWaitExit"
  );
}
开发者ID:bsmr-misc-forks,项目名称:hhvm,代码行数:7,代码来源:asio_session.cpp

示例5: switch

Array Variant::toArrayHelper() const {
    switch (m_type) {
    case KindOfUninit:
    case KindOfNull:
        return empty_array();
    case KindOfBoolean:
        return Array::Create(*this);
    case KindOfInt64:
        return Array::Create(m_data.num);
    case KindOfDouble:
        return Array::Create(*this);
    case KindOfStaticString:
    case KindOfString:
        return Array::Create(Variant{m_data.pstr});
    case KindOfPersistentArray:
    case KindOfArray:
        return Array(m_data.parr);
    case KindOfObject:
        return m_data.pobj->toArray();
    case KindOfResource:
        return m_data.pres->data()->o_toArray();
    case KindOfRef:
        return m_data.pref->var()->toArray();
    case KindOfClass:
        break;
    }
    not_reached();
}
开发者ID:derickr,项目名称:hhvm,代码行数:28,代码来源:type-variant.cpp

示例6: getDependencyStack

Array c_WaitableWaitHandle::getDependencyStack() {
  if (isFinished()) return empty_array();
  Array result = Array::Create();
  hphp_hash_set<c_WaitableWaitHandle*> visited;
  auto current_handle = this;
  auto session = AsioSession::Get();
  while (current_handle != nullptr) {
    result.append(Variant{current_handle});
    visited.insert(current_handle);
    auto context_idx = current_handle->getContextIdx();

    // 1. find parent in the same context
    auto p = current_handle->getParentChain().firstInContext(context_idx);
    if (p && visited.find(p) == visited.end()) {
      current_handle = p;
      continue;
    }

    // 2. cross the context boundary
    auto context = session->getContext(context_idx);
    if (!context) {
      break;
    }
    current_handle = c_ResumableWaitHandle::getRunning(context->getSavedFP());
    auto target_context_idx =
      current_handle ? current_handle->getContextIdx() : 0;
    while (context_idx > target_context_idx) {
      --context_idx;
      result.append(null_object);
    }
  }
  return result;
}
开发者ID:facebook,项目名称:hhvm,代码行数:33,代码来源:ext_waitable-wait-handle.cpp

示例7: HHVM_FUNCTION

Array HHVM_FUNCTION(stream_get_filters) {
  auto filters = s_stream_user_filters.get()->m_registeredFilters;
  if (UNLIKELY(filters.isNull())) {
    return empty_array();
  }
  return array_keys_helper(filters.filtersAsArray()).toArray();
}
开发者ID:292388900,项目名称:hhvm,代码行数:7,代码来源:ext_stream-user-filters.cpp

示例8: HHVM_FUNCTION

static Array HHVM_FUNCTION(xenon_get_data, void) {
  if (RuntimeOption::XenonForceAlwaysOn ||
      RuntimeOption::XenonPeriodSeconds > 0) {
    TRACE(1, "xenon_get_data\n");
    return s_xenonData->createResponse();
  }
  return empty_array();
}
开发者ID:AojiaoZero,项目名称:hhvm,代码行数:8,代码来源:ext_xenon.cpp

示例9: empty_array

Array c_WaitableWaitHandle::t_getparents() {
  // no parent data available if finished
  if (isFinished()) {
    return empty_array();
  }

  return getParentChain().toArray();
}
开发者ID:HanumathRao,项目名称:hhvm,代码行数:8,代码来源:waitable_wait_handle.cpp

示例10: HHVM_FUNCTION

Array HHVM_FUNCTION(apache_response_headers) {
  Transport *transport = g_context->getTransport();
  if (transport) {
    HeaderMap headers;
    transport->getResponseHeaders(headers);
    return get_headers(headers);
  }
  return empty_array();
}
开发者ID:Orvid,项目名称:hhvm,代码行数:9,代码来源:ext_apache.cpp

示例11: getVar

 Array getVar(int64_t type) {
   switch (type) {
     case k_INPUT_GET: return m_GET;
     case k_INPUT_POST: return m_POST;
     case k_INPUT_COOKIE: return m_COOKIE;
     case k_INPUT_SERVER: return m_SERVER;
     case k_INPUT_ENV: return m_ENV;
   }
   return empty_array();
 }
开发者ID:BwRy,项目名称:hhvm,代码行数:10,代码来源:ext_filter.cpp

示例12: empty_array

Array HashCollection::toArray() {
  if (!m_size) {
    return empty_array();
  }
  auto ad = arrayData()->toPHPArray(true);
  if (UNLIKELY(ad->size() < m_size)) warnOnStrIntDup();
  assert(m_size);
  assert(ad->m_pos == 0);
  return Array::attach(ad);
}
开发者ID:DerPapst,项目名称:hhvm,代码行数:10,代码来源:hash-collection.cpp

示例13: clearSurpriseFlag

void EventHook::DoMemoryThresholdCallback() {
  clearSurpriseFlag(MemThresholdFlag);
  if (!g_context->m_memThresholdCallback.isNull()) {
    VMRegAnchor _;
    try {
      vm_call_user_func(g_context->m_memThresholdCallback, empty_array());
    } catch (Object& ex) {
      raise_error("Uncaught exception escaping mem Threshold callback: %s",
                  ex.toString().data());
    }
  }
}
开发者ID:Rongx,项目名称:hhvm,代码行数:12,代码来源:event-hook.cpp

示例14: HHVM_FUNCTION

Array HHVM_FUNCTION(libxml_get_errors) {
  xmlErrorVec* error_list = &tl_libxml_request_data->m_errors;
  const auto length = error_list->size();
  if (!length) {
    return empty_array();
  }
  PackedArrayInit ret(length);
  for (int64_t i = 0; i < length; i++) {
    ret.append(create_libxmlerror(error_list->at(i)));
  }
  return ret.toArray();
}
开发者ID:KOgames,项目名称:hhvm,代码行数:12,代码来源:ext_libxml.cpp

示例15: empty_array

Array c_WaitableWaitHandle::t_getparents() {
  // no parent data available if finished
  if (isFinished()) {
    return empty_array();
  }

  Array result = Array::Create();
  c_BlockableWaitHandle* curr = m_firstParent;

  while (curr) {
    result.append(curr);
    curr = curr->getNextParent();
  }

  return result;
}
开发者ID:BwRy,项目名称:hhvm,代码行数:16,代码来源:waitable_wait_handle.cpp


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