Beispiel #1
0
TEST_F(TableTests, copy_structure_replacement) {
  auto input = Loader::shortcuts::load("test/lin_xxs.tbl", Loader::params().setReturnsMutableVerticalTable(true));
  ASSERT_EQ(3u, input->partitionCount());
  auto order_indifferent = [](DataType dt) { return makeDictionary<OrderIndifferentDictionary>(dt); };
  auto order_preserving = [](DataType dt) { return makeDictionary<OrderPreservingDictionary>(dt); };
  auto b = [](std::size_t cols) { return std::make_shared<FixedLengthVector<value_id_t>>(cols, 0); };
  hyrise::storage::atable_ptr_t copy  = input->copy_structure(order_preserving, b); 
  ASSERT_TRUE(std::dynamic_pointer_cast<OrderPreservingDictionary<hyrise_int_t>>(copy->dictionaryAt(0,0)) != nullptr);
  hyrise::storage::atable_ptr_t copy2 = input->copy_structure(order_indifferent, b);
  ASSERT_TRUE(std::dynamic_pointer_cast<OrderIndifferentDictionary<hyrise_int_t>>(copy2->dictionaryAt(0,0)) != nullptr);
}
Beispiel #2
0
default_settings()
{
copy_structure(&default_vs, &vs, sizeof(vs) );
copy_cmap(init_cmap, render_form->cmap);
rethink_settings();
if (zoom_form)
	unset_zoom();
}
Beispiel #3
0
static inline int
set_content(const struct sol_memdesc *desc, void *mem, const void *ptr_content)
{
    if (desc->ops && desc->ops->set_content)
        return desc->ops->set_content(desc, mem, ptr_content);

    if (desc->type == SOL_MEMDESC_TYPE_STRING) {
        const char *const *pv = ptr_content;
        int r = sol_util_replace_str_if_changed(mem, *pv);
        if (r >= 0)
            return 0;
        return r;
    } else if (desc->type == SOL_MEMDESC_TYPE_PTR && desc->pointed_item) {
        const void *const *pv = ptr_content;
        void **m = mem;

        if (!*m && *pv) {
            *m = sol_memdesc_new_with_defaults(desc->pointed_item);
            if (!*m)
                return -errno;
        } else if (*m && !*pv) {
            sol_memdesc_free(desc->pointed_item, *m);
            *m = NULL;
            return 0;
        } else if (!*pv)
            return 0;

        return set_content(desc->pointed_item, *m, *pv);

    } else if (desc->type == SOL_MEMDESC_TYPE_STRUCTURE) {
        if (!desc->structure_members) {
            SOL_WRN("desc=%p is SOL_MEMDESC_TYPE_STRUCTURE but does not provide structure_members", desc);
            return -EINVAL;
        }

        return copy_structure(desc, mem, ptr_content);
    } else if (desc->type == SOL_MEMDESC_TYPE_ARRAY) {
        if (!desc->array_item) {
            SOL_WRN("desc=%p is SOL_MEMDESC_TYPE_ARRAY but does not provide array_item", desc);
            return -EINVAL;
        }

        return copy_array(desc, mem, ptr_content);
    }

    memcpy(mem, ptr_content, sol_memdesc_get_size(desc));
    return 0;
}
//Copy general structures
void ReliabilitySingleModelInterface::copy_general_structure(SpReliabilitySingleModelInterface i) {
    m_data = i->m_data;
    active = i->active;
    name = i->name;
    model_name = i->model_name;
    P = i->P;
    R_forward = i->R_forward;
    R_backward = i->R_backward;
    binterface_forward = i->binterface_forward;
    binterface_backward = i->binterface_backward;
    instances = i->instances;
    dynamics = i->dynamics;
    instanceTemplate = i->instanceTemplate;
    dependences = i->dependences;
    dependants = i->dependants;
    copy_structure(i);
}