dca::UrlClassificationResults Class Reference
[URL Classification]

#include <url_classification_result.h>

List of all members.


Detailed Description

Results of an URL classification.

See also:
UrlDbClassifier, UrlClassification
// assume we have a valid DcaInstance (myDca), License (myLicense) and DbConnection (myDbConnection)

// initialize the URL Classification module
dca::UrlClassification myUrlClassification = 
        dca::UrlClassification::create( myDca, myLicense );

UrlDbClassifierOptions creationOptions;
// enable Feedback mechanism
creationOptions.enable_Feedback = true; 
// enable detection of embedded URLs
creationOptions.enable_EmbeddedUrlDetection = true;

// create a UrlDbClassifier by using creationOptions
dca::UrlDbClassifier myUrlDbClassifier = 
        myUrlClassification.createDbClassifier( myDbConnection, creationOptions );

// create a URL object to classify
dca::Url myUrl = dca::Url::create( myDca, "www.ibm.com" );

// declare the classification results
dca::UrlClassificationResults myUrlClassificationResults;

// start URL Classification
dca::FunctionResult myResult = 
        myUrlDbClassifier.classify( myUrl, myUrlClassificationResults );

// if myResult returns false an error occurred.
if( !myResult ) {
        cout << "Received an error from URL Classification (Error code:" <<
                myResult.getReturnCode() << ", Description: " <<
                myResult.getDescription() << ")." << endl;
        return;
}

if( myUrlClassificationResults.isUnknownUrl() ) {
        // if the given URL is unknown there are no resulting categories available
        cout << "Received no results, URL is unknown." << endl;
        return;
}

if( !myUrlClassificationResults.isCategorized() ) {
        // given URL (or host) is KNOWN, but does not have any categories assigned
        cout << "URL is known but has no assigned categories." << endl;
        return;
}

// we got results and want to print them out
PrintResults( myUrlClassificationResults );

Definition at line 31 of file url_classification_result.h.

Public Member Functions

UrlClassificationResult at (DCA_INDEX_TYPE index) const
 Returns one result of the matched results (if any) with the given index.
UrlClassificationResult operator[] (DCA_INDEX_TYPE index) const
 Similar to at() but allows a more C++ style access.
DCA_SIZE_TYPE size () const
 Returns the number of results in the container.
bool isUnknownUrl () const
 Returns whether a URL is known or unknown. A URL is unknown if it is not contained in the database.
bool isCategorized () const
 Returns whether or not the URL matched one or more categories.
bool contains (DCA_CATEGORY_ID_TYPE catid) const
 Fast method to see whether the results contain a given category or not.

Member Function Documentation

UrlClassificationResult dca::UrlClassificationResults::at ( DCA_INDEX_TYPE  index  )  const

Returns one result of the matched results (if any) with the given index.

Parameters:
[in] index The index of the UrlClassificationResult. Range is from 0 to size() - 1
Returns:
The result item for the given index in the container.
Exceptions:
ExDca One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)

UrlClassificationResult dca::UrlClassificationResults::operator[] ( DCA_INDEX_TYPE  index  )  const

Similar to at() but allows a more C++ style access.

Parameters:
[in] index The index of the UrlClassificationResult. Range is from 0 to size() - 1
Returns:
The result item for the given index in the container.
Exceptions:
ExDca One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)

DCA_SIZE_TYPE dca::UrlClassificationResults::size (  )  const

Returns the number of results in the container.

Returns:
The size of the container or 0 if the container is empty.
bool dca::UrlClassificationResults::contains ( DCA_CATEGORY_ID_TYPE  catid  )  const

Fast method to see whether the results contain a given category or not.

Parameters:
[in] catid The category id to match
Returns:
true, if the given catid has been found in the container, false otherwise

The documentation for this class was generated from the following file:

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1