dca_interface  6.3.4
dca::ZlaClassification Class Reference

#include <zla_classification.h>

Detailed Description

The ZLA Classification module class.

This class is used to create a ZlaClassification instance by using the static create() function.

A ZlaClassification instance can be used to create an ZlaClassifier instance.

See also
ZlaClassifier, ZlaClassificationResult
// assume we have a valid DcaInstance (myDca) and License (myLicense)
// initialize the ZLA Classification module
dca::ZlaClassification myZlaClassification =
dca::ZlaClassification::create( myDca, myLicense );
// create a ZLA Classifier
dca::ZlaClassifier myZlaClassifier = myZlaClassification.createClassifier();
// create an email object
// assume we have the contents of a valid RFC 2822 conform email in
// std::string myEmailContent
dca::Email myEmail = dca::Email::create( myDca, myEmailContent );
// declare the classification results
dca::ZlaClassificationResult myZlaClassificationResult;
// run the classification
myZlaClassifier.classify( myEmail, myZlaClassificationResult );
// if myResult returns false an error occurred
if( !myResult ) {
std::cout << "Received error from ZLA Classification (Error code: " <<
myResult.getReturnCode() << ", Description: " <<
myResult.getDescription() << ")." << std::endl;
return;
}
std::cout << "Result=" << myZlaClassificationResult.result() <<
", Module=" << myZlaClassificationResult.module();
if( myZlaClassificationResult.result() == ZLA_SPAM ) {
std::cout << " SPAM";
}
else if( myZlaClassificationResult.result() == ZLA_HAM ) {
std::cout << " HAM";
}
else if( myZlaClassificationResult.result() == ZLA_NDR ) {
std::cout << " NDR";
}
else if( myZlaClassificationResult.result() == ZLA_UNKNOWN ) {
std::cout << " UNKNOWN";
}

Definition at line 41 of file zla_classification.h.

Public Member Functions

ZlaClassifier createClassifier (const DbConnection &aDbConnection) const
 Creates a ZlaClassifier used to classify Email objects. More...
 

Static Public Member Functions

static ZlaClassification create (const DcaInstance &aDcaInstance, const License &aLicense)
 Initializes the ZlaClassification module. More...
 

Static Public Attributes

static DCA_MODULE_ID_TYPE ID
 The unique ID of the ZLA classification module.
 

Member Function Documentation

◆ create()

static ZlaClassification dca::ZlaClassification::create ( const DcaInstance aDcaInstance,
const License aLicense 
)
static

Initializes the ZlaClassification module.

Parameters
[in]aDcaInstanceA previously initialized DcaInstance object
[in]aLicenseAn initialized License object
Returns
An initialized ZlaClassification instance.

◆ createClassifier()

ZlaClassifier dca::ZlaClassification::createClassifier ( const DbConnection aDbConnection) const

Creates a ZlaClassifier used to classify Email objects.

Parameters
[in]aDbConnection- This must be an initialized DbConnection of type DBT_Url. You can use either a local or a remote DbConnection
Returns
An initialized ZlaClassifier instance.
Exceptions
ExDca- One of the following error codes (available by using ExDca::getReturnCode() in your catch-handler)
See also
DcaInstance::createDbConnection()

The documentation for this class was generated from the following file:
DCA_ZLA_RESULT result() const
Returns the result for the ZLA classification.
ZLA classifier object for ZLA classification.
static ZlaClassification create(const DcaInstance &aDcaInstance, const License &aLicense)
Initializes the ZlaClassification module.
DCA_RESULT_TYPE getReturnCode() const
Returns the last error code (if any).
const DCA_ZLA_RESULT ZLA_HAM
The email data is classified as HAM.
The ZLA Classification module class.
Encapsulates an email object.
Definition: base_email.h:24
const DCA_ZLA_RESULT ZLA_UNKNOWN
The email data is unknown i.e. there was not enough data for classification or no ZLA match.
const DCA_ZLA_RESULT ZLA_SPAM
The email data is classified as SPAM.
Overall result of a ZLA classification.
static Email create(const DcaInstance &aDcaInstance, const std::string &emailContent)
Creates an email object, used as an input parameter for ZLA classification.
DCA_ZLA_TYPE module() const
Returns the module type for the ZLA classification.
const DCA_ZLA_RESULT ZLA_NDR
The email data is classified as NDR (non-delivery-report)
FunctionResult classify(const Email &anEmail, ZlaClassificationResult &aZlaResult) const
The email classification method. The method takes an initialized Email object and returns the results...
std::string getDescription() const
Returns the description for the error or warning.
Standard function result.
Definition: base_classes.h:148
ZlaClassifier createClassifier(const DbConnection &aDbConnection) const
Creates a ZlaClassifier used to classify Email objects.