本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: runCallback
void AsioSession::onIOWaitExit() {
runCallback(
m_onIOWaitExitCallback,
empty_array(),
"WaitHandle::onIOWaitExit"
);
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例9: empty_array
Array c_WaitableWaitHandle::t_getparents() {
// no parent data available if finished
if (isFinished()) {
return empty_array();
}
return getParentChain().toArray();
}
示例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();
}
示例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();
}
示例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);
}
示例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());
}
}
}
示例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();
}
示例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;
}