Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

DAGSearchDatabase Class Reference

Near neighbour search database used to index the DAG prototypes. More...

#include <DAGSearchDatabase.h>

List of all members.

Public Methods

 DAGSearchDatabase ()
 Default constructor.

virtual ~DAGSearchDatabase ()
 Destructor.

void Add (ID id, const DAG &dag)
 Adds prototype.

void Remove (ID id, DAG &dag)
 Removes prototype.

SmartArray< DAGSearchRecordEx > GetKClosest (const DAG &dag, const leda_node &querynode, int k)
 Finds k closest nodes.

SmartArray< DAGSearchRecordEx > GetClosest (const DAG &dag, const leda_node &querynode, const double &range)
 Finds closest nodes in a given range.

bool Create (std::string name, int dim)
 Creates the database.

bool Open (std::string name)
 Opens the database.

std::istream & Read (std::istream &is)
 Read the database from the stream.

std::ostream & Write (std::ostream &os)
 Writes the database from a stream.


Detailed Description

Near neighbour search database used to index the DAG prototypes.

Definition at line 95 of file DAGSearchDatabase.h.


Member Function Documentation

void DAGSearchDatabase::Add ID    id,
const DAG   dag
 

Adds prototype.

Adds the prototype to the database.

Precondition:
No error checking is performed.
Parameters:
prototype  contains identification number of the
prototype  prototype view described which is to be added to NND.
dag  refers to the instance of the DAG class
dag  that describes the prototype view to be addded to the database.
Returns:
No return values.

Definition at line 58 of file DAGSearchDatabase.cpp.

References DAG::GetFileOffset(), DAG::GetNodeIndex(), DAG::GetNodeTSV(), DAG::GetNodeTSVNorm(), DAG::GetTotalTSVSum(), DAGSearchRecord::id, ID, DAGSearchRecord::node, DAGSearchRecord::nodeLbl, DAG::NodeType(), DAGSearchRecord::offset, and DAGSearchRecord::totalVote.

bool DAGSearchDatabase::Create std::string    name,
int    dim
 

Creates the database.

Creates the database with the file name 'name' and dimensions 'dim'.

Precondition:
name must be a valid file name.
Parameters:
name  contains file name of the database to be created.
dim  is the number of dimensions of the new database.
Returns:
Returns true if database was created successfully, false otherwise.

Definition at line 197 of file DAGSearchDatabase.cpp.

References Min_NND_Dimension.

SmartArray< DAGSearchRecordEx > DAGSearchDatabase::GetClosest const DAG   dag,
const leda_node &    querynode,
const double &    range
 

Finds closest nodes in a given range.

Finds the closest nodes to the quety node in the given range.

Parameters:
querynode  refers to the node for which n closest nodes will be found in the database. e.g. 0.25
range  tolarance of deviation at every dimension.

Definition at line 152 of file DAGSearchDatabase.cpp.

References SmartArray< T >::Add(), DAG::GetNodeTSV(), SmartArray< double >::GetSize(), and SmartArray< T >::ReSize().

SmartArray< DAGSearchRecordEx > DAGSearchDatabase::GetKClosest const DAG   dag,
const leda_node &    querynode,
int    k
 

Finds k closest nodes.

Finds k closest nodes to the query node.

Parameters:
querynode  refers to the node for which n closest nodes will be found in the database.
k  contains number of neighbours to be retrieved during the search.

Definition at line 118 of file DAGSearchDatabase.cpp.

References SmartArray< T >::Add(), DAG::GetNodeTSV(), and SmartArray< T >::ReSize().

bool DAGSearchDatabase::Open std::string    name
 

Opens the database.

Opens the database with the file name 'name'.

Precondition:
name must be a valid file name.
Parameters:
name  contains file name of the database to be created.
Returns:
Returns true if database was opened successfully, false otherwise.

Definition at line 227 of file DAGSearchDatabase.cpp.

istream & DAGSearchDatabase::Read std::istream &    is
 

Read the database from the stream.

Reads database parameters from a stream and loads the database.

Parameters:
is  refers to a stream which is used to load the database.
Returns:
Returns reference to a stream used to load the database. If the error occured during an attempt to load the database, state of the stream will be set to fail.

Definition at line 249 of file DAGSearchDatabase.cpp.

void DAGSearchDatabase::Remove ID    id,
DAG   dag
 

Removes prototype.

Removes the prototype from the search database.

Precondition:
No error checking is performed.
Parameters:
prototype  contains identification number of the prototype view which is to be removed from NND.
dag  refers to the instance of the DAG class that describes the prototype view to be removed from the database.
Returns:
No return values.

Definition at line 87 of file DAGSearchDatabase.cpp.

References DAG::GetNodeIndex(), DAG::GetNodeTSV(), DAGSearchRecord::id, ID, and DAGSearchRecord::node.

ostream & DAGSearchDatabase::Write std::ostream &    os
 

Writes the database from a stream.

Writes database parameters to a stream. This parameters can latter be used to read the database

Parameters:
os  refers to a stream which is used to write the database parameters.
Returns:
Returns reference to a stream used to write the database parameters.

Definition at line 288 of file DAGSearchDatabase.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Nov 13 11:21:29 2004 for Noisy DAG Matcher by doxygen1.2.18