bool ndt::fixed_dim_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != fixed_dim_type_id) { return false; } else if (rhs.get_kind() == kind_kind) { return false; } else { const fixed_dim_type *dt = static_cast<const fixed_dim_type *>(&rhs); return m_element_tp == dt->m_element_tp && m_dim_size == dt->m_dim_size; } }
bool ndt::dim_fragment_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_id() != dim_fragment_id) { return false; } else { const dim_fragment_type *dft = static_cast<const dim_fragment_type *>(&rhs); return get_ndim() == rhs.get_ndim() && memcmp(m_tagged_dims.get(), dft->m_tagged_dims.get(), get_ndim() * sizeof(intptr_t)) == 0; } }
/** * Read an arbitrary type. */ template<typename T> void read(T& ret) { base_type::read(reinterpret_cast<char*>(&ret), sizeof(T)); if(bad()) { std::cerr << "Error reading file!" << std::endl; assert(false); } }
//! Write the arbitrary data type to file template<typename T> void write(T t) { base_type::write(reinterpret_cast<char*>(&t), sizeof(T)); if(bad()) { std::cerr << "Error writing file!" << std::endl; assert(false); } }
inline type_id_t get_type_id() const { if (is_builtin_type()) { return get_builtin_type_id(); } else { return m_type->get_type_id(); } }
bool json_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else { return rhs.get_type_id() == json_type_id; } }
bool ndt::int_kind_sym_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else { return rhs.get_type_id() == int_sym_type_id; } }
column get_column(size_t j) const { column result(m_N); for (size_t i = 0; i < m_N; ++i) { result[i] = at(i,j); } return result; }
bool ndt::array_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } return rhs.get_type_id() == array_type_id; }
/** * Read an arbitrary type. */ template<typename T> void read_vector(std::vector<T>& ret) { if(ret.empty()) return; base_type::read(reinterpret_cast<char*>(&(ret[0])), sizeof(T) * ret.size()); if(bad()) { std::cerr << "Error reading file!" << std::endl; assert(false); } }
/** * Read an arbitrary type. */ template<typename T> T read() { T t; base_type::read(reinterpret_cast<char*>(&t), sizeof(T)); if(bad()) { std::cerr << "Error reading file!" << std::endl; assert(false); } return t; }
bool ndt::any_kind_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else { return rhs.get_id() == any_kind_id; } }
bool ndt::kind_sym_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else { return rhs.get_type_id() == kind_sym_type_id && m_kind == static_cast<const kind_sym_type &>(rhs).m_kind; } }
bool ndt::cuda_device_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_id() != cuda_device_id) { return false; } else { const cuda_device_type *tp = static_cast<const cuda_device_type *>(&rhs); return m_element_tp == tp->m_element_tp; } }
bool ndt::type_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != type_type_id) { return false; } else { return m_pattern_tp == static_cast<const type_type *>(&rhs)->m_pattern_tp; } }
bool ndt::callable_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_id() != callable_id) { return false; } else { const callable_type *fpt = static_cast<const callable_type *>(&rhs); return m_return_type == fpt->m_return_type && m_pos_tuple == fpt->m_pos_tuple && m_kwd_struct == fpt->m_kwd_struct; } }
bool ndt::option_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_id() != option_id) { return false; } else { const option_type *ot = static_cast<const option_type *>(&rhs); return m_value_tp == ot->m_value_tp; } }
bool ndt::string_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != string_type_id) { return false; } else { return true; } }
bool typevar_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != typevar_type_id) { return false; } else { const typevar_type *tvt = static_cast<const typevar_type *>(&rhs); return m_name == tvt->m_name; } }
bool cuda_host_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != cuda_host_type_id) { return false; } else { const cuda_host_type *dt = static_cast<const cuda_host_type*>(&rhs); return m_storage_tp == dt->m_storage_tp && m_cuda_host_flags == dt->get_cuda_host_flags(); } }
bool fixedstring_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != fixedstring_type_id) { return false; } else { const fixedstring_type *dt = static_cast<const fixedstring_type*>(&rhs); return m_encoding == dt->m_encoding && m_stringsize == dt->m_stringsize; } }
bool bytes_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != bytes_type_id) { return false; } else { const bytes_type *dt = static_cast<const bytes_type*>(&rhs); return m_alignment == dt->m_alignment; } }
bool groupby_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != groupby_type_id) { return false; } else { const groupby_type *dt = static_cast<const groupby_type*>(&rhs); return m_value_type == dt->m_value_type && m_operand_type == dt->m_operand_type; } }
bool ndt::pointer_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != pointer_type_id) { return false; } else { const pointer_type *dt = static_cast<const pointer_type *>(&rhs); return m_target_tp == dt->m_target_tp; } }
bool ndt::var_dim_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != var_dim_type_id) { return false; } else { const var_dim_type *dt = static_cast<const var_dim_type *>(&rhs); return m_element_tp == dt->m_element_tp; } }
bool fixedbytes_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != fixedbytes_type_id) { return false; } else { const fixedbytes_type *dt = static_cast<const fixedbytes_type*>(&rhs); return get_data_size() == dt->get_data_size() && get_data_alignment() == dt->get_data_alignment(); } }
bool ndt::byteswap_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != byteswap_type_id) { return false; } else { const byteswap_type *dt = static_cast<const byteswap_type *>(&rhs); return m_value_type == dt->m_value_type; } }
bool ndt::string_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != string_type_id) { return false; } else { const string_type *dt = static_cast<const string_type *>(&rhs); return m_encoding == dt->m_encoding; } }
bool date_type::operator==(const base_type& rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != date_type_id) { return false; } else { // There is only one possibility for the date type (TODO: timezones!) return true; } }
bool ndt::pow_dimsym_type::operator==(const base_type &rhs) const { if (this == &rhs) { return true; } else if (rhs.get_type_id() != pow_dimsym_type_id) { return false; } else { const pow_dimsym_type *tvt = static_cast<const pow_dimsym_type *>(&rhs); return m_exponent == tvt->m_exponent && m_base_tp == tvt->m_base_tp && m_element_tp == tvt->m_element_tp; } }