uint64_t used_memory() const { const uint64_t nmembers = m_member_meta[0].capacity() + m_member_meta[1].capacity() + m_member_meta[2].capacity(); const uint64_t members = nmembers * sizeof(MemberMeta); const uint64_t relations = m_relations.capacity() * sizeof(RelationMeta); const uint64_t relations_buffer_capacity = m_relations_buffer.capacity(); const uint64_t members_buffer_capacity = m_members_buffer.capacity(); std::cout << " nR = m_relations.capacity() ........... = " << std::setw(12) << m_relations.capacity() << "\n"; std::cout << " nMN = m_member_meta[NODE].capacity() ... = " << std::setw(12) << m_member_meta[0].capacity() << "\n"; std::cout << " nMW = m_member_meta[WAY].capacity() .... = " << std::setw(12) << m_member_meta[1].capacity() << "\n"; std::cout << " nMR = m_member_meta[RELATION].capacity() = " << std::setw(12) << m_member_meta[2].capacity() << "\n"; std::cout << " nM = m_member_meta[*].capacity() ...... = " << std::setw(12) << nmembers << "\n"; std::cout << " sRM = sizeof(RelationMeta) ............. = " << std::setw(12) << sizeof(RelationMeta) << "\n"; std::cout << " sMM = sizeof(MemberMeta) ............... = " << std::setw(12) << sizeof(MemberMeta) << "\n\n"; std::cout << " nR * sRM ............................... = " << std::setw(12) << relations << "\n"; std::cout << " nM * sMM ............................... = " << std::setw(12) << members << "\n"; std::cout << " relations_buffer_capacity .............. = " << std::setw(12) << relations_buffer_capacity << "\n"; std::cout << " members_buffer_capacity ................ = " << std::setw(12) << members_buffer_capacity << "\n"; const uint64_t total = relations + members + relations_buffer_capacity + members_buffer_capacity; std::cout << " total .................................. = " << std::setw(12) << total << "\n"; std::cout << " =======================================================\n"; return relations_buffer_capacity + members_buffer_capacity + relations + members; }
std::vector<Edge> parok() { std::vector<Edge> par_lista; for(unsigned int i=0;i<utak.capacity();i++) { osmium::WayNodeList * utnodeok; utnodeok=&utak.get<osmium::Way>(i).nodes(); for(unsigned int j=0;j<(*utnodeok).size()-1;j++) { Edge par(((*utnodeok)[j]),((*utnodeok)[j+1])); /*par.first=((*utnodeok)[j]).ref(); par.second=((*utnodeok)[j+1]).ref();*/ par_lista.push_back(par); } } return par_lista; }
TEST_CASE("Buffer basics") { osmium::memory::Buffer invalid_buffer1; osmium::memory::Buffer invalid_buffer2; osmium::memory::Buffer empty_buffer1{1024}; osmium::memory::Buffer empty_buffer2{2048}; REQUIRE_FALSE(invalid_buffer1); REQUIRE_FALSE(invalid_buffer2); REQUIRE(empty_buffer1); REQUIRE(empty_buffer2); REQUIRE(invalid_buffer1 == invalid_buffer2); REQUIRE(invalid_buffer1 != empty_buffer1); REQUIRE(empty_buffer1 != empty_buffer2); REQUIRE(invalid_buffer1.capacity() == 0); REQUIRE(invalid_buffer1.written() == 0); REQUIRE(invalid_buffer1.committed() == 0); REQUIRE(invalid_buffer1.clear() == 0); REQUIRE(empty_buffer1.capacity() == 1024); REQUIRE(empty_buffer1.written() == 0); REQUIRE(empty_buffer1.committed() == 0); REQUIRE(empty_buffer1.is_aligned()); REQUIRE(empty_buffer1.clear() == 0); REQUIRE(empty_buffer2.capacity() == 2048); REQUIRE(empty_buffer2.written() == 0); REQUIRE(empty_buffer2.committed() == 0); REQUIRE(empty_buffer2.is_aligned()); REQUIRE(empty_buffer2.clear() == 0);