QbGenericDataClass is derived from the QbBaseClass and defines generic data: images, video, text, and audio. This class encapsulates the data between the feature extraction process, the user interface, and external data (image files). This class is fully implemented and gives you a standardized way to pass "query by example" or "query from sampler data" between a client and server. It also provides a standard way of passing domain-specific information between a client and server. This class does nothing to document the format of the domain-specific data. To do this, you need to subclass this class and specify the domain-specific data.
An example of a subclass of this class is the QbGenericImageDataClass class, which contains domain-specific image data.
You pass it to the ComputeFeature method in any class that derives from QbFeatureClass (such as QbColorHistogramFeatureClass), as input for feature computation. A protected member variable, dataSource type, in QbGenericDataClass determines how the ComputeFeature method should proceed in feature extraction.
dataSource is a public enumerated type that takes the following values:
Both QbGenericDataClass and QbParameterClass implement ToQueryString and FromQueryString methods. These methods are used to convert the class to an ASCII query string to allow the query to be passed from the client to a server query engine that can be physically separated, even on a different platform.
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.
QbGenericDataClass( void )
This is the destructor for the class.
virtual ~QbGenericDataClass( void )
This method sets a flag that indicates that the object contains subpart data.
void DataIsSubPartDefinition( void )
This method decodes a subpart definition from input to initialize the class object.
virtual int DecodeSubPartDef( const QbDatumClass &subPartDatum )
subPartDatum-A reference to a QbDatumClass object that holds the subpart description to be decoded
An integer value: 0 indicates success; -1 indicates failure
This method encodes the current object's subpart description into the byte string of the input subPartDatum.
virtual int EncodeSubPartDef( QbDatumClass &subPartDatum )
subPartDatum-A reference to a QbDatumClass object that will hold the byte string of the encoded subpart description.
An integer value: 0 indicates success; -1 indicates failure
This method initializes the current object with the date encoded in the byte string of the input QbDatumClass object, datum.
virtual int FromQueryString( const QbDatumClass &datum, const char *featureClassname )
An integer value: 0 indicates success; -1 indicates failure
This method returns the catalog name.
const char * GetCatalog( void )
A pointer to a string to hold the catalog name
This method returns a reference to a QbDatumClass object packed with feature data.
const QbDatumClass & GetData( void )
A reference to a QbDatumClass object that packs the feature data in its byte string.
This method returns a reference to a QbDatumClass object that packs domain-specific data, such as image, text, and audio, into its member byte string.
const QbDatumClass & GetDerivedClassData( void )
A reference to a QbDatumClass object that packs the domain-specific data into its member byte string for feature computation
This method returns True if the object corresponds to query data description. In some feature classes, like QbColorHistogramFeatureClass, the ComputeFeature method might need additional processing on query feature data to increase the speed of the query.
Boolean GetIsQuery( void )
A Boolean value; True if the object corresponds to query data description
This method returns the name of the database key.
const char * GetKey( void )
A pointer to a string that holds the name of the database key
This method returns the name of the sampler.
const char * GetSampler( void )
A pointer to a string to hold the sampler name
This method returns the text description of the generic data.
char * GetTextDescription( void )
A pointer to a string to hold the text description
This method returns the data source type of an object.
const dataSource GetType( void )
An enumerated type of dataSource, described on page 111
This method returns a value that represents whether the generic data is in a subpart definition. For an image, for example, you can pass a mask image file with the same size as the original image. The mask file has pixel values of either zero or non-zero. QBIC performs feature computations on pixels of the image where the mask has non-zero pixel values.
int isSubPartDefinition( void )
An integer value: 1 if the generic data is in a subpart description, 0 if not
This method returns the interface type defined in the base class.
virtual const QbInterfaceType Itype( void )
GenericDataInterfaceType of QbInterfaceType defined in the QbBaseClass. See page 49.
This method defines the object as a query-by-example type for the given key and catalog names. Query by example means that the feature data is already in the database. Therefore, by passing the catalog name and the key, feature data can be extracted from the database.
int MakeQueryByExampleObject( const char *CatalogName, const char *KeyName )
An integer value: 0 indicates success; -1 indicates failure.
This method defines the object as a query-by-text type. Query-by-text searches through keywords to find records with the same keyword.
int MakeQueryByTextObject( const char *text )
text-A pointer to a string that holds the text or keyword description
An integer value: 0 indicates success; -1 indicates failure
This method deletes the current catalog name, and replaces it with the new one pointed to by catalogArg.
int SetCatalog( const char *catalogArg )
catalogArg-A pointer to a string that holds the new catalog name
An integer value: 0 indicates success; -1 indicates failure
This method sets the object as a query object if bArg=True. See also "GetIsQuery method" on page 116.
Boolean SetIsQuery( Boolean bArg )
A Boolean value that has the same value returned by a GetIsQuery call before the new value bArg is set.
This method deletes the current key name, and replaces it with the new one pointed to by keyArg.
int setKey( const char *keyArg )
keyArg-A pointer to a string that holds the key name
An integer value: 0 indicates success; -1 indicates failure
This method deletes the current sampler name and replaces it with the name pointed to by samplerArg.
int SetSampler( const char *samplerArg )
samplerArg-A pointer to a string that holds the sampler name
An integer value: 0 indicates success; -1 indicates failure
This method deletes the current text description and replaces it with the given string. The text description is specific to the text query for QBIC.
int SetTextDescription ( const char *text )
text-A pointer to a string that contains the text description for the query, such as a set of keywords
An integer value: 0 indicates success; -1 indicates failure
This method sets the type of data source in QbGenericDataClass.
void SetType( const dataSource typeArg )
typeArg-An enumerated type of dataSource described on page 111
This method translates generic and domain-specific information inside the object to a byte string.
virtual int ToQueryString( QbDatumClass &datum )
datum-A reference to a QbDatumClass object that will hold the byte string of the encoded data
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, QbGenericDataClass