本文整理汇总了C++中Address::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::compare方法的具体用法?C++ Address::compare怎么用?C++ Address::compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::compare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: register_write_outcome
void Block_manager_parent::register_write_outcome(Event const& event, enum status status) {
IO_has_completed_since_last_shortest_queue_search = true;
assert(num_free_pages > 0);
num_free_pages--;
//printf("gc going on %d\n", how_many_gc_operations_are_scheduled());
if (!event.is_garbage_collection_op()) {
assert(num_available_pages_for_new_writes > 0);
num_available_pages_for_new_writes--;
Free_Space_Meter::register_num_free_pages_for_app_writes(num_available_pages_for_new_writes, event.get_current_time());
}
//printf("%d %d\n", num_available_pages_for_new_writes, num_free_pages);
// if there are very few pages left, need to trigger emergency GC
if (num_free_pages <= BLOCK_SIZE && migrator->how_many_gc_operations_are_scheduled() == 0) {
migrator->schedule_gc(event.get_current_time(), -1, -1, -1, -1);
}
Address ba = event.get_address();
if (ba.compare(free_block_pointers[ba.package][ba.die]) >= BLOCK) {
increment_pointer(free_block_pointers[ba.package][ba.die]);
if (!has_free_pages(free_block_pointers[ba.package][ba.die])) {
if (PRINT_LEVEL > 1) {
printf("hot pointer ");
free_block_pointers[ba.package][ba.die].print();
printf(" is out of space");
}
Address free_pointer = find_free_unused_block(ba.package, ba.die, YOUNG, event.get_current_time());
if (has_free_pages(free_pointer)) {
free_block_pointers[ba.package][ba.die] = free_pointer;
}
else {
Free_Space_Per_LUN_Meter::mark_out_of_space(ba, event.get_current_time() );
}
if (PRINT_LEVEL > 1) {
if (free_pointer.valid == NONE) printf(", and a new unused block could not be found.\n");
else printf(".\n");
}
}
}
}
示例2:
inline bool operator==(const Address& a, const Address& b) {
return a.compare(b) == 0;
}
示例3:
bool operator<(const Address& addr1, const Address& addr2) {
return addr1.compare(addr2) < 0;
}