db_planner::CachingNeighborFinder Class Reference

A CachingNeighborFinder wraps another NeighborFinder and checks for precomputed neighbors. More...

#include <caching_neighbor_finder.h>

Inheritance diagram for db_planner::CachingNeighborFinder:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CachingNeighborFinder (const DatabaseManager &db_manager, const bool cache_results, const string &distance_function_name, const NeighborFinder< Model > &neighbor_finder=NeighborFinder< Model >())
virtual bool Find (const Model &query, const int num_neighbors, vector< pair< Model *, double > > *neighbors) const
 Implementation of (<NeighborFinder>"::")<Find>

Private Attributes

const bool cache_results_
 Flag determines if newly found neighbors are written back to the database.
const DatabaseManagerdb_manager_
 A DatabaseManager representing the database to query for alignments.
const string distance_function_name_
const NeighborFinder< Model > & neighbor_finder_
 A wrapped NeighborFinder to use when the database lookup fails.

Detailed Description

A CachingNeighborFinder wraps another NeighborFinder and checks for precomputed neighbors.

A CachingNeighborFinder wraps another NeighborFinder and checks into a database for precomputed neighbors before finding new ones. If "cache_results_" is true, then new neighbors are written back to the database. The wrapped NeighborFinder defaults to the base class, which always fails.

Definition at line 49 of file caching_neighbor_finder.h.


Constructor & Destructor Documentation

db_planner::CachingNeighborFinder::CachingNeighborFinder ( const DatabaseManager db_manager,
const bool  cache_results,
const string &  distance_function_name,
const NeighborFinder< Model > &  neighbor_finder = NeighborFinder<Model>() 
) [inline]

Definition at line 61 of file caching_neighbor_finder.h.


Member Function Documentation

virtual bool db_planner::CachingNeighborFinder::Find ( const Model query,
const int  num_neighbors,
vector< pair< Model *, double > > *  neighbors 
) const [inline, virtual]

Implementation of (<NeighborFinder>"::")<Find>

Given a Model and a number of neighbors to return, it finds neighbors if possible from the database using the given distance function, or else it uses the wrapped NeighborFinder. The neighbors vector is filled on successful output with pairs representing the neighbor Models and the distance to each neighbor. On failure the function returns false and the vector contents are undefined. WARNING: "num_neighbors" is decieving - the function returns from num_neighbors to 2 x num_neighbors results, because whenever possible neighbors are duplicated at the scale above and below the given Model.

Reimplemented from db_planner::NeighborFinder< Model >.

Definition at line 79 of file caching_neighbor_finder.h.


Member Data Documentation

Flag determines if newly found neighbors are written back to the database.

Definition at line 54 of file caching_neighbor_finder.h.

A DatabaseManager representing the database to query for alignments.

Definition at line 52 of file caching_neighbor_finder.h.

A string ID of the distance function in the database to use for finding neighbors (and for saving back results).

Definition at line 57 of file caching_neighbor_finder.h.

A wrapped NeighborFinder to use when the database lookup fails.

Definition at line 59 of file caching_neighbor_finder.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:32 2012