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


C++ type::at_single方法代码示例

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


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

示例1: runtime_error

groupby_type::groupby_type(const ndt::type& data_values_tp,
                const ndt::type& by_values_tp)
    : base_expr_type(groupby_type_id, expr_kind,
                    sizeof(groupby_type_data), sizeof(void *), type_flag_none,
                    0, 1 + data_values_tp.get_ndim())
{
    m_groups_type = by_values_tp.at_single(0).value_type();
    if (m_groups_type.get_type_id() != categorical_type_id) {
        stringstream ss;
        ss << "to construct a groupby type, the by type, " << by_values_tp.at_single(0);
        ss << ", must have a categorical value type";
        throw runtime_error(ss.str());
    }
    if (data_values_tp.get_ndim() < 1) {
        throw runtime_error("to construct a groupby type, its values type must have at least one array dimension");
    }
    if (by_values_tp.get_ndim() < 1) {
        throw runtime_error("to construct a groupby type, its values type must have at least one array dimension");
    }
    m_operand_type = ndt::make_cstruct(ndt::make_pointer(data_values_tp), "data",
                    ndt::make_pointer(by_values_tp), "by");
    m_members.arrmeta_size = m_operand_type.get_arrmeta_size();
    const categorical_type *cd = m_groups_type.extended<categorical_type>();
    m_value_type = ndt::make_cfixed_dim(cd->get_category_count(),
                    ndt::make_var_dim(data_values_tp.at_single(0)));
    m_members.flags = inherited_flags(m_value_type.get_flags(), m_operand_type.get_flags());
}
开发者ID:aterrel,项目名称:libdynd,代码行数:27,代码来源:groupby_type.cpp

示例2:

 /**
  * Given some metadata for the groupby type, return metadata
  * for a single element of the data_values array.
  */
 const char *get_data_value_metadata(const char *metadata) const {
     // First at_single gets us to the pointer<array<data_value>> type
     ndt::type d = m_operand_type.at_single(0, &metadata);
     // Second at_single gets us to the data_value type
     d.at_single(0, &metadata);
     return metadata;
 }
开发者ID:pombredanne,项目名称:libdynd,代码行数:11,代码来源:groupby_type.hpp

示例3:

 /**
  * Given some arrmeta for the groupby type, returns the
  * arrmeta for the pointer type that points at the data
  * values.
  *
  * \param arrmeta  An instance of groupby type arrmeta.
  *
  * \returns  The pointer<data_values_type> arrmeta within the
  *           groupby arrmeta.
  */
 pointer_type_arrmeta *get_data_values_pointer_arrmeta(char *arrmeta) const {
     m_operand_type.at_single(0, const_cast<const char **>(&arrmeta));
     return reinterpret_cast<pointer_type_arrmeta *>(arrmeta);
 }
开发者ID:aterrel,项目名称:libdynd,代码行数:14,代码来源:groupby_type.hpp


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