Rosetta
|
A class for keeping track of a subset of elements in a set that are pushed into a queue in a certain order, and which fall off the end of the queue in ther order in which they arrive. Elements in the set can be bumped to the front of the queue. More...
#include <recent_history_queue.hh>
Public Member Functions | |
recent_history_queue () | |
recent_history_queue (int num_elements, int history_size) | |
~recent_history_queue () override | |
void | clear () |
void | num_elements (int num_elements) |
void | history_size (int history_size) |
int | num_elements () const |
int | history_size () const |
int | curr_num_in_recent_history () const |
int | head_of_queue () const |
For unit-testing purposes. More... | |
int | end_of_queue () const |
For unit-testing purposes. More... | |
int | pos_in_history_queue (int element) const |
Returns the position in the recent history for a given element in the set. Returns 0 if the element is not part of the recent history. More... | |
int | push_to_front_of_history_queue (int element) |
Push an element to the front of the recent history queue. This will likely bump an element that had been in the recent history queue; in that event, this function returns the in-place index for that bumped element. If the new element doesn't displace some other element (i.e. if the queue is either not yet full, or if the element was already in the queue), then this function returns a fictional index of "0". More... | |
unsigned int | dynamic_memory_usage () const |
![]() | |
VirtualBase ()=default | |
Default constructor. More... | |
virtual | ~VirtualBase ()=default |
The virtual destructor is one of the main reasons for the VirtualBase class. More... | |
VirtualBase (VirtualBase const &)=default | |
VirtualBase (VirtualBase &&)=default | |
VirtualBase & | operator= (VirtualBase const &)=default |
VirtualBase & | operator= (VirtualBase &&)=default |
Private Attributes | |
int | num_elements_ |
int | history_size_ |
int | curr_num_in_recent_history_ |
utility::vector1< history_queue_struct > | recent_history_queue_ |
int | head_of_rh_queue_ptr_ |
int | end_of_rh_queue_ptr_ |
utility::vector1< int > | elements_2_recent_history_ |
A class for keeping track of a subset of elements in a set that are pushed into a queue in a certain order, and which fall off the end of the queue in ther order in which they arrive. Elements in the set can be bumped to the front of the queue.
The queue is "in place", so there are no calls to new or delete with repeated calls to push_to_front_of_history_queue().
The position in queue can be used to keep track of data for elements, where the position is understood not as the number of elements between the element and the front of the queue, but rather, an index that the object has in the "recent_history_queue_" data member – an array. If an element is in the queue with index X, and then it is pushed to the front of the history queue, its index will still be X.
utility::recent_history_queue::recent_history_queue | ( | ) |
utility::recent_history_queue::recent_history_queue | ( | int | num_elements, |
int | history_size | ||
) |
References history_size_, create_a3b_hbs::ii, recent_history_queue_, and numeric::constants::f::zero.
|
overridedefault |
void utility::recent_history_queue::clear | ( | ) |
References curr_num_in_recent_history_, elements_2_recent_history_, end_of_rh_queue_ptr_, head_of_rh_queue_ptr_, history_size_, create_a3b_hbs::ii, num_elements_, recent_history_queue_, and numeric::constants::f::zero.
Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard(), history_size(), and num_elements().
int utility::recent_history_queue::curr_num_in_recent_history | ( | ) | const |
References curr_num_in_recent_history_.
unsigned int utility::recent_history_queue::dynamic_memory_usage | ( | ) | const |
References elements_2_recent_history_, enumerate_junctions::int, and recent_history_queue_.
int utility::recent_history_queue::end_of_queue | ( | ) | const |
For unit-testing purposes.
References end_of_rh_queue_ptr_.
int utility::recent_history_queue::head_of_queue | ( | ) | const |
For unit-testing purposes.
References head_of_rh_queue_ptr_.
int utility::recent_history_queue::history_size | ( | ) | const |
References history_size_.
Referenced by history_size().
void utility::recent_history_queue::history_size | ( | int | history_size | ) |
References clear(), history_size(), history_size_, and recent_history_queue_.
int utility::recent_history_queue::num_elements | ( | ) | const |
References num_elements_.
Referenced by num_elements().
void utility::recent_history_queue::num_elements | ( | int | num_elements | ) |
References clear(), elements_2_recent_history_, num_elements(), and num_elements_.
int utility::recent_history_queue::pos_in_history_queue | ( | int | element | ) | const |
Returns the position in the recent history for a given element in the set. Returns 0 if the element is not part of the recent history.
References elements_2_recent_history_.
int utility::recent_history_queue::push_to_front_of_history_queue | ( | int | element | ) |
Push an element to the front of the recent history queue. This will likely bump an element that had been in the recent history queue; in that event, this function returns the in-place index for that bumped element. If the new element doesn't displace some other element (i.e. if the queue is either not yet full, or if the element was already in the queue), then this function returns a fictional index of "0".
References curr_num_in_recent_history_, elements_2_recent_history_, end_of_rh_queue_ptr_, head_of_rh_queue_ptr_, history_size_, and recent_history_queue_.
|
private |
Referenced by clear(), curr_num_in_recent_history(), and push_to_front_of_history_queue().
|
private |
Referenced by clear(), dynamic_memory_usage(), num_elements(), pos_in_history_queue(), and push_to_front_of_history_queue().
|
private |
Referenced by clear(), end_of_queue(), and push_to_front_of_history_queue().
|
private |
Referenced by clear(), head_of_queue(), and push_to_front_of_history_queue().
|
private |
Referenced by clear(), history_size(), push_to_front_of_history_queue(), and recent_history_queue().
|
private |
Referenced by clear(), and num_elements().
|
private |
Referenced by clear(), dynamic_memory_usage(), history_size(), push_to_front_of_history_queue(), and recent_history_queue().