Gaia
gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType > Class Template Reference

The View class contains a specific view on a dataset. More...

#include <view.h>

Public Types

typedef BaseResultSet< SearchPointType, DataSetType > ResultSetType
 
typedef BaseSearchSpace< SearchPointType, DataSetType > SearchSpaceType
 

Public Member Functions

 BaseView (DataSetType *dataset)
 
ResultSetType nnSearch (const PointType &p, const DistanceType *dist, const Filter *filter=0)
 
ResultSetType nnSearch (const PointType &p, const DistanceType *dist, const QString &filter)
 
ResultSetType nnSearch (const PointType &p, ResultSetType inputSpace, const DistanceType *dist, const Filter *filter=0)
 
ResultSetType nnSearch (const PointType &p, ResultSetType inputSpace, const DistanceType *dist, const QString &filter)
 
template<typename T >
ResultSetType nnSearch (const QString &id, T x)
 
template<typename T , typename U >
ResultSetType nnSearch (const QString &id, T x, U y)
 
template<typename T , typename U , typename V >
ResultSetType nnSearch (const QString &id, T x, U y, V z)
 
void invalidate ()
 This function is called whenever the DataSet it points to changes, so it knows it needs to recompute SortingStruct, maybe its filters, etc...
 
void validate ()
 This function is called to make sure that the View is valid (ie: its sorting structure and filters actually point to existing objects).
 
void indexOn (const QString &descriptorName)
 This methods creates an index on the given descriptor name, in the hope that future queries using this descriptor in a filter will be faster.
 

Protected Member Functions

void init ()
 
void checkPoint (const PointType &p)
 
void checkDistance (const DistanceType *dist)
 
SearchSpaceTypegetSearchSpace (SearchSpaceType *sspace=0, const Filter *filter=0, bool spaceOwnsFilter=true)
 Returns a valid SearchSpace with associated filter. More...
 
SearchSpaceTypegetSearchSpace (SearchSpaceType *sspace, const QString &filterString)
 Same thing as the previous method, except the filter is specified as a string and thus will be parsed before giving it to the search space.
 
ResultSetType nnSearch (const PointType &p, SearchSpaceType *sspace, const DistanceType *dist)
 The nnSearch method which is actually doing all the work. More...
 

Static Protected Member Functions

static FiltercreateFilter (const QString &filterString)
 
static void bindFilter (const Filter *filter, const DataSetType *dataset)
 
static SearchResults formatResults (std::priority_queue< SearchPointType > &results)
 

Protected Attributes

QPointer< DataSetType > _dataset
 
bool _isViewValid
 
BaseSearchSpacePool< SearchPointType, DataSetType > _searchSpacePool
 

Detailed Description

template<typename DataSetType, typename PointType, typename SearchPointType, typename DistanceType>
class gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >

The View class contains a specific view on a dataset.

It has a specific distance function and can also work on subsets of the whole dataset. A dataset can then be considered as a collection of different datasets and can query any, some or all of them for similarity searches.

Member Function Documentation

template<typename DataSetType , typename PointType , typename SearchPointType , typename DistanceType >
BaseSearchSpace< SearchPointType, DataSetType > * gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::getSearchSpace ( SearchSpaceType sspace = 0,
const Filter filter = 0,
bool  spaceOwnsFilter = true 
)
protected

Returns a valid SearchSpace with associated filter.

In case some of the input arguments are not given, it will try to fill them up using default values: the full dataset if no search space is given, a "where true" filter if not filter is given.

Parameters
spaceOwnsFilterwhether you want to yield ownership of the filter to the resulting dataset or not. If true, the const qualifier on the given filter is ignored.

References gaia2::BaseSearchSpace< SearchPointType, DataSetType >::copyPointsFrom(), gaia2::Timer::elapsed(), gaia2::BaseQueryOptimizer< SearchPointType, DataSetType >::optimize(), gaia2::Filter::parse(), and gaia2::Timer::start().

template<typename DataSetType , typename PointType , typename SearchPointType , typename DistanceType >
BaseResultSet< SearchPointType, DataSetType > gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::nnSearch ( const PointType &  p,
SearchSpaceType sspace,
const DistanceType *  dist 
)
protected

The nnSearch method which is actually doing all the work.

All arguments should already be valid (ie: no null pointer) (layouts will be checked, though).

References gaia2::BaseSearchSpace< SearchPointType, DataSetType >::computeDistance(), gaia2::Timer::elapsed(), gaia2::BaseSearchSpace< SearchPointType, DataSetType >::filterAndSort(), gaia2::Timer::restart(), and gaia2::Timer::start().


The documentation for this class was generated from the following files: