ULAPI  8.0
Public Member Functions | List of all members
ULWorker Class Referenceabstract

ULWorker is the abstract parent for the classes that provide core ULAPI services like number translation, conjugation, word look-up, etc. More...

#include <ulworker.h>

Public Member Functions

 ULWorker ()
 
virtual ~ULWorker ()
 
virtual bool isServiceAvailable (const ULServiceDescriptor &service)=0
 
virtual void getAvailableServices (ULList< ULServiceDescriptor > &serviceList)=0
 
virtual void setCancelOperation (bool shouldCancel)
 
virtual bool shouldCancelOperation () const
 

Detailed Description

ULWorker is the abstract parent for the classes that provide core ULAPI services like number translation, conjugation, word look-up, etc.

ULWorker objects also have a "cancelOperation" boolean attribute that enables clients of the worker to cancel time-consuming operations (e.g. stemming or full conjugations). A typical usage pattern would look like this:

ULWorker *worker = new SomeULWorkerSubclass();
worker->setCancelOperation(false);
// spawn computation thread here
// in UI thread
// when cancellation condition occurs, e.g. user hits a cancel button
worker->setCancelOperation(true);
// in computation thread
ULError error = worker->performBigOperation();
worker->setCancelOperation(false);
// ...
}
// in performBigOperation()
while (!bigOperationIsComplete) {
// do stuff
if (this->shouldCancelOperation()) {
// clean up
}
}

Constructor & Destructor Documentation

ULWorker::ULWorker ( )
virtual ULWorker::~ULWorker ( )
inlinevirtual

Member Function Documentation

virtual void ULWorker::getAvailableServices ( ULList< ULServiceDescriptor > &  serviceList)
pure virtual
Parameters
[out]serviceListUsed to return a list of all the services this ULWorker can provide.

Implemented in ULPartOfSpeechTagger, ULInflector, ULDissector, ULNumberTranslator, ULJSONDictionaryDataSource, ULConjugator, ULStemmer, ULPluralizer, ULSingularizer, and ULDefiner.

virtual bool ULWorker::isServiceAvailable ( const ULServiceDescriptor service)
pure virtual
Returns
true if the specified service can be performed by this ULWorker, and false otherwise.
Parameters
serviceThe desired service.

Implemented in ULPartOfSpeechTagger, ULInflector, ULDissector, ULNumberTranslator, ULJSONDictionaryDataSource, ULConjugator, ULStemmer, ULPluralizer, ULSingularizer, and ULDefiner.

virtual void ULWorker::setCancelOperation ( bool  shouldCancel)
virtual

Setter for the long-operation cancellation boolean attribute.

Parameters
[in]setto true if

Reimplemented in ULStemmer.

virtual bool ULWorker::shouldCancelOperation ( ) const
virtual
Returns
true if the cancel-operation flag is set, false otherwise.

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