コード例 #1
0
bool dynd::make_date_adapter_callable(const ndt::type &operand_tp,
                                      const nd::string &op,
                                      nd::callable &out_forward,
                                      nd::callable &out_reverse)
{
  int32_t epoch_date;
  if (parse_days_since(op.begin(), op.end(), epoch_date)) {
    switch (operand_tp.get_type_id()) {
    case int32_type_id:
      out_forward = make_int_offset_callable<int32_t, int32_t>(
          epoch_date, ndt::callable_type::make(ndt::date_type::make(),
                                               ndt::type::make<int32_t>()));
      out_reverse = make_int_offset_callable<int32_t, int32_t>(
          -epoch_date, ndt::callable_type::make(ndt::type::make<int32_t>(),
                                                ndt::date_type::make()));
      return true;
    case int64_type_id:
      out_forward = make_int_offset_callable<int64_t, int32_t>(
          epoch_date, ndt::callable_type::make(ndt::date_type::make(),
                                               ndt::type::make<int64_t>()));
      out_reverse = make_int_offset_callable<int32_t, int64_t>(
          -epoch_date, ndt::callable_type::make(ndt::type::make<int64_t>(),
                                                ndt::date_type::make()));
      return true;
    default:
      return false;
    }
  } else {
    return false;
  }
}
コード例 #2
0
ファイル: typevar_type.hpp プロジェクト: Laeeth/libdynd
 inline std::string get_name_str() const {
     return m_name.str();
 }
コード例 #3
0
ファイル: pow_dimsym_type.hpp プロジェクト: aterrel/libdynd
 inline std::string get_exponent_str() const { return m_exponent.str(); }