MetricKnn API
Fast Similarity Search using the Metric Space Approach
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
mknn::ResolverParams Class Reference

Stores parameters in an internal map, which associates a names with its value. More...

#include <mknn_params.hpp>

Public Member Functions

void parseString (std::string parameters_string)
 Parses a string in the format: parameter1=value1,parameter2=value2 More...
 
void copyAll (ResolverParams &params_from)
 Copies all the key-values pairs in params_from and adds them to params_to. More...
 
std::string toString ()
 Returns a string with the parameters which can be parsed. More...
 
 ResolverParams ()
 Default constructor.
 
virtual ~ResolverParams ()
 Default destructor.
 
 ResolverParams (const ResolverParams &other)
 Copy constructor.
 
ResolverParamsoperator= (const ResolverParams &other)
 Assignment operator.
 
MknnResolverParams Add Methods
void addString (std::string name, std::string value)
 Adds a string to the parameters. More...
 
void addDouble (std::string name, double value)
 Adds a floating point number to the parameters. More...
 
void addInt (std::string name, long long value)
 Adds an integer number to the parameters. More...
 
void addBool (std::string name, bool value)
 Adds an boolean value to the parameters. More...
 
void addObject (std::string name, void *value)
 Adds an object number to the parameters. More...
 
MknnResolverParams Get Methods
std::string getString (std::string name)
 Returns a string value. More...
 
double getDouble (std::string name)
 Returns a floating-point number. More...
 
long long getInt (std::string name)
 Returns an integer number. More...
 
bool getBool (std::string name)
 Returns a boolean value. More...
 
void * getObject (std::string name)
 Returns a object reference. More...
 
MknnResolverParams Other Methods
void setKnn (long long knn)
 Sets the K parameter for resolvers in k-NN searches. More...
 
void setRange (double range)
 Sets the range parameter for resolvers in range searches. More...
 
void setMaxThreads (long long max_threads)
 Sets the maximum number of threads to be used by a resolver. More...
 
long long getKnn ()
 
long long getRange ()
 
long long getMaxThreads ()
 

Static Public Member Functions

static ResolverParams newEmpty ()
 Creates an empty object. More...
 
static ResolverParams newParseString (long long knn, double range, long long max_threads, std::string parameters_string)
 Creates an empty object and set parameters by calling methods: setKnn, setRange, setMaxThreads, parseString. More...
 

Protected Attributes

std::unique_ptr< Impl > pimpl
 opaque object
 

Friends

class Resolver
 
class Index
 
class PredefIndex
 

Detailed Description

Stores parameters in an internal map, which associates a names with its value.

The internal map only stores two type of objects: strings and void pointers. The getter and setter methods that use integer/double/boolean actually convert them to/from a string.

Member Function Documentation

void mknn::ResolverParams::addBool ( std::string  name,
bool  value 
)

Adds an boolean value to the parameters.

A copy of name is stored in params.

Parameters
namethe name of the parameter.
valuethe value of the parameter.
void mknn::ResolverParams::addDouble ( std::string  name,
double  value 
)

Adds a floating point number to the parameters.

A copy of name is stored in params.

Parameters
namethe name of the parameter.
valuethe value of the parameter.
void mknn::ResolverParams::addInt ( std::string  name,
long long  value 
)

Adds an integer number to the parameters.

A copy of name is stored in params.

Parameters
namethe name of the parameter.
valuethe value of the parameter.
void mknn::ResolverParams::addObject ( std::string  name,
void *  value 
)

Adds an object number to the parameters.

A copy of name is stored in params but the value pointer itself is stored in params. Therefore the value pointer must remain valid during all the lifetime of params.

Parameters
namethe name of the parameter.
valuethe value of the parameter.
void mknn::ResolverParams::addString ( std::string  name,
std::string  value 
)

Adds a string to the parameters.

A copy of name and value are stored in params.

Parameters
namethe name of the parameter.
valuethe value of the parameter.
void mknn::ResolverParams::copyAll ( ResolverParams params_from)

Copies all the key-values pairs in params_from and adds them to params_to.

Parameters
params_fromthe parameters from which the values are read.
bool mknn::ResolverParams::getBool ( std::string  name)

Returns a boolean value.

Parameters
namethe name of the parameter.
Returns
the stored value. If the stored value is not a boolean value, it will raise an error.
double mknn::ResolverParams::getDouble ( std::string  name)

Returns a floating-point number.

Parameters
namethe name of the parameter.
Returns
the stored number. If the stored value is not a number, it will raise an error.
long long mknn::ResolverParams::getInt ( std::string  name)

Returns an integer number.

Parameters
namethe name of the parameter.
Returns
the stored number. If the stored value is not a number, it will raise an error.
long long mknn::ResolverParams::getKnn ( )
Returns
long long mknn::ResolverParams::getMaxThreads ( )
Returns
void* mknn::ResolverParams::getObject ( std::string  name)

Returns a object reference.

Parameters
namethe name of the parameter.
Returns
a pointer to the stored object.
long long mknn::ResolverParams::getRange ( )
Returns
std::string mknn::ResolverParams::getString ( std::string  name)

Returns a string value.

Parameters
namethe name of the parameter.
Returns
a pointer to the stored string (it must not be modified).
static ResolverParams mknn::ResolverParams::newEmpty ( )
static

Creates an empty object.

Returns
a new empty object.
static ResolverParams mknn::ResolverParams::newParseString ( long long  knn,
double  range,
long long  max_threads,
std::string  parameters_string 
)
static

Creates an empty object and set parameters by calling methods: setKnn, setRange, setMaxThreads, parseString.

Parameters
knn
range
max_threads
parameters_stringthe string in the format parameter1=value1,...
Returns
a parameters object
void mknn::ResolverParams::parseString ( std::string  parameters_string)

Parses a string in the format: parameter1=value1,parameter2=value2

Each parsed parameters is added to params

Parameters
parameters_stringthe string in the format parameter1=value1,...
void mknn::ResolverParams::setKnn ( long long  knn)

Sets the K parameter for resolvers in k-NN searches.

Parameters
knn
void mknn::ResolverParams::setMaxThreads ( long long  max_threads)

Sets the maximum number of threads to be used by a resolver.

Parameters
max_threads
void mknn::ResolverParams::setRange ( double  range)

Sets the range parameter for resolvers in range searches.

Parameters
range
std::string mknn::ResolverParams::toString ( )

Returns a string with the parameters which can be parsed.

Returns
a string representation of parameters.

The documentation for this class was generated from the following file:
Powered by Download MetricKnn