Page 19 out of 26 total pages


QbParameterClass


QbParameterClass is derived from the QbBaseClass and encapsulates the parameters associated with a QBIC feature computation or QBIC query. It is fully implemented, and creates an array of name/value pairs that any derived class of QbFeatureClass can use.

Both the QbParameterClass and the QbGenericDataClass define the methods ToQueryString and FromQueryString. These methods convert the class to a byte string, which allows the query to be passed from a client to a server.

Each QBIC feature class constructs its own default QbParameterClass and initializes it with appropriate settings for the feature class. You can fine tune it by passing your own QbParameterClass pointer during feature computation. During the query, you can pass parameters to each feature class to determine the class weights and query orders in multi-feature and multi-pass queries.

This chapter describes the following methods:

QbParameterClass method

This is the constructor for the class.

Syntax

QbParameterClass( void )

Parameters

None

~QbParameterClass method

This is the destructor for the class.

Syntax

virtual ~QbParameterClass( void )

Parameters

None

FromCommandLineString method

This method uses one of the following overloaded functions to initialize an object:

Syntax

int FromCommandLineString( const char *parmString )

int FromCommandLineString( const QbDatumClass &datum )

Parameters

Input

Output

An integer value; 0 indicates success; -1 indicates failure

FromQueryString method

This method has overloaded functions. This method decodes one of the following to initialize an object, depending on the function used: a string description of the parameters or a byte string (from a datum object).

Syntax

int FromQueryString( const char *string )

int FromQueryString( const QbDatumClass &datum )

Parameters

Input

Output

An integer value; 0 indicates success; -1 indicates failure

FromQueryStringInFile method

This method reads the string from the named file and decodes the string to initialize the object.

Syntax

int FromQueryStringInFile( const char *filename )

Parameters

Input

filename-A pointer to a string that holds the file name

Output

An integer value; 0 indicates success; -1 indicates failure

GetClassWeight method

This method returns the class weight of the object.

Syntax

fastfloat GetClassWeight( void )

Parameters

Input

None

Output

A fastfloat (double) value representing the class weight for multi-feature or multi-pass queries

GetCombineFunc method

This method returns an integer that indicates how the distances in a multi-feature or multi-pass query should be combined. If it is 0, the distances from different features at different passes are added (after multiplying by the appropriate class weights). If it is 1, the distance of the last query pass is used and all previously passed distances are discarded (after multiplying by the appropriate class weights) instead.

Syntax

int GetCombineFunc( void )

Parameters

Input

None

Output

An integer value, 0 or 1

GetCount method

This method returns the number of feature codes in the current object. Each QBIC feature class has its own set of feature codes which can be set by using the SetFeatureCode method.

Syntax

unsigned int GetCount const( void )

Parameters

Input

None

Output

An unsigned integer value representing the number of feature codes currently stored in the object

GetFeatureCodeNames method

This method returns all of the feature code names for the object.

Syntax

char ** GetFeatureCodeNames( void )

Parameters

Input

None

Output

A string array with a count of elements (get the count by using the GetCount method). For any number i < count, GetFeatureCodeNames()[i] points to a string describing the i-th feature code name.

GetFeatureCodes method

This method returns feature codes for an object. This method has overloaded functions. Depending on the function, it either returns all of the feature code values for the object or returns the feature code that corresponds to the given feature code name. The feature code values are used to fine tune the way a QBIC feature class performs feature computation. Different feature classes have different sets of feature code values.

Syntax

char ** GetFeatureCodes( void )

char * GetFeatureCodes( const char *name )

Parameters

Input

Output

GetFilterFlag method

If this returns True, the object instructs QBIC to use the QbFeatureClass' index scheme to increase the speed of the query.

Syntax

Boolean GetFilterFlag( void )

Parameters

Input

None

Output

A Boolean value; True means use the QbFeatureClass' index scheme, False means do not.

GetQueryOrder method

This method returns the order in which multi-pass QBIC queries are made. The default value is 0, which represents the highest priority.

Syntax

int GetQueryOrder( void )

Parameters

Input

None

Output

An integer that represents the order of a QBIC query.

GetWeights method

This method returns feature weights. This method has overloaded functions. Depending on the function, it either returns a pointer to the feature weight array or the feature weight for the given feature code name.

Syntax

fastfloat * GetWeights( void )

fastfloat GetWeights( const char *name )

Parameters

Input

Output

Itype method

This method returns the interface type defined in the base class.

Syntax

virtual const QbInterfaceType Itype( void )

Parameters

Input

None

Output

ParameterInterfaceType of QbInterfaceType defined in the QbBaseClass. See page 49.

SetClassWeight method

This method sets the value of the class weight for the object.

Syntax

void SetClassWeight( fastfloat x )

Parameters

Input

x-A fastfloat (double) value representing the class weight for multi-feature or multi-pass queries. The default is 1.

Output

None

SetCombineFunc method

This method sets the way the distances in a multi-pass query should be combined.

Syntax

void SetCombineFunc( int x )

Parameters

Input

x-An integer value, 0 or 1. Set it to 0 to add distances from different features at different passes (after multiplying by the appropriate class weights). Set it to 1 to use the distance of the last query pass and discard distance values of all previous passes (after multiplying by the appropriate class weights).

Output

None

SetFeatureCodes method

This method adds or replaces a feature code value for the corresponding feature code name.

Syntax

int SetFeatureCodes( const char *name, const char *value )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

SetFilterFlag method

This method sets the object such that if the value is True and an index scheme is implemented, QbFeatureClass' FilterResult method is called during the query to increase the speed of the query.

Syntax

void SetFilterFlag( const Boolean value )

Parameters

Input

A Boolean value; True means the FilterResult method is called, False means it is not

Output

None

SetQueryOrder method

This method sets the order for a multi-pass query.

Syntax

void SetQueryOrder( int x )

Parameters

Input

x-An integer that represents the order of a QBIC query

Output

None

SetWeights method

This method adds or replaces the feature code weight for a given feature code name.

Syntax

int SetWeights ( const char *name, const fastfloat value )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

ToCommandLineString method

This method encodes data inside the object into a byte string and assigns it to the byte string of datum.

Syntax

int ToCommandLineString( QbDatumClass &datum )

Parameters

Input

datum-A reference to a QbDatumClass object whose byte string will hold the encoded description of the object

Output

An integer value; 0 indicates success; -1 indicates failure

ToQueryString method

This method encodes the object parameters into a byte string and assigns it to a byte string (in a datum object).

Syntax

int ToQueryString( QbDatumClass &datum )

Parameters

Input

datum-A reference to a QbDatumClass object to hold the encoded byte string containing a description of the parameters

Output

An integer value; 0 indicates success; -1 indicates failure

Type method

This method returns a constant string of the class name.

Syntax

virtual const char * Type( void )

Parameters

Input

None

Output

A constant string, QbParameterClass





Page 19 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.