LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover > Struct Template Reference

#include "RStarTree.h"

Inheritance diagram for RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >:

Public Member Functions

 RemoveFunctor (const Acceptor &na, LeafRemover &lr, std::list< Leaf * > *ir, std::size_t *size)
 
bool operator() (BoundedItem *item, bool isRoot=false)
 
void QueueItemsToReinsert (Node *node)
 

Public Attributes

const Acceptor & accept
 
LeafRemover & remove
 
std::list< Leaf * > * itemsToReinsert
 
std::size_t * m_size
 

Detailed Description

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor, typename LeafRemover>
struct RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >

Definition at line 679 of file RStarTree.h.

Constructor & Destructor Documentation

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::RemoveFunctor ( const Acceptor &  na,
LeafRemover &  lr,
std::list< Leaf * > *  ir,
std::size_t *  size 
)
inlineexplicit

Definition at line 691 of file RStarTree.h.

692  : accept(na), remove(lr), itemsToReinsert(ir), m_size(size) {}
const Acceptor & accept
Definition: RStarTree.h:682
std::list< Leaf * > * itemsToReinsert
Definition: RStarTree.h:686
std::size_t * m_size
Definition: RStarTree.h:687

Member Function Documentation

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
bool RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::operator() ( BoundedItem item,
bool  isRoot = false 
)
inline

Definition at line 694 of file RStarTree.h.

References RStarNode< BoundedItem >::hasLeaves, and RStarNode< BoundedItem >::items.

695  {
696  Node * node = static_cast<Node*>(item);
697 
698  if (accept(node))
699  {
700  // this is the easy part: remove nodes if they need to be removed
701  if (node->hasLeaves)
702  node->items.erase(std::remove_if(node->items.begin(), node->items.end(), RemoveLeafFunctor<Acceptor, LeafRemover>(accept, remove, m_size)), node->items.end());
703  else
704  node->items.erase(std::remove_if(node->items.begin(), node->items.end(), *this), node->items.end() );
705 
706  if (!isRoot)
707  {
708  if (node->items.empty())
709  {
710  // tell parent to remove us if theres nothing left
711  delete node;
712  return true;
713  }
714  else if (node->items.size() < min_child_items)
715  {
716  // queue up the items that need to be reinserted
717  QueueItemsToReinsert(node);
718  return true;
719  }
720  }
721  else if (node->items.empty())
722  {
723  // if the root node is empty, setting these won't hurt
724  // anything, since the algorithms don't actually require
725  // the nodes to have anything in them.
726  node->hasLeaves = true;
727  node->bound.reset();
728  }
729  }
730 
731  // anything else, don't remove it
732  return false;
733 
734  }
const Acceptor & accept
Definition: RStarTree.h:682
std::size_t * m_size
Definition: RStarTree.h:687
void QueueItemsToReinsert(Node *node)
Definition: RStarTree.h:739
RStarNode< BoundedItem > Node
Definition: RStarTree.h:94
template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
void RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::QueueItemsToReinsert ( Node node)
inline

Definition at line 739 of file RStarTree.h.

References evd::details::end(), RStarNode< BoundedItem >::hasLeaves, and RStarNode< BoundedItem >::items.

740  {
741  typename std::vector< BoundedItem* >::iterator it = node->items.begin();
742  typename std::vector< BoundedItem* >::iterator end = node->items.end();
743 
744  if (node->hasLeaves)
745  {
746  for(; it != end; it++)
747  itemsToReinsert->push_back(static_cast<Leaf*>(*it));
748  }
749  else
750  for (; it != end; it++)
751  QueueItemsToReinsert(static_cast<Node*>(*it));
752 
753  delete node;
754  }
intermediate_table::iterator iterator
std::list< Leaf * > * itemsToReinsert
Definition: RStarTree.h:686
void QueueItemsToReinsert(Node *node)
Definition: RStarTree.h:739
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)

Member Data Documentation

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
const Acceptor& RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::accept

Definition at line 682 of file RStarTree.h.

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
std::list<Leaf*>* RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::itemsToReinsert

Definition at line 686 of file RStarTree.h.

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
std::size_t* RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::m_size

Definition at line 687 of file RStarTree.h.

template<typename LeafType, std::size_t dimensions, std::size_t min_child_items, std::size_t max_child_items>
template<typename Acceptor , typename LeafRemover >
LeafRemover& RStarTree< LeafType, dimensions, min_child_items, max_child_items >::RemoveFunctor< Acceptor, LeafRemover >::remove

Definition at line 683 of file RStarTree.h.


The documentation for this struct was generated from the following file: