IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
/** Adds a node under the given key. Returns true if the node was added, false if the node was not because a node with that key is already in the set. */
booladd_node(node_type_t*node){
/* Add our node without eviction */
if(!this->add_node_without_eviction(node))
returnfalse;
/* Evict */
while(node_count>max_node_count)
evict_last_node();
/* Success */
returntrue;
}
/** Adds a node under the given key without triggering eviction. Returns true if the node was added, false if the node was not because a node with that key is already in the set. */
booladd_node_without_eviction(node_type_t*node){
assert(node!=NULL&&node!=&mouth);
/* Try inserting; return false if it was already in the set */
if(!node_set.insert(node).second)
returnfalse;
/* Add the node after the mouth */
node->next=mouth.next;
node->next->prev=node;
node->prev=&mouth;
mouth.next=node;
/* Update the count */
node_count++;
/* Evict */
while(node_count>max_node_count)
evict_last_node();
/* Success */
returntrue;
}
/** Counts nodes */
size_tsize(void){
returnnode_count;
}
/** Evicts all nodes */
voidevict_all_nodes(void){
while(node_count>0){
evict_last_node();
}
}
/** Iterator for walking nodes, from least recently used to most */