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:
You can see coding examples in Appendix C, "Sample Code" on page 185. Other programs are located in the qbic/QbicApi
directory.
This is the constructor for the class.
QbParameterClass( void )
This is the destructor for the class.
virtual ~QbParameterClass( void )
This method uses one of the following overloaded functions to initialize an object:
int FromCommandLineString( const char *parmString ) int FromCommandLineString( const QbDatumClass &datum )
An integer value; 0 indicates success; -1 indicates failure
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).
int FromQueryString( const char *string ) int FromQueryString( const QbDatumClass &datum )
An integer value; 0 indicates success; -1 indicates failure
This method reads the string from the named file and decodes the string to initialize the object.
int FromQueryStringInFile( const char *filename )
filename-A pointer to a string that holds the file name
An integer value; 0 indicates success; -1 indicates failure
This method returns the class weight of the object.
fastfloat GetClassWeight( void )
A fastfloat (double) value representing the class weight for multi-feature or multi-pass queries
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.
int GetCombineFunc( void )
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.
unsigned int GetCount const( void )
An unsigned integer value representing the number of feature codes currently stored in the object
This method returns all of the feature code names for the object.
char ** GetFeatureCodeNames( void )
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.
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.
char ** GetFeatureCodes( void ) char * GetFeatureCodes( const char *name )
If this returns True, the object instructs QBIC to use the QbFeatureClass' index scheme to increase the speed of the query.
Boolean GetFilterFlag( void )
A Boolean value; True means use the QbFeatureClass' index scheme, False means do not.
This method returns the order in which multi-pass QBIC queries are made. The default value is 0, which represents the highest priority.
int GetQueryOrder( void )
An integer that represents the order of a QBIC query.
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.
fastfloat * GetWeights( void ) fastfloat GetWeights( const char *name )
This method returns the interface type defined in the base class.
virtual const QbInterfaceType Itype( void )
ParameterInterfaceType of QbInterfaceType defined in the QbBaseClass. See page 49.
This method sets the value of the class weight for the object.
void SetClassWeight( fastfloat x )
x-A fastfloat (double) value representing the class weight for multi-feature or multi-pass queries. The default is 1.
This method sets the way the distances in a multi-pass query should be combined.
void SetCombineFunc( int x )
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).
This method adds or replaces a feature code value for the corresponding feature code name.
int SetFeatureCodes( const char *name, const char *value )
An integer value: 0 indicates success; -1 indicates failure
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.
void SetFilterFlag( const Boolean value )
A Boolean value; True means the FilterResult method is called, False means it is not
This method sets the order for a multi-pass query.
void SetQueryOrder( int x )
x-An integer that represents the order of a QBIC query
This method adds or replaces the feature code weight for a given feature code name.
int SetWeights ( const char *name, const fastfloat value )
An integer value: 0 indicates success; -1 indicates failure
This method encodes data inside the object into a byte string and assigns it to the byte string of datum.
int ToCommandLineString( QbDatumClass &datum )
datum-A reference to a QbDatumClass object whose byte string will hold the encoded description of the object
An integer value; 0 indicates success; -1 indicates failure
This method encodes the object parameters into a byte string and assigns it to a byte string (in a datum object).
int ToQueryString( QbDatumClass &datum )
datum-A reference to a QbDatumClass object to hold the encoded byte string containing a description of the parameters
An integer value; 0 indicates success; -1 indicates failure
This method returns a constant string of the class name.
virtual const char * Type( void )
A constant string, QbParameterClass