Log in or register to post comments

load tracker data

August 8, 2011 - 12:48am #1

I found a very wired thing:

The below is class Tracker.
You will find load( ) is a pure virtual function, which means it is not defined.

However, in the function loadTracker( ), you will see load is called directly, which is not defined yet.

This is a very strange thing. Why a pure virtual function can be run before defined ?

(The sample code is ImageTarget )

class QCAR_API Tracker : private NonCopyable
{
public:

/// Enumeration of the different tracker types
enum TYPE {
IMAGE_TARGET = 1, /// /// MARKER = 2, /// ALL = 0xffff /// /// };

/// Provides access to the Tracker singleton
static Tracker& getInstance();

/// Starts reading the configuration file and initializes all required
/// trackers, then advances internal dataset loading state
/**
* Return value is the progress in percent (0-100).
*
* Load can be called more than once per application lifetime.
* For all subsequent calls it frees all run-time data not required anymore
* and loads new tracking data.
*/
virtual int load() = 0;

Re: load tracker data

August 8, 2011 - 8:58am #3

Thanks, man, you are really awesome.

Yes, that is what I meant. After I post my question, I also find out the answer.

However, do you know where I can see the source of the sub-class derived from Tracker, which is used in getInstance ( ) ?????

Re: load tracker data

August 8, 2011 - 2:51am #2

Where is the code you are looking at in ImageTargets? Do you mean this code?

// Load the tracker data
do {
nPercentComplete = QCAR::Tracker::getInstance().load();
} while (0 nPercentComplete);

In this code the getInstance function returns an object of a class derived from Tracker that implements the load member function.

Chris

Log in or register to post comments