From 762622f65342f5769376650802f8c241d6f1792f Mon Sep 17 00:00:00 2001 From: Shunsuke Kanda Date: Thu, 8 Jul 2021 22:53:29 +0900 Subject: [PATCH] rename typeid --- include/xcdat.hpp | 16 ++++++++-------- include/xcdat/trie.hpp | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/xcdat.hpp b/include/xcdat.hpp index 25d55a4..b37d2b0 100644 --- a/include/xcdat.hpp +++ b/include/xcdat.hpp @@ -34,7 +34,7 @@ template std::uint32_t type_id; visitor.visit(type_id); - XCDAT_THROW_IF(type_id != Trie::l1_bits, "The input dictionary type is different."); + XCDAT_THROW_IF(type_id != Trie::type_id, "The input dictionary type is different."); Trie idx; visitor.visit(idx); @@ -48,7 +48,7 @@ template std::uint32_t type_id; visitor.visit(type_id); - XCDAT_THROW_IF(type_id != Trie::l1_bits, "The input dictionary type is different."); + XCDAT_THROW_IF(type_id != Trie::type_id, "The input dictionary type is different."); Trie idx; visitor.visit(idx); @@ -60,7 +60,7 @@ template template [[maybe_unused]] std::uint64_t save(const Trie& idx, const std::string& filepath) { save_visitor visitor(filepath); - visitor.visit(static_cast(Trie::l1_bits)); // identifier + visitor.visit(static_cast(Trie::type_id)); // identifier visitor.visit(const_cast(idx)); return visitor.bytes(); } @@ -69,20 +69,20 @@ template template [[maybe_unused]] std::uint64_t memory_in_bytes(const Trie& idx) { size_visitor visitor; - visitor.visit(static_cast(Trie::l1_bits)); // identifier + visitor.visit(static_cast(Trie::type_id)); // identifier visitor.visit(const_cast(idx)); return visitor.bytes(); } //! Get the identifier of the trie type embedded by the function 'save'. -//! The identifier corresponds to trie::l1_bits and will be used to detect the trie type. +//! The identifier corresponds to trie::type_id and will be used to detect the trie type. [[maybe_unused]] std::uint32_t get_type_id(const std::string& filepath) { std::ifstream ifs(filepath); XCDAT_THROW_IF(!ifs.good(), "Cannot open the input file"); - std::uint32_t flag; - ifs.read(reinterpret_cast(&flag), sizeof(flag)); - return flag; + std::uint32_t type_id; + ifs.read(reinterpret_cast(&type_id), sizeof(type_id)); + return type_id; } } // namespace xcdat diff --git a/include/xcdat/trie.hpp b/include/xcdat/trie.hpp index 4948e3d..41018a9 100644 --- a/include/xcdat/trie.hpp +++ b/include/xcdat/trie.hpp @@ -17,8 +17,8 @@ class trie { using trie_type = trie; using bc_vector_type = BcVector; - //! The identifier of BC vector. - static constexpr auto l1_bits = bc_vector_type::l1_bits; + //! The type identifier. + static constexpr std::uint32_t type_id = bc_vector_type::l1_bits; private: std::uint64_t m_num_keys = 0;