OEDBTracer

class OEDBTracer : public OEDBTracerBase

A thread-safe implementation of OEDBTracerBase meant for tracking the progress of a OEShapeDatabase query.

The following methods are publicly inherited from OEDBTracerBase:

SetTotal

Update

Constructors

OEDBTracer(size_t numBins=0)

Construct a new thread-safe OEDBTracer object and initialize the internal synchronization primitives that are required.

The numBins argument specifies how many bins the internal OEFastROCSHistogram will have. The granularity of each bin is the determined by the range of the score divided by the number of bins. Note, OEShapeDatabaseType.Shape and OEShapeDatabaseType.Color have a range of 0.0-1.0, while OEShapeDatabaseType.Combo has a range of 0.0-2.0.

GetCounts

OEULongLong GetCounts(bool blocking=false)

Returns the current number of conformers already searched by a OEShapeDatabase. This is a thread-safe function for querying the current progress of the database search. OEShapeDatabase will update the progress of this tracer through the OEDBTracer.Update method from multiple threads. This function can be used by another thread to query that total progress.

The optional blocking parameter specifies whether the call should wait until there has been an update to the tracer before returning. This can be useful for making progress updates not spin too rapidly reporting the same number every time.

GetHistogram

OEFastROCSHistogram GetHistogram()

Return a copy of the histogram currently accumulated in this database query as a OEFastROCSHistogram object. This histogram will be empty if numBins passed to the constructor is 0.

This is a thread-safe function for querying the current distribution of scores for the molecules already processed. The full histogram of the scores is not available until the value returned by OEDBTracer.GetCounts is equal to OEDBTracer.GetTotal.

GetNumBins

size_t GetNumBins() const

Return the number of bins to use for the score histogram during this particular query. Returning ‘0’, the default, will indicate to OEShapeDatabase.GetScores or OEShapeDatabase.GetSortedScores to skip histogram creation all together.

GetTotal

OEULongLong GetTotal()

Return the total number of conformers to be processed.

Warning

It is possible for this function to return 0 for a short time after a call to OEShapeDatabase.GetScores or OEShapeDatabase.GetSortedScores. So a 0 return value should be taken with a grain of salt of that possible race-condition.

SetTotal

void SetTotal(OEULongLong total)

Called by OEShapeDatabase.GetScores and OEShapeDatabase.GetSortedScores to set whatever the total number of conformers that will be processed.

Update

void Update(OEULongLong step=1,
            const OEFastROCSHistogram *hist=NULL)

Called by OEShapeDatabase.GetScores and OEShapeDatabase.GetSortedScores from multiple threads to communicate the current progress of the search.