本文整理汇总了C++中osmium::memory::Buffer::capacity方法的典型用法代码示例。如果您正苦于以下问题:C++ Buffer::capacity方法的具体用法?C++ Buffer::capacity怎么用?C++ Buffer::capacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmium::memory::Buffer
的用法示例。
在下文中一共展示了Buffer::capacity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: used_memory
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;
}
示例2: par
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;
}
示例3: REQUIRE
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);