本文整理汇总了C++中type::get_data_size方法的典型用法代码示例。如果您正苦于以下问题:C++ type::get_data_size方法的具体用法?C++ type::get_data_size怎么用?C++ type::get_data_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类type
的用法示例。
在下文中一共展示了type::get_data_size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: type_error
ndt::byteswap_type::byteswap_type(const type &value_type)
: base_expr_type(byteswap_type_id, expr_kind, value_type.get_data_size(),
value_type.get_data_alignment(), type_flag_scalar, 0),
m_value_type(value_type),
m_operand_type(make_fixed_bytes(value_type.get_data_size(),
value_type.get_data_alignment()))
{
if (!value_type.is_builtin()) {
throw dynd::type_error(
"byteswap_type: Only built-in types are supported presently");
}
}
示例2: make_blockref_bytes_assignment_kernel
intptr_t ndt::bytes_type::make_assignment_kernel(void *ckb, intptr_t ckb_offset, const type &dst_tp,
const char *dst_arrmeta, const type &src_tp, const char *src_arrmeta,
kernel_request_t kernreq, const eval::eval_context *ectx) const
{
if (this == dst_tp.extended()) {
switch (src_tp.get_type_id()) {
case bytes_type_id: {
return make_blockref_bytes_assignment_kernel(ckb, ckb_offset, get_data_alignment(), dst_arrmeta,
src_tp.get_data_alignment(), src_arrmeta, kernreq, ectx);
}
case fixed_bytes_type_id: {
return make_fixed_bytes_to_blockref_bytes_assignment_kernel(ckb, ckb_offset, get_data_alignment(), dst_arrmeta,
src_tp.get_data_size(), src_tp.get_data_alignment(),
kernreq, ectx);
}
default: {
if (!src_tp.is_builtin()) {
src_tp.extended()->make_assignment_kernel(ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp, src_arrmeta, kernreq,
ectx);
}
break;
}
}
}
stringstream ss;
ss << "Cannot assign from " << src_tp << " to " << dst_tp;
throw runtime_error(ss.str());
}
示例3: type_error
ndt::option_type::option_type(const type &value_tp)
: base_type(option_id, value_tp.get_data_size(), value_tp.get_data_alignment(),
value_tp.get_flags() & (type_flags_value_inherited | type_flags_operand_inherited),
value_tp.get_arrmeta_size(), value_tp.get_ndim(), 0),
m_value_tp(value_tp)
{
if (value_tp.get_id() == option_id) {
stringstream ss;
ss << "Cannot construct an option type out of " << value_tp << ", it is already an option type";
throw type_error(ss.str());
}
}
示例4: make_blockref_string_assignment_kernel
intptr_t ndt::string_type::make_assignment_kernel(
void *ckb, intptr_t ckb_offset, const type &dst_tp, const char *dst_arrmeta,
const type &src_tp, const char *src_arrmeta, kernel_request_t kernreq,
const eval::eval_context *ectx) const
{
if (this == dst_tp.extended()) {
switch (src_tp.get_type_id()) {
case string_type_id: {
return make_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta, get_encoding(), src_arrmeta,
src_tp.extended<base_string_type>()->get_encoding(), kernreq, ectx);
}
case fixed_string_type_id: {
return make_fixed_string_to_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta, get_encoding(), src_tp.get_data_size(),
src_tp.extended<base_string_type>()->get_encoding(), kernreq, ectx);
}
default: {
if (!src_tp.is_builtin()) {
return src_tp.extended()->make_assignment_kernel(
ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp, src_arrmeta, kernreq,
ectx);
} else {
return make_builtin_to_string_assignment_kernel(
ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp.get_type_id(), kernreq,
ectx);
}
}
}
} else {
if (dst_tp.is_builtin()) {
return make_string_to_builtin_assignment_kernel(
ckb, ckb_offset, dst_tp.get_type_id(), src_tp, src_arrmeta, kernreq,
ectx);
} else {
stringstream ss;
ss << "Cannot assign from " << src_tp << " to " << dst_tp;
throw dynd::type_error(ss.str());
}
}
}
示例5: make_blockref_string_assignment_kernel
intptr_t ndt::json_type::make_assignment_kernel(
void *ckb, intptr_t ckb_offset, const type &dst_tp, const char *dst_arrmeta,
const type &src_tp, const char *src_arrmeta, kernel_request_t kernreq,
const eval::eval_context *ectx) const
{
if (this == dst_tp.extended()) {
switch (src_tp.get_type_id()) {
case json_type_id: {
// Assume the input is valid JSON when copying from json to json types
return make_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta, string_encoding_utf_8, src_arrmeta,
string_encoding_utf_8, kernreq, ectx);
}
case string_type_id:
case fixed_string_type_id: {
string_to_json_ck *stoj =
string_to_json_ck::make(ckb, kernreq, ckb_offset);
stoj->m_dst_arrmeta = dst_arrmeta;
stoj->m_validate = (ectx->errmode != assign_error_nocheck);
if (src_tp.get_type_id() == string_type_id) {
return make_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta, string_encoding_utf_8, src_arrmeta,
src_tp.extended<base_string_type>()->get_encoding(),
kernel_request_single, ectx);
} else {
return make_fixed_string_to_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta, string_encoding_utf_8,
src_tp.get_data_size(),
src_tp.extended<base_string_type>()->get_encoding(),
kernel_request_single, ectx);
}
}
default: {
if (!src_tp.is_builtin()) {
return src_tp.extended()->make_assignment_kernel(
ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp, src_arrmeta, kernreq,
ectx);
} else {
return make_builtin_to_string_assignment_kernel(
ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp.get_type_id(), kernreq,
ectx);
}
}
}
} else {
if (dst_tp.is_builtin()) {
return make_string_to_builtin_assignment_kernel(
ckb, ckb_offset, dst_tp.get_type_id(), src_tp, src_arrmeta, kernreq,
ectx);
} else if (dst_tp.get_type_id() == string_type_id) {
return make_blockref_string_assignment_kernel(
ckb, ckb_offset, dst_arrmeta,
dst_tp.extended<base_string_type>()->get_encoding(), src_arrmeta,
string_encoding_utf_8, kernreq, ectx);
} else if (dst_tp.get_type_id() == fixed_string_type_id) {
return make_blockref_string_to_fixed_string_assignment_kernel(
ckb, ckb_offset, dst_tp.get_data_size(),
dst_tp.extended<base_string_type>()->get_encoding(),
string_encoding_utf_8, kernreq, ectx);
} else {
stringstream ss;
ss << "Cannot assign from " << src_tp << " to " << dst_tp;
throw dynd::type_error(ss.str());
}
}
}